Skip to content

Commit ed99561

Browse files
refactor!: migrate from poetry to uv
BREAKING CHANGE: config.json is moved to the project root directory and won't be loaded from previous location
1 parent 6374ff8 commit ed99561

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+621
-787
lines changed

.github/dependabot.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
version: 2
77
updates:
8-
- package-ecosystem: "pip" # See documentation for possible values
8+
- package-ecosystem: "uv" # See documentation for possible values
99
directory: "/" # Location of package manifests
1010
schedule:
1111
interval: "weekly"

.github/workflows/lint.yml

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,32 +7,23 @@ jobs:
77
runs-on: ${{matrix.os}}
88
strategy:
99
matrix:
10-
python: ["3.11", "3.12"]
10+
python: ["3.11", "3.12", "3.13"]
1111
os: ["ubuntu-latest", "windows-latest"]
1212

1313
steps:
1414
- uses: actions/checkout@v4
15-
- name: Set up Python ${{matrix.python}}
16-
uses: actions/setup-python@v4
15+
- name: Install the latest version of uv with Python ${{matrix.python}}
16+
uses: astral-sh/setup-uv@v7
1717
with:
1818
python-version: ${{matrix.python}}
1919

20-
- name: Install poetry
21-
run: |
22-
pip install pipx
23-
pipx install poetry
24-
25-
- name: Install dependencies
26-
run: |
27-
poetry install
28-
2920
- name: Linting code by ruff
3021
run: |
31-
poetry run ruff check .
22+
uv run ruff check .
3223
3324
- name: Check types by pyright
3425
run: |
35-
poetry run pyright .
26+
uv run pyright .
3627
3728
- name: Run unit-tests
38-
run: poetry run python -m unittest
29+
run: uv run python -m unittest

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
/SC/
1111

1212
# Configuration files
13-
xcoder/config.json
13+
config.json
1414

1515
# Python compiled files
1616
*.pyc

README.md

Lines changed: 5 additions & 3 deletions

poetry.lock

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

pyproject.toml

Lines changed: 41 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,50 @@
1-
[tool.poetry]
1+
[project]
22
name = "xcoder"
33
version = "0.1.0"
44
description = ""
5-
authors = ["Danila <crowo4ka@gmail.com>"]
5+
authors = [{ name = "Danila", email = "crowo4ka@gmail.com" }]
6+
requires-python = ">=3.11,<4"
67
readme = "README.md"
8+
classifiers = [
9+
"Programming Language :: Python :: 3",
10+
"Programming Language :: Python :: 3.11",
11+
"Programming Language :: Python :: 3.12",
12+
"Programming Language :: Python :: 3.13",
13+
"Programming Language :: Python :: 3.14",
14+
]
15+
dependencies = [
16+
"sc-compression==0.6.6",
17+
"colorama==0.4.6",
18+
"zstandard>=0.23.0,<0.24",
19+
"pillow~=11.2.1",
20+
"loguru==0.7.3",
21+
]
722

8-
[tool.poetry.dependencies]
9-
python = "^3.11"
10-
sc-compression = "0.6.6"
11-
colorama = "0.4.6"
12-
pylzham = "^0.1.3"
13-
zstandard = "^0.23.0"
14-
pillow = "~11.2.1"
15-
loguru = "0.7.3"
23+
[project.optional-dependencies]
24+
lzham = ["pylzham>=0.1.3,<0.2"]
1625

26+
[dependency-groups]
27+
dev = [
28+
"pyright>=1.1.376,<2",
29+
"black>=24.8.0,<25",
30+
"pre-commit>=3.8.0,<4",
31+
"ruff>=0.11.2,<0.12",
32+
]
1733

18-
[tool.poetry.group.dev.dependencies]
19-
pyright = "^1.1.376"
20-
black = "^24.8.0"
21-
pre-commit = "^3.8.0"
22-
ruff = "^0.11.2"
34+
[project.scripts]
35+
xcoder = "xcoder.__main__:main"
2336

2437
[build-system]
25-
requires = ["poetry-core"]
26-
build-backend = "poetry.core.masonry.api"
38+
requires = ["uv_build>=0.9.18,<0.10.0"]
39+
build-backend = "uv_build"
40+
41+
[tool.uv]
42+
43+
[tool.uv.build-backend]
44+
module-name = "xcoder"
45+
46+
[tool.isort]
47+
profile = "black"
48+
force_sort_within_sections = true # Don't group `from` imports separately
49+
order_by_type = true # Order by CONSTANT, CamelCase, snake_case
50+
Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,12 @@
11
import time
22

3-
from xcoder.config import config
4-
from xcoder.localization import locale
5-
from xcoder.main_menu import check_auto_update, check_files_updated, menu, refill_menu
6-
7-
try:
8-
from loguru import logger
9-
except ImportError:
10-
raise RuntimeError("Please, install loguru using pip")
3+
from loguru import logger
114

125
from xcoder import clear
6+
from xcoder.config import config
137
from xcoder.features.initialization import initialize
8+
from xcoder.localization import locale
9+
from xcoder.main_menu import check_auto_update, check_files_updated, menu, refill_menu
1410

1511

1612
def main():
@@ -26,21 +22,27 @@ def main():
2622

2723
refill_menu()
2824

29-
while True:
30-
handler = menu.choice()
31-
if handler is not None:
25+
interrupted = False
26+
while not interrupted:
27+
try:
28+
handler = menu.choice()
29+
if handler is None:
30+
continue
31+
3232
start_time = time.time()
3333
with logger.catch():
3434
handler()
3535
logger.opt(colors=True).info(
3636
f"<green>{locale.done % (time.time() - start_time)}</green>"
3737
)
3838
input(locale.to_continue)
39-
clear()
39+
except KeyboardInterrupt:
40+
interrupted = True
41+
finally:
42+
clear()
43+
44+
logger.info("Exit.")
4045

4146

4247
if __name__ == "__main__":
43-
try:
44-
main()
45-
except KeyboardInterrupt:
46-
logger.info("Exit.")
48+
main()
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
from pathlib import Path
44
from typing import LiteralString
55

6-
_LIBRARY_DIRECTORY = Path(__file__).parent
6+
# ./src/xcoder/config.py
7+
_PROJECT_DIRECTORY = Path(__file__).parent.parent.parent
78

89

910
class Config:
@@ -12,7 +13,7 @@ class Config:
1213
REPO_OWNER: LiteralString = "xcoder-tool"
1314
REPO_NAME: LiteralString = "xcoder"
1415

15-
config_path = _LIBRARY_DIRECTORY / "config.json"
16+
config_path = _PROJECT_DIRECTORY / "config.json"
1617

1718
def __init__(self):
1819
self.config_items = (

0 commit comments

Comments
 (0)