-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
dev: Switch to poetry as package manager, etc
This commit swaps us to using poetry as our package manager, virtual environment manager, and build tool. Some of the changes: - Install poetry using they're recommended python installer, instead of off PyPI. IDK how important this really is, maybe it's overkill vs `python3 -m pip install poetry` - Dev dependencies only used to be available inside the specific tox environments they were used. This made it impossible to directly call `pytest`, for instance. You had to call `tox -e pytest`. Now developers have access to the toolchain directly more directly, though you still have to work within poetry's venv with `poetry run pytest`, or just start up a shell in the venv with `poetry shell` and then `pytest` directly should work. - Dev install is as easy as `poetry install -E dev`. Dependencies are only specified in one place now, pyproject.toml - Now the version info is necessarily in both pyproject.toml and in the source code, so add a simple test_meta.py file to make sure the two sources of truth stay in sync. version.py is no longer needed, so put the version info directly in __init__.py. - The [metadata] and [wheel] entries in setup.cfg are no longer needed since we're using poetry to build instead of setuptools. MANIFEST.in was never needed in the first place, since LICENSE has always by default been included in distributions. - Add a check with twine after building to ensure the built distributions are OK. - The GitHub actions workflows had to be tweaked a bit, though they are basically the same. - Add a makefile rule to update dependencies easily with `make update` - Specify using poetry as our build system in the [build-system] area of pyproject.toml. Now build and publish just with `poetry build` and `poetry publish` instead of using `python setup.py sdist upload` etc. Tell tox about this change with `isolated_build = True` intox.ini It was tricky deciding how to make tox and poetry play nicely with each other, in terms of making sure they used the same deps, the deps didn't have to be defined in multiple places, and the deps were available outside of tox. I used the extra dependencies method outlined in python-poetry/poetry#1941, though there are probably other ways to do this.
- Loading branch information
Showing
16 changed files
with
1,321 additions
and
134 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,10 +13,10 @@ jobs: | |
uses: actions/setup-python@v2 | ||
with: | ||
python-version: '3.x' | ||
- name: Upgrade to latest setuptools and wheel | ||
run: pip install --user --upgrade setuptools wheel | ||
- name: Build a binary wheel and a source tarball to dist/ | ||
run: python setup.py sdist bdist_wheel | ||
- name: Install dependencies | ||
run: make init | ||
- name: Build package | ||
run: make build | ||
- name: Publish package to PyPI | ||
uses: pypa/[email protected] | ||
with: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.