From @12rambau/pypackage - 0.1.11 Copier project. + 0.1.16 Copier project.
diff --git a/docs/conf.py b/docs/conf.py index 741d53f..afad2ac 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -64,6 +64,12 @@ "url": "https://pypi.org/project/pygadm", "icon": "fa-brands fa-python", }, + { + "name": "Conda", + "url": "https://anaconda.org/conda-forge/pygadm", + "icon": "fa-custom fa-conda", + "type": "fontawesome", + }, ], } html_context = { diff --git a/noxfile.py b/noxfile.py index d604f32..7984872 100644 --- a/noxfile.py +++ b/noxfile.py @@ -2,6 +2,7 @@ The nox run are build in isolated environment that will be stored in .nox. to force the venv update, remove the .nox/xxx folder. """ + import datetime import fileinput @@ -10,37 +11,36 @@ nox.options.sessions = ["lint", "test", "docs", "mypy"] -@nox.session(reuse_venv=True) +@nox.session(reuse_venv=True, venv_backend="uv") def lint(session): """Apply the pre-commits.""" session.install("pre-commit") session.run("pre-commit", "run", "--all-files", *session.posargs) -@nox.session(reuse_venv=True) +@nox.session(reuse_venv=True, venv_backend="uv") def test(session): """Run the selected tests and report coverage in html.""" session.install(".[test]") test_files = session.posargs or ["tests"] - session.run("pytest", "--color=yes", "--cov", "--cov-report=html", *test_files) + session.run("pytest", "--cov", "--cov-report=html", *test_files) -@nox.session(reuse_venv=True, name="ci-test") +@nox.session(reuse_venv=True, name="ci-test", venv_backend="uv") def ci_test(session): """Run all the test and report coverage in xml.""" session.install(".[test]") - session.posargs[0] if session.posargs else "default" - session.run("pytest", "--color=yes", "--cov", "--cov-report=xml") + session.run("pytest", "--cov", "--cov-report=xml") -@nox.session(reuse_venv=True, name="dead-fixtures") +@nox.session(reuse_venv=True, name="dead-fixtures", venv_backend="uv") def dead_fixtures(session): """Check for dead fixtures within the tests.""" session.install(".[test]") session.run("pytest", "--dead-fixtures") -@nox.session(reuse_venv=True) +@nox.session(reuse_venv=True, venv_backend="uv") def docs(session): """Build the documentation.""" build = session.posargs.pop() if session.posargs else "html" @@ -50,15 +50,15 @@ def docs(session): session.run("python", "tests/check_warnings.py") -@nox.session(name="mypy", reuse_venv=True) +@nox.session(name="mypy", reuse_venv=True, venv_backend="uv") def mypy(session): """Run a mypy check of the lib.""" - session.install("mypy") + session.install("mypy", "types-deprecated") test_files = session.posargs or ["pygadm"] session.run("mypy", *test_files) -@nox.session(reuse_venv=True) +@nox.session(reuse_venv=True, venv_backend="uv") def stubgen(session): """Generate stub files for the lib but requires human attention before merge.""" session.install("mypy") @@ -66,7 +66,7 @@ def stubgen(session): session.run("stubgen", "-p", package[0], "-o", "stubs", "--include-private") -@nox.session(name="release-date", reuse_venv=True) +@nox.session(name="release-date", reuse_venv=True, venv_backend="uv") def release_date(session): """Update the release date of the citation file.""" current_date = datetime.datetime.now().strftime("%Y-%m-%d") diff --git a/pygadm/bin/refresh_database.py b/pygadm/bin/refresh_database.py index e1fb38b..8750318 100644 --- a/pygadm/bin/refresh_database.py +++ b/pygadm/bin/refresh_database.py @@ -22,7 +22,6 @@ parser = argparse.ArgumentParser(description=__doc__, usage="refresh_database") if __name__ == "__main__": - # read arguments parser.add_argument( "-f", @@ -41,7 +40,6 @@ # read the all the geodata available in the server at once with tempfile.TemporaryDirectory() as tmp_dir: - # check if a download is required if vars(args)["gadm_src"] is not None: zip_file = Path(vars(args)["gadm_src"]) diff --git a/pyproject.toml b/pyproject.toml index 0760f9b..dc9f9a5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -43,7 +43,6 @@ Homepage = "https://github.com/12rambau/pygadm" [project.optional-dependencies] test = [ "pytest", - "pytest-sugar", "pytest-cov", "pytest-deadfixtures", "pytest-regressions>=2.4.3", # https://github.com/ESSS/pytest-regressions/issues/136 @@ -70,7 +69,7 @@ only-include = ["pygadm"] dependencies = [ "pre-commit", "commitizen", - "nox" + "nox[uv]" ] post-install-commands = ["pre-commit install"] @@ -87,32 +86,28 @@ version_files = [ [tool.pytest.ini_options] testpaths = "tests" -[tool.black] -line-length = 100 - [tool.ruff] -ignore-init-module-imports = true +line-length = 100 fix = true + +[tool.ruff.lint] select = ["E", "F", "W", "I", "D", "RUF"] ignore = [ "E501", # line too long | Black take care of it - "W605", # invalid escape sequence | we escape specific characters for sphinx - "D212", # Multi-line docstring | we use a different convention, too late - "D101", # Missing docstring in public class | we use a different convention, too late + "W605", # invalid escape sequence | we escape specific characters for sphinx + "D212", # Multi-line docstring | we use a different convention, too late + "D101", # Missing docstring in public class | we use a different convention, too late ] -[tool.ruff.flake8-quotes] +[tool.ruff.lint.flake8-quotes] docstring-quotes = "double" -[tool.ruff.pydocstyle] +[tool.ruff.lint.pydocstyle] convention = "google" [tool.coverage.run] source = ["pygadm"] -[tool.doc8] -ignore = ["D001"] # we follow a 1 line = 1 paragraph style - [tool.mypy] scripts_are_modules = true ignore_missing_imports = true @@ -120,8 +115,5 @@ install_types = true non_interactive = true warn_redundant_casts = true -[tool.licensecheck] -using = "PEP631" - [tool.codespell] skip = 'CHANGELOG.md,**/*.json,**/*.csv' diff --git a/tests/check_warnings.py b/tests/check_warnings.py index 73750c8..04db76e 100644 --- a/tests/check_warnings.py +++ b/tests/check_warnings.py @@ -52,7 +52,6 @@ def check_warnings(file: Path) -> int: if __name__ == "__main__": - # cast the file to path and resolve to an absolute one file = Path.cwd() / "warnings.txt" diff --git a/tests/test_continent.py b/tests/test_continent.py index 6bfcede..37ccc2c 100644 --- a/tests/test_continent.py +++ b/tests/test_continent.py @@ -1,4 +1,5 @@ """Tests of the continents submanagement.""" + import json from pathlib import Path