pip build command
See original GitHub issuePhase 2 from #5407
Allow pip to build packages for distribution - pip build
Some notes in https://github.com/pypa/pip/issues/5407#issuecomment-389621303
pip now has PEP 517 support and uses build isolation by default on packages with pyproject.toml files – which means the way pip builds is difficult to reproduce externally in a trivial manner.
The pip build
command would use the same code paths as PEP 517 with the sole difference being that it does not install the packages. It’s essentially the pip wheel
in a PEP 517 world.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:12
- Comments:20 (17 by maintainers)
Top Results From Across the Web
pip documentation v22.3.1
This option specifies default behavior when path already exists. Possible cases: downloading files or checking out repositories for installation, creating ...
Read more >Packaging Python Projects
pyproject.toml tells “frontend” build tools like pip and build what “backend” tool to use to create distribution packages for your project.
Read more >Using Python's pip to Manage Your Projects' Dependencies
The pip list command renders a table that shows all installed packages in your current environment. The output above shows the version of...
Read more >14 Must-Know pip Commands For Data Scientists and ...
Usage:pip <command> [options]Commands: install Install packages. download Download packages. uninstall Uninstall packages. freeze Output ...
Read more >pip 10.0.0.dev0 documentation
Pip builds packages by invoking the build system. Presently, the only supported build system is setuptools , but future developments to the Python...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I think we should still do this, using pypa/build or our existing code. We already host the logic for this, and I still feel that exposing this to users more directly would be a genuine usability improvement for them.
All frontends that are attempting to encapsulate the user workflow are providing a build command on their CLI as well, for usability reasons.
I would like to suggest that this is probably a bad idea at least if the motivation is to create a recommended build tool to replace
setup.py sdist bdist_wheel
. I think instead we should have a simple dedicated tool for this purpose rather than apip
subcommand.One reason for this is that
build
doesn’t obviously fit in eitherpip
ortwine
- the only reason it makes sense forpip
to have abuild
command is thatpip
already needs the ability to build packages in order to install them from source, butpip
is generally a tool for consumers of packages, not for producers of packages.twine
is usually for producers of packages but it has historically only acted upon already existing distributions and so while conceptually it makes sense fortwine
to be able to do the builds, it would in some sense change the nature of the tool from a tool that uploads things to PyPI into one that builds packages and uploads them to PyPI. To me, the fact thatbuild
has a reasonable claim to live in either package makes me think thatbuild
is its own thing and should be given its own package.I’ll note that while it seems like
pip
“already needs the capability to do builds”, it in fact currently doesn’t need the ability to build source distributions, since it is perfectly capable of building wheels directly from the source.tox
both needs and has the ability to build source distributions, but I would not really suggest adding atox build
command to expose this functionality.Another reason to avoid adding this to
pip
is thatpip
already has some unifying themes to its subcommands, including huge reams of command line arguments, some shared and some not. For example, thepip wheel
command already exists and is quite valuable for marshalling all the build artifacts one needs to install a given package because it gets you a wheel for the thing you want to install and all its dependencies; this is, however, a terrible and counter-intuitive behavior for a tool for building a wheel for upload - you need to do the magicalpip wheel --no-deps -w dist/ .
invocation to do what most people actually want to do. If we add apip build
command, we’ll suddenly either have to deprecate the existing and usefulpip wheel
command or we’ll confuse everyone by having two slightly different commands with very different purposes and semantics.The one time where I think it would make sense for
pip
to have apip build
command would be ifpip
wants to move to a situation where instead of source builds going source → wheel → install, they would go source → sdist → wheel → install (for a consistent flow that produces artifacts at each stage), that would make sense, but even then I wouldn’t want to recommend it as “the way to create distributable artifacts”, but rather as a tool for marshalling resources.