-
Notifications
You must be signed in to change notification settings - Fork 34
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
Writing a setup.py is Hard #1
Comments
Unless the distutils docs drastically improved since I last read them, the missing piece is a focused and correct distutils (or maybe setuptools?) tutorial. How do I ship properly a dead-simple, Python-only, no-dependencies piece of code? This should fit in one or two screenfuls of docs, and is distinct from the reference docs. |
I want to basically dump the "Packaging Guides" attempt at yet another setuptools tutorial. As for distutils, any of it's docs need to be boldly red flagged with "Don't Start Here". Distutils docs need to exist primarily for the api at this point. |
"Don't start here" is a large part of the PEP 453 plan for the core docs: http://www.python.org/dev/peps/pep-0453/#documentation Essentially, the distutils docs become a "for packaging tool developers only" reference, while the real cross-version packaging guide becomes independent of CPython. We may also want to point people in the direction of Audrey Roy's cookiecutter project - it's a nice way to jumpstart a lot of boilerplate packaging and collaboration information. |
CPython issue for the PEP 453 "Installing Python Modules" docs update: http://bugs.python.org/issue19407 |
The distributing Python modules docs aren't in scope for PEP 453, but with the precedent set for the installing side, it's easy to make the case for delegating the build side to external version independent docs as well. |
I've gotten more response about how writing a setup.py is hard with some specific criticism, which included the cargo cult nature of setup.py |
Someone else called out how brittle things are, even a well written setup.py can easily break, sometimes silently, if you rearrange things at all. |
It's still unclear to me how we went from "never use setuptools, it's too weird, it monkey-patches things to spread itself as soon as it's installed on your system, etc." to "use setuptools". Technically, that must have happened around the setuptools + distribute merge, but isn't setuptools still essentially the same as when its use was discouraged? From the confused-packager-department... I'm still carefully using |
there was propaganda about using distribute over setuptools, because distribute was more open and supported py3, but both still had the monkey patching and were/are "weird.". Just using distutils is a non-starter for many projects, because it doesn't offer "install_requires". |
The big shift for people I think is going from "just wait, the distutils2 revolution is coming in the stdlib", to "distutils2 is not coming, and there is no plan atm to release a replacement into the stdlib, it's ok/safe to use setuptools for packaging/building right now; we're working on it" |
It's the first time I hear about "distutils2". Even though I play the devil's advocate in this thread, I'm not totally clueless about packaging. |
the distutils2 effort (or "packaging", the name it was going to be called in the stdlib) went on for years from roughly 2009 to 2012. here's a link to a graphic about it in the "Hitchhiker's Guide to Packaging" (which the new "Python Packaging User guide" replaces.) http://guide.python-distribute.org/introduction.html#current-state-of-packaging |
The main change was that we (wearing my CPython core developer hat) figured setuptools still has a lot of rough edges, but we need it (or an |
You're right, writing a Nodejs has a wonderful wizard
Also Npm's The Npm documentation is fantastic too: |
There's https://pypi.python.org/pypi/d2to1 that would make this declarative (similar to |
FWIW On Thu, Jul 17, 2014 at 6:50 PM, Ionel Cristian Mărieș <
"I disapprove of what you say, but I will defend to the death your right to |
On the other hand pbr is wrong and uses a requirements.txt as the source of |
Last time I checked |
True.
This. I don't think pbr has solved anything. They have a few convenience wrappers but most of it comes from just chucking whatever you were doing in |
Note that one reason not a lot has changed on the build side is because there hasn't been anyone seriously working on fundamental changes to it of late - the install side is hard enough, and until we know what metadata the installation and redistribution tools need, we don't really know what to change on the build side. Something that's key to eventually eliminating setup.py, though, is relatively complete documentation for the current distutils+setuptools command set. Failing to cover the full scope of what it was nominally replacing is one of the key reasons the distutils2 project struggled to gain acceptance and was eventually dropped. pip had a narrower scope, in just trying to take out the use of easy_install as an installer, rather than setuptools as a build system, and has been far more successful. PEP 440 (the new versioning standard) will hopefully be ready for acceptance in the pip 1.6 time frame, and then we can start looking more closely at PEP 426 and 459 for pip 1.7. The acceptance of those should then further decouple the install side of things from the build side, so it will become easier for folks to experiment with new build tools. |
I'd like an
Though this might not be doable until |
I, too, would like something like |
Well pip is the installer, not the build tool. But I think that flit as an init command! |
@phildini The challenge there is that any package init tool is necessarily going to be pretty strongly opinionated, and people have a lot of conflicting opinions, plus the best practices are in a state of flux... but The most popular solution right now seems to be cookiecutter, and the nice thing about it is that it doesn't have to be one-size-fits-all. So one thing that might make sense as a short-term improvement would be to advertise cookiecutter at https://packaging.python.org/tutorials/distributing-packages/ |
While I like the idea of cookiecutter, I've found it personally intimidating whenever I've tried to use it, as the popular templates tend to push you strongly in the direction of doing things right (separate documentation that actively encourages contributions, testing across multiple Python versions with tox, etc). That's a really good thing for professional use, but for personal use it pushed me into "Ugh, this is too much work adding things that I don't personally need, so I'm just going to skip publishing anything to PyPI, and keep this project solely for my own use direct from source control".
Still, a combined recommendation of |
Fascinating! I had no idea Right now, we officially recommend at least I agree that cookiecutter can be intimidating, and I'm honestly not a fan of "download this thing from |
fwiw flit is effectively a replacement for setuptools in the toolchain, not an additional thing. |
@ncoghlan I suppose one could make a "just the basics" cookiecutter and publicize it here. Not sure who would be volunteering to do this though. |
I agree with @ncoghlan, cookiecutter is quite intimidating in its basic form. However, it would be possible to recommend cookiecutter plus a specific project template that we recommend as a basic form to use. The difficulty is (as always) that there is no consensus on what form a recommended template should take. (Hmm, I note that @njsmith just said much the same thing :-)) |
Right, the idea with
|
Today most users tend to just cargo cult a setup.py around, never understanding most of the directives that actually go into one.
Solutions:
Some of this already is starting to exist with the packaging guide's page on creating a package (See here), but that is incomplete.
The text was updated successfully, but these errors were encountered: