Skip to content

Commit 81be6ac

Browse files
committed
Support 3.13 and migrate uv from PDM
1 parent 00a5b6e commit 81be6ac

File tree

16 files changed

+630
-553
lines changed

16 files changed

+630
-553
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,3 +168,6 @@ cython_debug/
168168

169169
# macOS
170170
.DS_Store
171+
172+
# Development
173+
.python-version

.vscode/extensions.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"recommendations": [
3-
"ms-python.black-formatter",
4-
"ms-python.vscode-pylanc"
3+
"charliermarsh.ruff",
4+
"ms-python.python"
55
]
6-
}
6+
}

CONTRIBUTING.md

Lines changed: 0 additions & 6 deletions
This file was deleted.

README.md

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,17 @@
1-
[![PyPI](https://img.shields.io/pypi/v/i21y)](https://pypi.org/project/i21y/) ![PyPI - Python Version](https://img.shields.io/pypi/pyversions/i21y) ![PyPI - Downloads](https://img.shields.io/pypi/dm/i21y) ![PyPI - License](https://img.shields.io/pypi/l/i21y) [![Documentation Status](https://readthedocs.org/projects/i21y/badge/?version=latest)](https://i21y.readthedocs.io/en/latest/?badge=latest) [![Buy Me a Coffee](https://img.shields.io/badge/-tasuren-E9EEF3?label=Buy%20Me%20a%20Coffee&logo=buymeacoffee)](https://www.buymeacoffee.com/tasuren)
1+
[![PyPI](https://img.shields.io/pypi/v/i21y)](https://pypi.org/project/i21y/)
2+
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/i21y)
3+
![PyPI - Downloads](https://img.shields.io/pypi/dm/i21y)
4+
![PyPI - License](https://img.shields.io/pypi/l/i21y)
5+
[![Documentation Status](https://readthedocs.org/projects/i21y/badge/?version=latest)](https://i21y.readthedocs.io/en/latest/?badge=latest)
6+
[![Buy Me a Coffee](https://img.shields.io/badge/-tasuren-E9EEF3?label=Buy%20Me%20a%20Coffee&logo=buymeacoffee)](https://www.buymeacoffee.com/tasuren)
7+
28
# i21y
39
i21y (a.k.a internationalization.py) is library for support i18n in Python. It is easy to use.
410

511
**Features:**
612
- Zero dependencies by default
713
- Simple design
8-
- Tools to Simplify Keys
14+
- Utilities to simplify keys
915

1016
## Installation
1117
Normal: `pip install i21y`
@@ -36,5 +42,7 @@ assert t(LONG_KEY + "but_easy_to_use", locale="ja") == "とても長いキーで
3642
## Documentation
3743
See the [documentation](https://i21y.readthedocs.io/) for usage and details.
3844

39-
## License
40-
i21y is licensed under the [MIT license](./LICENSE).
45+
## Contributing Guide
46+
This project is managed by the package manager PDM.
47+
In coding, please use Black as a code formatter and pyright for type checking. The configuration is described in `pyproject.toml`.
48+
Please write what you have done in a complete sentence and use the original form of the verb. e.g. `Fix that locale_str can't join`.

pdm.lock

Lines changed: 0 additions & 490 deletions
This file was deleted.

pyproject.toml

Lines changed: 30 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -2,52 +2,53 @@
22
name = "i21y"
33
description = "The simple library for i18n support."
44
authors = [
5-
{name = "Takagi Tasuku", email = "tasuren@outlook.jp"},
5+
{ name = "Takagi Tasuku", email = "tasuren@outlook.jp" },
66
]
7-
dependencies = []
8-
requires-python = ">=3.11"
97
readme = "README.md"
10-
license = {file = "LICENSE"}
8+
license = { file = "LICENSE" }
119
keywords = ["i18n"]
1210
classifiers = [
11+
"Programming Language :: Python :: 3.13",
12+
"Programming Language :: Python :: 3.12",
1313
"Programming Language :: Python :: 3.11",
1414
"Topic :: Software Development :: Internationalization",
1515
"Typing :: Typed"
1616
]
17-
include = ["i21y/py.typed"]
17+
requires-python = ">=3.11"
18+
dependencies = []
1819
dynamic = ["version"]
1920

20-
[tool.pdm]
21-
version = {source = "file", path = "src/i21y/__init__.py"}
21+
[project.optional-dependencies]
22+
yaml = ["pyyaml~=6.0"]
23+
fast_json = ["orjson~=3.10"]
24+
25+
[tool.uv]
26+
dev-dependencies = [
27+
"myst-parser>=4.0.0",
28+
"pytest>=8.3.3",
29+
"sphinx>=8.1.2",
30+
"sphinx-intl>=2.2.0",
31+
"ruff>=0.6.9",
32+
]
2233

2334
[project.urls]
2435
Source = "https://github.com/tasuren/i21y"
2536
Documentation = "https://i21y.readthedocs.io/"
2637
Donate = "https://www.buymeacoffee.com/tasuren"
27-
Chat = "https://discord.gg/kfMwZUyGFG"
28-
29-
[optional-dependencies]
30-
yaml = ["pyyaml~=6.0"]
31-
fast_json = ["orjson~=3.8.6"]
3238

33-
[tool.pdm.dev-dependencies]
34-
test = [
35-
"pytest~=7.1.2",
36-
"pyyaml~=6.0",
37-
"orjson~=3.8.6"
38-
]
39-
doc = [
40-
"sphinx",
41-
"sphinx-intl",
42-
"myst-parser"
43-
]
39+
[tool.pytest.ini_options]
40+
addopts = ["--import-mode=importlib"]
41+
testpaths = ["tests"]
4442

4543
[build-system]
46-
requires = ["pdm-backend"]
47-
build-backend = "pdm.backend"
44+
requires = ["hatchling"]
45+
build-backend = "hatchling.build"
46+
47+
[tool.hatch.version]
48+
path = "src/i21y/__init__.py"
4849

49-
[tool.pyright]
50-
typingCheckMode = "basic"
50+
[tool.hatch.metadata]
51+
allow-direct-references = true
5152

52-
[tool.black]
53-
target-version = ['py311']
53+
[tool.hatch.build.targets.wheel]
54+
packages = ["src/i21y"]

src/i21y/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
__author__ = "Takagi Tasuku"
2-
__version__ = "0.2.0"
2+
__version__ = "0.3.0"
33
__all__ = ("Translator", "I21YError", "TranslationNotFound", "locale_str")
44

5-
from .translator import Translator
65
from .error import I21YError, TranslationNotFound
6+
from .translator import Translator
77
from .utils import locale_str

src/i21y/abc.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@ def search_impl(
2222
@overload
2323
def search(
2424
self, locale: str, key: str, default: type[Undefined] = Undefined
25-
) -> str:
26-
...
25+
) -> str: ...
2726

2827
@overload
29-
def search(self, locale: str, key: str, default: SearchT = Undefined) -> SearchT:
30-
...
28+
def search(
29+
self, locale: str, key: str, default: SearchT = Undefined
30+
) -> SearchT: ...
3131

3232
def search(
3333
self, locale: str, key: str, default: SearchT | type[Undefined] = Undefined

src/i21y/loaders/file_.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,9 @@ class LocaleFile:
3030

3131
def __init__(self, parent: Loader, locale: str, path: PurePath) -> None:
3232
self.parent, self.path, self.data = parent, path, DataDict()
33-
self.locale, self.key = locale, ".".join(
34-
self.path.parts[parent.path_size + 1 : -1] + (self.path.stem,)
33+
self.locale, self.key = (
34+
locale,
35+
".".join(self.path.parts[parent.path_size + 1 : -1] + (self.path.stem,)),
3536
)
3637

3738
def get(self, key: str | Iterable[str]) -> str | None:

src/i21y/loaders/json.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
from pathlib import PurePath
44

5-
from .file_ import Loader as FileLoader, LocaleFile
5+
from .file_ import Loader as FileLoader
6+
from .file_ import LocaleFile
67

78
try:
89
from orjson import loads

src/i21y/loaders/yaml.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
% e
1616
)
1717

18-
from .file_ import Loader as FileLoader, LocaleFile
18+
from .file_ import Loader as FileLoader
19+
from .file_ import LocaleFile
1920

2021

2122
class Loader(FileLoader):

src/i21y/utils.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,14 +65,12 @@ def join_raw(self, *other: str | locale_str) -> str:
6565
@overload
6666
def join(
6767
self: ..., *other: str | locale_str, cls: type[AdtnlClsT], **extras: Any
68-
) -> AdtnlClsT:
69-
...
68+
) -> AdtnlClsT: ...
7069

7170
@overload
7271
def join(
7372
self: SelfT, *other: str | locale_str, cls: None = None, **extras: Any
74-
) -> SelfT:
75-
...
73+
) -> SelfT: ...
7674

7775
def join(
7876
self: SelfT,

tests/test_general.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
from src.i21y import Translator
2-
from src.i21y.loaders.json import Loader
1+
from i21y import Translator
2+
from i21y.loaders.json import Loader
33

44

55
def do_test_translator(t: Translator[Loader]) -> None:
66
assert t("general.main") == "main"
77
assert t("general.main", locale="ja") == "メイン"
88

9-
from src.i21y.utils import locale_str
9+
from i21y.utils import locale_str
1010

1111
BASE = locale_str("wow.a")
1212
assert t(BASE.b) == "Layor B"

tests/test_locale_str.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
from src.i21y import locale_str
2-
1+
from i21y import locale_str
32

43
BASE = locale_str("aiueo")
54
assert str(BASE) == "aiueo" and BASE.key == "aiueo"

tests/test_yaml.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
from src.i21y import Translator
2-
from src.i21y.loaders.yaml import Loader
1+
from i21y import Translator
2+
from i21y.loaders.yaml import Loader
33

44

55
def do_test_translator(t: Translator[Loader]) -> None:

0 commit comments

Comments
 (0)