Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use pyproject.toml and PDM #1107

Merged
merged 1 commit into from
Sep 28, 2022
Merged

use pyproject.toml and PDM #1107

merged 1 commit into from
Sep 28, 2022

Conversation

davidism
Copy link
Member

@davidism davidism commented Sep 27, 2022

Use the pyproject.toml standard to specify project metadata and dependencies. Use PDM to lock development dependencies and manage the environment.

Tool configuration was moved to pyproject.toml, except for flake8, which does not support that file. Flake8 config remains in setup.cfg. setup.py remains for GitHub's dependency graph, although PDM might write a GitHub action for updating the dependency graph eventually.

Read the Docs doesn't support non-pip tools natively, but they recently added support for custom build steps. This uses post_install to install PDM and run pdm sync -dG docs after RTD sets up the virtualenv and installs its own packages.

Contributors can use PDM to set up a virtualenv and sync development dependencies. Install PDM, then do pdm sync. This will create a virtualenv in the .venv folder if it doesn't exist, then install the locked versions of all development dependencies, and install the project in editable mode. Commands are run with pdm run ... without requiring activating the virtualenv. Alternatively, you can use a tool like pew to manage virtualenvs, PDM will detect an active virtualenv and use that instead, and pip install -e . will continue to work as well.

Common commands:

  • pdm sync install the current set of locked dependencies
  • pdm run pytest
  • pdm run mypy
  • pdm run tox -p run all test envs in parallel
  • cd docs && make html make the docs locally, caching changes

Advanced / maintainer commands:

  • pdm update --update-all update all versions in the lock file
  • eval $(pdm venv activate) activate the virtualenv so pdm run ... isn't needed
  • pew workon flask-sqlalchemy use pew to manage the virtualenv and switch to the project, then pdm sync will install to that env.

@davidism davidism added this to the 3.0.0 milestone Sep 27, 2022
@davidism davidism force-pushed the pdm branch 2 times, most recently from 197ebfe to 260420f Compare September 28, 2022 00:50
@davidism davidism marked this pull request as draft September 28, 2022 00:51
@davidism
Copy link
Member Author

Looks like Read the Docs is going to be more difficult. It doesn't activate the virtualenv it creates, so PDM creates its own env.

@frostming
Copy link

You may be interested: pdm-project/pdm#1365 (comment)

@davidism davidism force-pushed the pdm branch 2 times, most recently from 0a69a95 to 9220da6 Compare September 28, 2022 12:59
@davidism
Copy link
Member Author

Thanks, docs are building now. Reported this to RTD here: readthedocs/readthedocs.org#9629

@davidism davidism marked this pull request as ready for review September 28, 2022 13:23
@davidism davidism merged commit 8782fba into main Sep 28, 2022
@davidism davidism deleted the pdm branch September 28, 2022 16:17
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 13, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants