-
Notifications
You must be signed in to change notification settings - Fork 3k
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
pip install extras requires and install requires, but not the package #4783
Comments
For development, use |
But what if you don't want to install the package itself? 🤔 |
I'm not sure this is a good use of extras, to be honest. Projects I've worked on typically specify development requirements in a requirements file, not as an extra. However, I find it hard to argue that @jaraco - the author of |
The reason I don't like the |
But if you put your development dependencies in Anyway, the point of the issue isn't to debate whether your approach is right or wrong - how you structure your project is your choice. The question here is whether wanting to install just the extras and not the actual project is something pip should support directly. From my reading of the setuptools documentation on extras, it doesn't sound like it's an intended use case for extras, and even if it were, it's a pretty unusual situation. So I'm probably -0 on the idea (I'm not actively against it, but I don't see the value being sufficient to justify the extra complexity in pip). |
your run-time dependencies are a subset of your development dependencies; there's the duplication 👍 Lately I've seen many-many projects using this way extras, hence my idea, should this be maybe be supported by pip. Another reason for extras is that binds well with having multiple tools for various tools (e.g. testing, documentation, linter) and each of them having their own separate venv with tox. But I think it's mainly having your dependencies in a single place. |
I think this is where you are confused. The package should be installed in editable mode for development (probably in a virtual environment) so that you can run the console and GUI scripts. And by |
For a while, I thought that requirements.txt files was the best place to declare dependencies for various purposes (tests, docs, development, etc). I was recommending storing test requirements in tests/requirements.txt and docs requirements in docs/requirements.txt. Lately, I've been moving away from declaring various sets of dependencies in requirements files for a few reasons:
Although the documentation doesn't explicitly mention these use cases, I think that's because extras were designed to be very general-purpose - to allow a package to declare sets of optional dependencies by name. It's their generality and simple elegance that's enabled them to be readily used by tools like tox and rtd. But based on the experiences above, both before and after, I'm very much pleased with the use of extras for declaring tests and docs dependencies. So yes, I do endorse the idea. But addressing more specifically the idea that pip should have support for At the moment, I can't recall the use-cases that led me to want to install the deps only, but I can think of one right now: You want to get a shell for a package you have checked out, but you don't want to create a virtualenv nor install the dependencies into your current env, you could use rwt, except rwt uses Such a feature may also be helpful in troubleshooting--in being able to bisect an issue, first ensuring that dependencies install correctly, then separately testing that the package itself installs. I'm sure that would have been useful when troubleshooting race conditions. Unless there's something about this feature that would unduly complicate pip, I'm enthusastically +1. |
@pfmoore I'm still excited about this happening, what's your view on this nowadays? |
I remain unclear on the value of this (disclaimer: I basically never use extras myself) but that's all. Nothing's going to happen without a PR, and if one is submitted, I'll probably just leave it to the other pip developers (who may well have stronger opinions than I do) to review/debate it. Nothing's blocked on me, that I know of. |
@pfmoore how do you keep separate requirements for various tasks - e.g. tests, documentation, pylint, mypy, etc? or do you just put all in a global |
Multiple requirements files (see pip itself) or simply have projects small enough that I can handle it all manually :-) (My day to day use of Python is adhoc data analysis, automation scripts and personal tools, not so much large project development - I'm likely not a good example of someone who'd find this feature useful, is all). |
In that case, all I can say is that the value added with this would be having one file (the setup.py which already requires to define install dependencies) to list all dependencies (either install, testing, documentation generation, etc). Shipping this one file via sdist is also solved automatically (as extras will be part of the package metadata). |
@lkollar is working on a POC PR for this. |
I think a very important use case hasn't been mentioned on this issue yet (and the main reason why I implemented it in #5950): it makes it possible to install the build and test dependencies and then independently install and build the I think in order to fully support the Any feedback on the PR would be appreciated. |
I no longer think this would be a good Idea so closing this for now. |
Another use case would have been writing a
|
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
For library development it's often the case that you specify your test, publish, documentation requirements in extras; to have all dependencies in one place. There are many cases of this in wild, e.g. here.. In this case would be nice for development if we could install only extras and install requires libraries, but not the library itself. Would that be possible? E.g. with:
Thanks,
The text was updated successfully, but these errors were encountered: