-
Notifications
You must be signed in to change notification settings - Fork 137
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
Migrate to pyproject.toml
#369
Comments
👋 Hi! The 'smartbear-supported' label has just been added to this issue, which will create an internal tracking ticket in PactFlow's Jira (PACT-1305). We will use this to prioritise and assign a team member to this task. All activity will be public on this ticket. For now, sit tight and we'll update this ticket once we have more information on the next steps. |
I noted Ron had looked at Maturin at the first attempt of the Rust integration- https://github.com/pact-foundation/pact-python/blob/feat/V3/pact-python-v3/pyproject.toml for an example |
Thanks, I'll take a look. I know of |
The previous build process relied on `distutils` which is due to be deprecated in 3.12. Furthermore, the use of `setup.py` is now discouraged. The choice to migrate to `hatch` was made for the following reasons: - It offers a very simple management of the venv. No more need to `python -m venv .venv` and `pip install`, `hatch` handles all of that automatically when creating the virtual environment. - `hatch` supercedes `tox`, allowing for multiple python versions to be tested in a single command. - `hatch` manages the build process, and offers a nicer way to hook in a custom build process to download the `pact` standalone binaries. A minor change to the packaging of the library now places the binaries in `pact/bin` instead of `pact/bin/pact/bin`. The `constants.py` file has been accordingly updated to reflect this change in case anyone was making direct use of the binaries. While this change is rather significant, it should not affect the end user experience. Users will still be able to `pip install pact-python` from PyPI. Other than for the aforementioned, there has been no changes to the library code. Resolves: #369 Refs: https://docs.python.org/3/whatsnew/3.10.html#distutils-deprecated Refs: https://setuptools.pypa.io/en/latest/userguide/quickstart.html#setuppy-discouraged
The previous build process relied on `distutils` which is due to be deprecated in 3.12. Furthermore, the use of `setup.py` is now discouraged. The choice to migrate to `hatch` was made for the following reasons: - It offers a very simple management of the venv. No more need to `python -m venv .venv` and `pip install`, `hatch` handles all of that automatically when creating the virtual environment. - `hatch` supercedes `tox`, allowing for multiple python versions to be tested in a single command. - `hatch` manages the build process, and offers a nicer way to hook in a custom build process to download the `pact` standalone binaries. A minor change to the packaging of the library now places the binaries in `pact/bin` instead of `pact/bin/pact/bin`. The `constants.py` file has been accordingly updated to reflect this change in case anyone was making direct use of the binaries. While this change is rather significant, it should not affect the end user experience. Users will still be able to `pip install pact-python` from PyPI. Other than for the aforementioned, there has been no changes to the library code. Resolves: #369 Refs: https://docs.python.org/3/whatsnew/3.10.html#distutils-deprecated Refs: https://setuptools.pypa.io/en/latest/userguide/quickstart.html#setuppy-discouraged
The previous build process relied on `distutils` which is due to be deprecated in 3.12. Furthermore, the use of `setup.py` is now discouraged. The choice to migrate to `hatch` was made for the following reasons: - It offers a very simple management of the venv. No more need to `python -m venv .venv` and `pip install`, `hatch` handles all of that automatically when creating the virtual environment. - `hatch` supercedes `tox`, allowing for multiple python versions to be tested in a single command. - `hatch` manages the build process, and offers a nicer way to hook in a custom build process to download the `pact` standalone binaries. A minor change to the packaging of the library now places the binaries in `pact/bin` instead of `pact/bin/pact/bin`. The `constants.py` file has been accordingly updated to reflect this change in case anyone was making direct use of the binaries. While this change is rather significant, it should not affect the end user experience. Users will still be able to `pip install pact-python` from PyPI. Other than for the aforementioned, there has been no changes to the library code. Resolves: #369 Refs: https://docs.python.org/3/whatsnew/3.10.html#distutils-deprecated Refs: https://setuptools.pypa.io/en/latest/userguide/quickstart.html#setuppy-discouraged Signed-off-by: JP-Ellis <[email protected]>
The previous build process relied on `distutils` which is due to be deprecated in 3.12. Furthermore, the use of `setup.py` is now discouraged. The choice to migrate to `hatch` was made for the following reasons: - It offers a very simple management of the venv. No more need to `python -m venv .venv` and `pip install`, `hatch` handles all of that automatically when creating the virtual environment. - `hatch` supercedes `tox`, allowing for multiple python versions to be tested in a single command. - `hatch` manages the build process, and offers a nicer way to hook in a custom build process to download the `pact` standalone binaries. A minor change to the packaging of the library now places the binaries in `pact/bin` instead of `pact/bin/pact/bin`. The `constants.py` file has been accordingly updated to reflect this change in case anyone was making direct use of the binaries. While this change is rather significant, it should not affect the end user experience. Users will still be able to `pip install pact-python` from PyPI. Other than for the aforementioned, there has been no changes to the library code. Resolves: #369 Refs: https://docs.python.org/3/whatsnew/3.10.html#distutils-deprecated Refs: https://setuptools.pypa.io/en/latest/userguide/quickstart.html#setuppy-discouraged Signed-off-by: JP-Ellis <[email protected]>
The previous build process relied on `distutils` which is due to be deprecated in 3.12. Furthermore, the use of `setup.py` is now discouraged. The choice to migrate to `hatch` was made for the following reasons: - It offers a very simple management of the venv. No more need to `python -m venv .venv` and `pip install`, `hatch` handles all of that automatically when creating the virtual environment. - `hatch` supercedes `tox`, allowing for multiple python versions to be tested in a single command. - `hatch` manages the build process, and offers a nicer way to hook in a custom build process to download the `pact` standalone binaries. A minor change to the packaging of the library now places the binaries in `pact/bin` instead of `pact/bin/pact/bin`. The `constants.py` file has been accordingly updated to reflect this change in case anyone was making direct use of the binaries. While this change is rather significant, it should not affect the end user experience. Users will still be able to `pip install pact-python` from PyPI. Other than for the aforementioned, there has been no changes to the library code. Resolves: #369 Refs: https://docs.python.org/3/whatsnew/3.10.html#distutils-deprecated Refs: https://setuptools.pypa.io/en/latest/userguide/quickstart.html#setuppy-discouraged Signed-off-by: JP-Ellis <[email protected]>
The previous build process relied on `distutils` which is due to be deprecated in 3.12. Furthermore, the use of `setup.py` is now discouraged. The choice to migrate to `hatch` was made for the following reasons: - It offers a very simple management of the venv. No more need to `python -m venv .venv` and `pip install`, `hatch` handles all of that automatically when creating the virtual environment. - `hatch` supercedes `tox`, allowing for multiple python versions to be tested in a single command. - `hatch` manages the build process, and offers a nicer way to hook in a custom build process to download the `pact` standalone binaries. A minor change to the packaging of the library now places the binaries in `pact/bin` instead of `pact/bin/pact/bin`. The `constants.py` file has been accordingly updated to reflect this change in case anyone was making direct use of the binaries. While this change is rather significant, it should not affect the end user experience. Users will still be able to `pip install pact-python` from PyPI. Other than for the aforementioned, there has been no changes to the library code. Resolves: #369 Refs: https://docs.python.org/3/whatsnew/3.10.html#distutils-deprecated Refs: https://setuptools.pypa.io/en/latest/userguide/quickstart.html#setuppy-discouraged Signed-off-by: JP-Ellis <[email protected]>
The previous build process relied on `distutils` which is due to be deprecated in 3.12. Furthermore, the use of `setup.py` is now discouraged. The choice to migrate to `hatch` was made for the following reasons: - It offers a very simple management of the venv. No more need to `python -m venv .venv` and `pip install`, `hatch` handles all of that automatically when creating the virtual environment. - `hatch` supercedes `tox`, allowing for multiple python versions to be tested in a single command. - `hatch` manages the build process, and offers a nicer way to hook in a custom build process to download the `pact` standalone binaries. A minor change to the packaging of the library now places the binaries in `pact/bin` instead of `pact/bin/pact/bin`. The `constants.py` file has been accordingly updated to reflect this change in case anyone was making direct use of the binaries. While this change is rather significant, it should not affect the end user experience. Users will still be able to `pip install pact-python` from PyPI. Other than for the aforementioned, there has been no changes to the library code. Resolves: #369 Refs: https://docs.python.org/3/whatsnew/3.10.html#distutils-deprecated Refs: https://setuptools.pypa.io/en/latest/userguide/quickstart.html#setuppy-discouraged Signed-off-by: JP-Ellis <[email protected]>
The previous build process relied on `distutils` which is due to be deprecated in 3.12. Furthermore, the use of `setup.py` is now discouraged. The choice to migrate to `hatch` was made for the following reasons: - It offers a very simple management of the venv. No more need to `python -m venv .venv` and `pip install`, `hatch` handles all of that automatically when creating the virtual environment. - `hatch` supercedes `tox`, allowing for multiple python versions to be tested in a single command. - `hatch` manages the build process, and offers a nicer way to hook in a custom build process to download the `pact` standalone binaries. A minor change to the packaging of the library now places the binaries in `pact/bin` instead of `pact/bin/pact/bin`. The `constants.py` file has been accordingly updated to reflect this change in case anyone was making direct use of the binaries. While this change is rather significant, it should not affect the end user experience. Users will still be able to `pip install pact-python` from PyPI. Other than for the aforementioned, there has been no changes to the library code. Resolves: #369 Refs: https://docs.python.org/3/whatsnew/3.10.html#distutils-deprecated Refs: https://setuptools.pypa.io/en/latest/userguide/quickstart.html#setuppy-discouraged Signed-off-by: JP-Ellis <[email protected]>
The previous build process relied on `distutils` which is due to be deprecated in 3.12. Furthermore, the use of `setup.py` is now discouraged. The choice to migrate to `hatch` was made for the following reasons: - It offers a very simple management of the venv. No more need to `python -m venv .venv` and `pip install`, `hatch` handles all of that automatically when creating the virtual environment. - `hatch` supercedes `tox`, allowing for multiple python versions to be tested in a single command. - `hatch` manages the build process, and offers a nicer way to hook in a custom build process to download the `pact` standalone binaries. A minor change to the packaging of the library now places the binaries in `pact/bin` instead of `pact/bin/pact/bin`. The `constants.py` file has been accordingly updated to reflect this change in case anyone was making direct use of the binaries. While this change is rather significant, it should not affect the end user experience. Users will still be able to `pip install pact-python` from PyPI. Other than for the aforementioned, there has been no changes to the library code. Resolves: #369 Refs: https://docs.python.org/3/whatsnew/3.10.html#distutils-deprecated Refs: https://setuptools.pypa.io/en/latest/userguide/quickstart.html#setuppy-discouraged Signed-off-by: JP-Ellis <[email protected]>
The previous build process relied on `distutils` which is due to be deprecated in 3.12. Furthermore, the use of `setup.py` is now discouraged. The choice to migrate to `hatch` was made for the following reasons: - It offers a very simple management of the venv. No more need to `python -m venv .venv` and `pip install`, `hatch` handles all of that automatically when creating the virtual environment. - `hatch` supercedes `tox`, allowing for multiple python versions to be tested in a single command. - `hatch` manages the build process, and offers a nicer way to hook in a custom build process to download the `pact` standalone binaries. A minor change to the packaging of the library now places the binaries in `pact/bin` instead of `pact/bin/pact/bin`. The `constants.py` file has been accordingly updated to reflect this change in case anyone was making direct use of the binaries. While this change is rather significant, it should not affect the end user experience. Users will still be able to `pip install pact-python` from PyPI. Other than for the aforementioned, there has been no changes to the library code. Official support to Python 3.6 and 3.7 is dropped as part of this change as security fixes for these versions are no longer provided (ended 21 months ago for 3.6, and 3 months ago for 3.7). Furthermore, a number of dependencies have dropped support for these versions, and pinning historical versions of these dependencies is introducing known security vulnerabilities. BREAKING CHANGE: Drop support for Python 3.6 and 3.7 Resolves: #369 Refs: https://docs.python.org/3/whatsnew/3.10.html#distutils-deprecated Refs: https://setuptools.pypa.io/en/latest/userguide/quickstart.html#setuppy-discouraged Signed-off-by: JP-Ellis <[email protected]>
The previous build process relied on `distutils` which is due to be deprecated in 3.12. Furthermore, the use of `setup.py` is now discouraged. The choice to migrate to `hatch` was made for the following reasons: - It offers a very simple management of the venv. No more need to `python -m venv .venv` and `pip install`, `hatch` handles all of that automatically when creating the virtual environment. - `hatch` supercedes `tox`, allowing for multiple python versions to be tested in a single command. - `hatch` manages the build process, and offers a nicer way to hook in a custom build process to download the `pact` standalone binaries. A minor change to the packaging of the library now places the binaries in `pact/bin` instead of `pact/bin/pact/bin`. The `constants.py` file has been accordingly updated to reflect this change in case anyone was making direct use of the binaries. While this change is rather significant, it should not affect the end user experience. Users will still be able to `pip install pact-python` from PyPI. Other than for the aforementioned, there has been no changes to the library code. Official support to Python 3.6 and 3.7 is dropped as part of this change as security fixes for these versions are no longer provided (ended 21 months ago for 3.6, and 3 months ago for 3.7). Furthermore, a number of dependencies have dropped support for these versions, and pinning historical versions of these dependencies is introducing known security vulnerabilities. BREAKING CHANGE: Drop support for Python 3.6 and 3.7 Resolves: #369 Refs: https://docs.python.org/3/whatsnew/3.10.html#distutils-deprecated Refs: https://setuptools.pypa.io/en/latest/userguide/quickstart.html#setuppy-discouraged Signed-off-by: JP-Ellis <[email protected]>
Following PEP 518 and PEP 621, we should migrate the older
setup.cfg
andsetup.py
build system to one making use ofpyproject.toml
. Furthermore, the use ofsetup.py
is strongly discouraged and many aspects will be discontinued:The existing
setup.py
build script also makes use ofdistutils
which has been deprecated since 3.10 and is scheduled to removal in 3.12.As part of this change, we also have an opportunity to change the underlying build system that handles the packaging of the Python package into a distributable bundle. The main ones to consider are:
An excellent write up by Jay Qi is available in their blog post The Basic of Python Packaging in Early 2023.
As
pact-python
will eventually make use of the Pact Rust core, any build system considered must be able to support so-called 'extensions' (which are typically used to build C extensions).Deep Dive
Setuptools
This by far the most popular build system and is the current build system being used. Extensions are supported through
setup.py
.Note that even if we keep this, closing this issue will require an extensive rework of
setup.py
due to the aforementioned deprecations.A good example I have come across for this implementation would be following playwright-python's
setup.py
.Poetry
Poetry is a very popular Python tool that predates PEP 621. Unfortunately, it does not yet support PEP 621 (though it is on the roadmap) and instead uses its own custom metadata section in
pyproject.toml
.More concerning is the unstable support of extensions (python-poetry/poetry#2740) which effectively rules out Poetry as the build tool.
Poetry may still be useful to manage dependencies, as it does an excellent job of ensuring all dependencies installed within the virtual environment are mutually compatible. Furthermore, it integrates with dependabot. This of course depends on whether the build tool can work with Poetry for dependency management.
Maturin
Maturin is a project by the PyO3 team which maintains an ecosystem of tools that provide Rust binding for Python.
This may be an excellent option given that
pact-python
will eventually need to integrate with the Rust core and may be easier to use than Setuptools.There is a concern that integrating too much with Rust might dissuade contributions from Python developers, and we must also check whether we can still rely on Ruby while migrating to the Rust core.
Hatch
Hatch is build tool and front-end. It appears to have extensive support for customisations through build hooks. These hooks are likely able to support both the Ruby and Rust implementations simultaneously, but this would need to be investigated properly.
Flit
Flit is a lightweight build manager, but unfortunately does not support build extensions and therefore is not appropriate here.
PDM
PDM describes itself as a "modern Python package and dependency manager supporting the latest PEP standards". It was created as an implementation of PEP 582 which provides an venv-less way of managing dependencies in a similar way to npm. While PEP 582 was rejected, PDM still support this.
PDM appears to have excellent build and publishing capabilities, and the PDM backend allows for customisations through hooks
pdm_build.py
.The text was updated successfully, but these errors were encountered: