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

Build pip-tools using PyPA's build frontend tool #1642

Closed
otherJL0 opened this issue Jun 24, 2022 · 0 comments · Fixed by #1643
Closed

Build pip-tools using PyPA's build frontend tool #1642

otherJL0 opened this issue Jun 24, 2022 · 0 comments · Fixed by #1643
Labels
enhancement Improvements to functionality setuptools Related to compiling requirements form setup.py

Comments

@otherJL0
Copy link
Contributor

What's the problem this feature will solve?

Running the current build command:

python3 setup.py sdist --format=gztar bdist_wheel

produces the following warning:

/opt/homebrew/lib/python3.8/site-packages/setuptools/installer.py:27: 
SetuptoolsDeprecationWarning: setuptools.installer is deprecated. 
Requirements should be satisfied by a PEP 517 installer.

The setuptools_scm repo indicates that using setup.py is deprecated in favor of using pyproject.toml.
https://github.com/pypa/setuptools_scm#setuppy-usage-deprecated

Describe the solution you'd like

Since the project's setup.py file is only populated to target setuptools_scm, migrating
to an equally sparse pyproject.toml is a simple task:

# Current setup.py
from setuptools import setup

setup(use_scm_version=True)
# Equivalent pyproject.toml
[tool.setuptools_scm]

If the project migrates away from using setup.py, a (hopefully) painless alternative is to use
build, which is already part of pip-tool's dependencies'.
To use build, the proposed pyproject.toml needs to indicate the proposed build backend:

# Updated proposed pyproject.toml
[build-system]
requires = ["setuptools>=45", "setuptools_scm[toml]>=6.2", "wheel"]
build-backend = "setuptools.build_meta"

[tool.setuptools_scm]

With the proposed pyproject.toml file pip-tools can now be built using

python -m build # entry point
pyproject-build # equivalent console script

According to the official docs, using build is roughly equivalent to running the current build step:

setup.py sdist bdist_wheel

https://pypa-build.readthedocs.io/en/latest/differences.html#setup-py-sdist-bdist-wheel

Additional context

setuptools_scm repository
build repository
build docs

@otherJL0 otherJL0 mentioned this issue Jun 24, 2022
4 tasks
@atugushev atugushev added enhancement Improvements to functionality setuptools Related to compiling requirements form setup.py labels Aug 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improvements to functionality setuptools Related to compiling requirements form setup.py
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants