diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml index ecf91a4..1cca51d 100644 --- a/.github/workflows/documentation.yml +++ b/.github/workflows/documentation.yml @@ -28,16 +28,10 @@ jobs: steps: - uses: actions/checkout@v5 - - name: Set up Python - uses: actions/setup-python@v6 - with: - python-version: '3.11' - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install -r requirements_dev.txt + - name: Install Hatch + uses: pypa/hatch@install - name: Build - run: mkdocs build + run: hatch run docs-build - name: Upload artifact uses: actions/upload-pages-artifact@v4 with: diff --git a/.github/workflows/unit-tests.yaml b/.github/workflows/unit-tests.yaml index f55cc1b..ba4e5da 100644 --- a/.github/workflows/unit-tests.yaml +++ b/.github/workflows/unit-tests.yaml @@ -9,21 +9,17 @@ jobs: strategy: matrix: os: [ubuntu-latest, macos-latest, windows-latest] - python-version: ["3.11", "3.12", "3.13"] steps: - uses: actions/checkout@v5 - - name: Set up Python ${{ matrix.python-version }} + - name: Set up Python uses: actions/setup-python@v6 with: - python-version: ${{ matrix.python-version }} - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install -r requirements.txt - pip install -r requirements_test.txt + python-version: "3.14" + - name: Install Hatch + uses: pypa/hatch@install - name: Test with pytest - run: pytest -v --cov-config=pyproject.toml --cov=bring_api --cov-report=xml + run: hatch test --all - name: Upload coverage to Codecov uses: codecov/codecov-action@v5 with: diff --git a/pyproject.toml b/pyproject.toml index 19c4548..c0cb33e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,13 +1,10 @@ [build-system] -requires = [ - "setuptools>=46.4.0", - "wheel" -] -build-backend = "setuptools.build_meta" +requires = ["hatchling", "hatch-regex-commit"] +build-backend = "hatchling.build" [project] name = "bring-api" -dynamic = ["version", "readme"] +dynamic = ["version"] description = "Unofficial package to access Bring! shopping lists API." authors = [ { name = "Cyrill Raccaud", email = "cyrill.raccaud+pypi@gmail.com" }, @@ -25,17 +22,54 @@ classifiers = [ "Operating System :: OS Independent" ] license = "MIT" +readme = "README.md" + +[tool.hatch.version] +source = "regex_commit" +commit_extra_args = ["-e"] +path = "bring_api/__init__.py" + +[tool.hatch.build.targets.sdist] +include = [ + "/bring_api", +] + +[tool.hatch.envs.default] +dependencies = [ + "aiohttp==3.13.1", + "pre-commit>=3.6.1", + "python-dotenv>=1.0.1", + "ruff~=0.14", + "mkdocs-material==9.6.21", + "mkdocstrings[python]==0.30.1", + "mashumaro>=3.13.1", + "orjson>=3.10.12", +] -[tool.setuptools] -packages = ["bring_api", "bring_api.locales"] +[tool.hatch.envs.hatch-static-analysis] +dependencies = [ + "ruff==0.14.1", + "mypy==1.18.2", + "pydantic==2.12.3", +] +config-path = "none" -[tool.setuptools.package-data] -bring_api = ["py.typed"] -"bring_api.locales" = ["*.json"] +[tool.hatch.envs.hatch-test] +extra-dependencies = [ + "python-dotenv==1.1.1", + "aioresponses==0.7.8", + "pytest-asyncio==1.2.0", + "pytest-cov==7.0.0", + "syrupy==5.0.0", +] +extra-args = ["--cov-report=xml", "-vv"] +type = "virtual" +[[tool.hatch.envs.hatch-test.matrix]] +python = ["3.14", "3.13", "3.12", "3.11"] -[tool.setuptools.dynamic] -version = {attr = "bring_api.__version__"} -readme = {file = ["README.md"], content-type = "text/markdown"} +[tool.hatch.envs.default.scripts] +docs-serve = "mkdocs serve" +docs-build = "mkdocs build" [project.urls] Documentation = "https://miaucl.github.io/bring-api/" @@ -188,6 +222,7 @@ log_cli = true log_cli_level = "DEBUG" log_cli_format = "%(asctime)s%(msecs)03d [%(levelname)8s] %(name)s:%(lineno)s %(message)s" log_cli_date_format = "%Y%m%dT%H%M%S." +addopts = "--cov=bring_api/ --cov-report=term-missing" [tool.coverage.run] branch = true diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 5cb31a7..0000000 --- a/requirements.txt +++ /dev/null @@ -1,3 +0,0 @@ -aiohttp~=3.11 -mashumaro>=3.13.1 -orjson>=3.10.12 \ No newline at end of file diff --git a/requirements_dev.txt b/requirements_dev.txt deleted file mode 100644 index 0778eb4..0000000 --- a/requirements_dev.txt +++ /dev/null @@ -1,10 +0,0 @@ -aiohttp~=3.11 -mypy>=1.8.0 -pydantic>=2.9.2 -pre-commit>=3.6.1 -python-dotenv>=1.0.1 -ruff~=0.14 -mkdocs-material==9.6.21 -mkdocstrings[python]==0.30.1 -mashumaro>=3.13.1 -orjson>=3.10.12 \ No newline at end of file diff --git a/requirements_test.txt b/requirements_test.txt deleted file mode 100644 index 339b63e..0000000 --- a/requirements_test.txt +++ /dev/null @@ -1,6 +0,0 @@ -aioresponses>=0.7.6 -pytest-asyncio>=0.23.6 -pytest-cov>=5.0.0 -pytest>=8.1.1 -python-dotenv>=1.0.1 -syrupy==5.0.0