diff --git a/mex-{{ cookiecutter.project_name }}/.dockerignore b/mex-{{ cookiecutter.project_name }}/.dockerignore index 2f9109b..5485f54 100644 --- a/mex-{{ cookiecutter.project_name }}/.dockerignore +++ b/mex-{{ cookiecutter.project_name }}/.dockerignore @@ -126,8 +126,7 @@ dmypy.json .pydocstyle Makefile mex.bat -pdm.lock -poetry.lock +*.lock poetry.toml pytest.ini requirements.txt diff --git a/mex-{{ cookiecutter.project_name }}/.pre-commit-config.yaml b/mex-{{ cookiecutter.project_name }}/.pre-commit-config.yaml index ce30b2d..f6b3559 100644 --- a/mex-{{ cookiecutter.project_name }}/.pre-commit-config.yaml +++ b/mex-{{ cookiecutter.project_name }}/.pre-commit-config.yaml @@ -26,16 +26,16 @@ repos: name: whitespaces - id: fix-byte-order-marker name: byte-order - - repo: https://github.com/python-poetry/poetry - rev: 1.8.2 + - repo: https://github.com/pdm-project/pdm + rev: 2.12.4 hooks: - - id: poetry-check - name: poetry + - id: pdm-lock-check + name: pdm - repo: local hooks: - id: mypy name: mypy - entry: poetry run dmypy run --timeout 7200 -- mex + entry: pdm run dmypy run --timeout 7200 -- mex files: ^mex/ language: system pass_filenames: false diff --git a/mex-{{ cookiecutter.project_name }}/Makefile b/mex-{{ cookiecutter.project_name }}/Makefile index ab1fea9..48d875a 100644 --- a/mex-{{ cookiecutter.project_name }}/Makefile +++ b/mex-{{ cookiecutter.project_name }}/Makefile @@ -18,7 +18,7 @@ hooks: install: setup hooks # install packages from lock file in local virtual environment @ echo installing package; \ - poetry install --no-interaction --sync; \ + pdm sync --clean --group dev; \ linter: # run the linter hooks from pre-commit on all files @@ -28,12 +28,12 @@ linter: pytest: # run the pytest test suite with all unit tests @ echo running unit tests; \ - poetry run pytest -m "not integration"; \ + pdm run pytest -m "not integration"; \ wheel: # build the python package @ echo building wheel; \ - poetry build --no-interaction --format wheel; \ + pdm build --no-sdist; \ container: # build the docker image @@ -61,5 +61,5 @@ start: container docs: # use sphinx to auto-generate html docs from code @ echo generating api docs; \ - poetry run sphinx-apidoc -f -o docs/source mex; \ - poetry run sphinx-build -aE -b dirhtml docs docs/dist; \ + pdm run sphinx-apidoc -f -o docs/source mex; \ + pdm run sphinx-build -aE -b dirhtml docs docs/dist; \ diff --git a/mex-{{ cookiecutter.project_name }}/README.md b/mex-{{ cookiecutter.project_name }}/README.md index c757f47..34c11ba 100644 --- a/mex-{{ cookiecutter.project_name }}/README.md +++ b/mex-{{ cookiecutter.project_name }}/README.md @@ -64,16 +64,15 @@ components of the MEx project are open-sourced under the same license as well. - on windows run `.\mex.bat test` - or run manually - linter checks via `pre-commit run --all-files` - - all tests via `poetry run pytest` - - just unit tests via `poetry run pytest -m "not integration"` + - all tests via `pdm run pytest` + - just unit tests via `pdm run pytest -m "not integration"` ### updating dependencies - update boilerplate files with `cruft update` - update global requirements in `requirements.txt` manually - update git hooks with `pre-commit autoupdate` -- show outdated dependencies with `poetry show --outdated` -- update dependencies in poetry using `poetry update --lock` +- update package dependencies using `pdm autoupdate` - update github actions in `.github/workflows/*.yml` manually ### creating release @@ -91,8 +90,8 @@ components of the MEx project are open-sourced under the same license as well. ## commands -- run `poetry run {command} --help` to print instructions -- run `poetry run {command} --debug` for interactive debugging +- run `pdm run {command} --help` to print instructions +- run `pdm run {command} --debug` for interactive debugging ### {{ cookiecutter.project_name }} diff --git a/mex-{{ cookiecutter.project_name }}/mex.bat b/mex-{{ cookiecutter.project_name }}/mex.bat index 858e7f6..2d8e8be 100644 --- a/mex-{{ cookiecutter.project_name }}/mex.bat +++ b/mex-{{ cookiecutter.project_name }}/mex.bat @@ -22,7 +22,7 @@ if "%CI%"=="" ( @REM install packages from lock file in local virtual environment echo installing package -poetry install --no-interaction --sync +pdm sync --clean --group dev exit /b %errorlevel% @@ -34,14 +34,14 @@ if %errorlevel% neq 0 exit /b %errorlevel% @REM run the pytest test suite with unit and integration tests echo running all tests -poetry run pytest +pdm run pytest exit /b %errorlevel% :docs @REM use sphinx to auto-generate html docs from code echo generating api docs -poetry run sphinx-apidoc -f -o docs\source mex +pdm run sphinx-apidoc -f -o docs\source mex if %errorlevel% neq 0 exit /b %errorlevel% -poetry run sphinx-build -aE -b dirhtml docs docs\dist +pdm run sphinx-build -aE -b dirhtml docs docs\dist exit /b %errorlevel% diff --git a/mex-{{ cookiecutter.project_name }}/poetry.toml b/mex-{{ cookiecutter.project_name }}/poetry.toml deleted file mode 100644 index ab1033b..0000000 --- a/mex-{{ cookiecutter.project_name }}/poetry.toml +++ /dev/null @@ -1,2 +0,0 @@ -[virtualenvs] -in-project = true diff --git a/mex-{{ cookiecutter.project_name }}/pyproject.toml b/mex-{{ cookiecutter.project_name }}/pyproject.toml index 9cc7ec7..c19fd61 100644 --- a/mex-{{ cookiecutter.project_name }}/pyproject.toml +++ b/mex-{{ cookiecutter.project_name }}/pyproject.toml @@ -1,27 +1,25 @@ -[tool.poetry] +[project] name = "mex-{{ cookiecutter.project_name }}" version = "0.1.0" description = "{{ cookiecutter.short_summary }}" -authors = ["RKI MEx Team "] -readme = "README.md" -license = "MIT" -repository = "https://github.com/robert-koch-institut/mex-{{ cookiecutter.project_name }}" -packages = [{ include = "mex" }] - -[tool.poetry.dependencies] -python = "^3.11" - -[tool.poetry.group.dev.dependencies] -black = "^24.2.0" -ipdb = "^0.13.13" -mypy = "^1.9.0" -pytest = "^8.1.1" -pytest-cov = "^4.1.0" -pytest-random-order = "^1.1.1" -ruff = "^0.3.2" -sphinx = "^7.2.6" +authors = [{ name = "MEx Team", email = "mex@rki.de" }] +readme = { file = "README.md", content-type = "text/markdown" } +license = { file = "LICENSE" } +urls = { Repository = "https://github.com/robert-koch-institut/mex-{{ cookiecutter.project_name }}" } +requires-python = ">=3.11" +dependencies = [] +optional-dependencies.dev = [ + "black>=24.2.0", + "ipdb>=0.13.13", + "mypy>=1.9.0", + "pytest>=8.1.1", + "pytest-cov>=4.1.0", + "pytest-random-order>=1.1.1", + "ruff>=0.3.2", + "sphinx>=7.2.6", +] -[tool.poetry.scripts] +[project.scripts] {{ cookiecutter.project_name }} = "mex.{{ cookiecutter.project_name }}.main:main" [tool.cruft] @@ -37,6 +35,14 @@ show_error_codes = true strict = true plugins = ["pydantic.mypy"] +[tool.pdm] +distribution = true + +[tool.pdm.scripts] +autoupdate = { cmd = "pdm update --group :all --update-eager --save-minimum" } +lint = { cmd = "pre-commit run --all-files" } +test = { cmd = "pdm run pytest --numprocesses=auto --dist=worksteal" } + [tool.pydantic-mypy] warn_untyped_fields = true @@ -109,5 +115,5 @@ known-first-party = ["mex", "tests"] convention = "google" [build-system] -requires = ["poetry-core>=1.9.0"] -build-backend = "poetry.core.masonry.api" +requires = ["pdm-backend>=2.1.8"] +build-backend = "pdm.backend" diff --git a/mex-{{ cookiecutter.project_name }}/requirements.txt b/mex-{{ cookiecutter.project_name }}/requirements.txt index 9e1127d..279088b 100644 --- a/mex-{{ cookiecutter.project_name }}/requirements.txt +++ b/mex-{{ cookiecutter.project_name }}/requirements.txt @@ -1,4 +1,4 @@ cruft==2.15.0 -poetry==1.8.2 +pdm==2.12.4 pre-commit==3.6.2 wheel==0.43.0