-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Another toml section for testing #2303
Comments
This has been raised multiple times, but I cannot find the old issue atm so I’m leaving this open for now. The essential question anyone proposing this feature should answer is why. Due to the locking nature of the Pipfile-lockfile combo, every section added would induce considerable increase of difficulty in implementation because Pipenv would need to consider the interaction between sections. It is therefore not enough to propose this based simply on aesthetics; you need to propose a real, practical, insurmountable need for this feature to convince the developers to consider it. (Or, alternatively, you can implement it yourself, promise to shepherd the feature and fix problems it introduces.) |
Thanks for the reply. I was first asking if this feature is there or there is another alternative, then ofcourse I'll answer the question why?
production.txt
test.txt
dev.txt
moving to
I agree with you it would add a difficulty overhead if it is implemented this way. However, I see that
I do not think it will add more complexity to Pipfile.lock. I'd love to contribute and do it myself, but I'd like to initiate a discussion like this before starting. Thank you |
Thanks for the clarification. I assume you meant
would this be correct? (Option names are up for discussion. The point is that you need The question this brews would then be—Should it be possible to allow users to install all three sections? If no—what answer should we provide when users (inevitably!) come requesting this feature? And if yes… How are we going to separate packages in the lockfile so it can cover all possible use cases:
Should this be generalised to include arbitrary numbers of sections? I can easily imagine people come asking for [doc-packages], [staging-packages] and so on. Warehouse, the project for the currently active pypi.org site, has eight requirements.txt variants. Syntactic-wise, this could be better: [packages]
# ...
[dev-packages]
# ...
[extra-packages.test] # This "extra-packages" prefix signifies a custom section.
# ...
[extra-packages.doc]
# ...
The syntax installing an extra section would be But then we’ll go back to the previous section combination question, but instead of 4 you now have a lot more combinations to consider. I need to clarify that I am totally on board for this feature. All that’s stopping me from doing it myself is that I have yet to come up with a satisfying design that is general enough without immensely complicating the implementation. |
Kenneth has been pretty firm about only having dev and non-dev as sections, modeled after composer. If you want to complicate pipfiles it is going to take a lot of work on that front. Consider the cost of a new user trying to understand what you are accomplishing, how we would explain this to them, and what it gains for you. Pointing at tools that bootstrap the packaging ecosystem itself will always be more complex examples |
@uranusjr Yes this is what I meant. I found a closed issue regarding this discussion @techalchemy I'm quoting Kenneth words in the discussion I found. So I think It is not that firm
My point is that since |
Right, I’ve worked pretty closely with him on this so I’m aware of his position. It’s important to continue to accept and receive feedback, but to be clear we don’t have to add more sections until there is a compelling design reason or until it is clear that we can no longer support standard workflows. We are open to that, but personally I’m much more interested in simplicity than attempting to capture every edge case. In this case what I mean by simplicity is simplicity of the interface. Simplicity of things that are built with the tooling to say, ‘here you go person who is new to python, you can incorporate my pipfile into your workflow the same as you were using your own without stumbling over custom section names’. Until there is a compelling case for changing this I don’t see a reason to Regarding the for humans tag line: it’s a design philosophy. Quoting it won’t convince anyone that your feature request is good. It comes across as a tactic used in attempt to make us feel bad for not doing what you want. Whether intentional or not, this is not an effective method for influencing design decisions. Just because you like something doesn’t mean we have to support it to make a good tool. We can discuss it, but you have to understand that our user base is large and the decisions we make impact thousands of people. |
I'm sorry if I've been understood incorrectly. I did not meant it to be that way and I do understand that the impact of the decisions reflects thousands of people. Furthermore, I'm 100% agree with you of all the mentioned point. Again, please accept my apologize for not being clear or being understood incorrectly. |
No worries, I just want to keep the discussion focused on whether this decision is a good idea for most people or added coimplexity for most people. I feel it's the second one, but I am willing to be convinced also. |
Thanks again. I do understand your point. For me, I believe there is a middle ground that we can provide this feature without adding much complexity. There may be some complexities that I'm not aware of yet. But I think it is a middle ground. What do you think? Thanks |
One of the problems is that a single "test" section doesn't actually cover all bases. In the Django community that's used a lot to specify testing across multiple versions of Django, each locked with different versions of several dependencies. There's a I think whatever the final solution is should either rely on a single package group per Pipfile, or an arbitrary amount of package groups per Pipfile. And to be clear, these aren't edge cases. They're established patterns. Tox implements them and is popular because of that. In fact, in some cases, tox is used for non-test purposes just because of its ability to create the appropriate environment to run a helper script in (without full blown using Docker for it). This should really be pipenv's job. Regarding added complexity: Well, where is the added complexity for most users, exactly? I'm sure there's added complexity in the pipenv codebase, but what exactly would change for current users (other than having additional flags they can use should they want to create more package groups)? |
The right direction is to get tox aware of the Pipfile, TMHO. |
@gsemet How would you reproduce this in a single dev section then? |
TOX is meant to describe precisely different environment. To have both world, why not imagine a kind of inheritance where Pipfile describe the base for developer and specific packages can be frozen by tox.ini. |
@gsemet If pipenv is meant to describe 1 environment then we're kinda back to the original point: Why make the difference between dev and "main"? I'm all for a --dev flag which automatically looks at a different environment (however that env may be defined: Different pipfile, w/e). But I think any solution that applies to the dev env should be usable for arbitrary environments. Maybe dev is a special case because it gets a shortcut flag. WDYT? |
main = what I need for my app to run in production dev = all other tools. For yapft, pylint, flake8, sphinx, pytest, etc, use dev-packages. Works great. I do not need to have pylint, autopep8, pytest in production. pipenv is meant to handle these 2 environments pretty well. All other combinatories are out of the scope of pipenv and frankly, most of the time can be merged into the "other"/dev-packages. I would be happy to have a tox with pipfile support, to enable use case such as:
But the main dependencies description would be in Do not forget pipenv is primarily meant for application, so on the environment as close as possible than the production. |
@gsemet I understand the distinction between the dev and prod environments. But what I'm saying is that there may be multiple dev environments. Hell, there may be multiple prod environments! Pipfile takes a stand that it has suport for both one prod and one dev env per Pipfile. This distinction ignores the (common) cases where there are more environments needed, such as the one described in this very issue. Adding support for a third environment (eg. a "test" env) doesn't fix the underlying issue of arbitrary environments not being supported. Tox solves this really well. I'm all for continuing to use tox, but tox should be able to delegate environment management to pipenv. More generally, python developers shouldn't have to think about multiple ways of declaring their environments ("Okay, I'll put the prod stuff in Pipfile, the test stuff in tox.ini, ..."). |
i agree, in a sense that I, like others, follow an opinionated solution. i use pbr and i am pretty happy with my libs+app development pattern with pipfile, but some does not like it. But you (as any developer) needs to understand the difference between application and libraries, what pipenv is and is not, what tox is and is not etc. Their is no "standard" way of doing things here. |
That's the problem, isn't it? pipenv is trying to simplify packaging in the Python world and is trying to be a standard. But leaving major use cases behind is kinda what got us to what the state of python packaging is today. |
I'd like to see this as well. In the meantime, I'd appreciate any suggestions for working with |
@dresnick-sf Multiple pipfiles maybe? |
@jleclanche Can you see a workflow that doesn't include copying and pasting packages from the main |
I do not, and I'd like it solved as well. But there are cases where you do want versions to diverge. |
I'm very sorry after I saw there was no support for extra environment 😞 |
Here is what your "main" is in a Django project deployed with uWSGI:
Note that there are more dependencies for running tests, but they can be covered by a Why do we need "base"?Because uWSGI needs So, with Django you end up with at least 3 environments. Even when you're smart and move all test dependencies to Can this be resolved?With Docker builds you can in theory work around this situation: Simply install the "production only" requirements in addition to "base". The former is then hard-coded in the Dockerfile. However, this has a price: You lose all the locking mechanisms (i.e. you must manage pinning and upgrading manually). Not nice. Does anyone see an actual solution? I'd be interested. |
I agree this use case is at the limit. I got recently a similar case, on Windows I needed some packages that failed installing on linux. So yes, having additional, custom environments in Pipfile would be great. That should not be the "norm", but just available as an option. |
I also agree with the use case. I need to install few packages in the staging server only while few in the testing and next few in the local development. |
Since there has not been any updates on this. Request the team to look into allowing the option of custom environments for pipenv through Pipfile, since that seems possible in the framework as also suggested by @gsemet . Any updates on the idea? |
Closing this in favor of eventually adding categories support (we really need to do more code cleanup before we get to this though): #4745 |
I'd like to know if there is away to have
[test-packages]
in PipfileIt would be good if I have something like
The text was updated successfully, but these errors were encountered: