-
-
Notifications
You must be signed in to change notification settings - Fork 397
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
POC for controlled development environment and usage instructions. #165
Conversation
b3119e4
to
3ad0209
Compare
Instead of extras, you might want to utilize Dependency groups. Though, it's not available in stable release yet, it's seems like it does exactly what you're trying to achieve here. So maybe it's worth waiting for poetry 1.2.0 (it's now in beta) |
Thanks for input @Bobronium It seems they are aware that there is a lot of production users of 1.2 beta as it is: python-poetry/poetry#5586 (comment):
So jumping early is one option. Having said that though, if we abstract the workflow below some The core issue here is that we want
|
@Goldziher I needed to change the CI anyway to get the tests passing again. It runs all the same tests and checks, however, it uses tox as the test runner so it is consistent with using tox locally. It runs pytest, pre-commit and generates the coverage report and uploads to sonar. This configuration allows running coverage across multiple versions and then combines the reports at the end - this is good for e.g., where I couldn't reach the else branch of Otherwise everything else should be there, maybe just ordered slightly differently. Also, with all the python versions in your local environment you can just run I haven't got the virtualenv's cached like you have in the current version which probably slows it down a bit. I have to check how that works with There's still work to do on the PR but if you want to provide any feedback on the CI then I'm all ears. FYI the CI is heavily influenced by |
Thinking about this more, I'd wouch against turning Dev requirements are not (and IMO shouldn't be) considered during resolving dependencies when installing wheels. I feel like I'm communicating my point poorly, but I guess I don't have enough brain capacity to do it differently right now. |
I tend to agree |
From our own lockfile:
The pattern is hardly uncommon - because it solves a real problem. Have a look for yourselves. |
@Bobronium I'm merely trying to point out that the solution I've arrived at here is a functional consequence of trying to centralize our dev dependencies across two environments, poetry and tox. The grep above shows just how common this pattern is in the python ecosystem. I appreciate your passion for pep-8 and I note your ideological disapproval, but what about the real issues I'm trying to solve here? Any input on how you'd prefer a library config that supports those of us who want to test the library locally across different python versions?
I see this differently. I see extras as things that provide utility to your users. We have two classes of users, users that depend on
But we should be testing our library against an installed distribution, such as what tox does, no? I.e., by having tox install the distribution of our library, independent of poetry, we are closer to ensuring that the library will work for any downstream user that installs us through any method. That's where I'm at with this. I think ultimately it is better for us to have tox involved somewhere along the line. Poetry doesn't install extras from Again, please don't get offended by my wanting to discuss these things, I'd just like to get this sorted so that I can stop having to rebase and cherrypick my contributions. |
I mentioned another approach for this in #165 (comment).
These are good points that I tend to agree with. Being able to setup project environment with plain
I'm not sure where you comming from here, could you elaborate? In any case, word 'duplication' scares me. Dev tools are already have to be duplicated between I think that I'm just lost here: pep-8 is a code styleguide, the pep I mentioned was pep-0508 :) |
Sure. From what I can tell, libs tend to put their dev dependencies into a See:
This question was in my response:
I should have been more concise, but I'm trying to avoid having poetry in the tox envs - at least if I can help it.
Thanks I did misread that.
All of the above is about this really. In order to not duplicate lists of dev dependencies, I'm trying to use package extras as a way to declare them in a scope accessible to both tox and poetry.
Do I need poetry installed in the tox virtualenvs to install a dependency group? I.e., are they a packaging standard, or just a poetry thing?
Welcome to my world 😆 |
Sorry, I completely missed that.
To this and above: yes, I think this is the case. That's why I don't think that this is the best solutions anymore. I have another idea:We could use groups, and then just lock to requirements.txt via poetry (AFAIR, there's a command for this). But then what's the point really, if we already can achieve this with extars... |
Well I can't see the obvious usecase for the poetry groups specific to this issue, I admit I'll have to spend more time looking at the poetry feature to see how they intend them to be used. Not using extras, but if we were to draw the I appreciate your engagement on this. I'm the only python dev in my shop and so we have "our way" of doing things here (which is very similar to all the above) but I'm trying to be conscious of the way others do things too. |
Ok, here's what I have in mind: Extras pros:
Extras cons:
Deps groups pros:
Deps groups cons:
In short, |
4e8e610
to
63035e1
Compare
Auto-generating a |
90b2c37
to
0480510
Compare
@all-contributors please add @Goldziher for maintenance |
I've put up a pull request to add @Goldziher! 🎉 |
@all-contributors add @peterschutt maintenance code doc |
I've put up a pull request to add @peterschutt! 🎉 |
@all-contributors add @danesolberg code |
I've put up a pull request to add @danesolberg! 🎉 |
@all-contributors add @madlad33 code |
I've put up a pull request to add @madlad33! 🎉 |
@all-contributors add @slavugan code |
@slavugan already contributed before to code |
@all-contributors add @Butch78 code |
I've put up a pull request to add @Butch78! 🎉 |
@all-contributors add @to-ph code |
I've put up a pull request to add @to-ph! 🎉 |
0480510
to
9023ac4
Compare
Kudos, SonarCloud Quality Gate passed! |
To try to clear the path for contributors it would be good to have a specific workflow that we use. We could even use
tox
inside CI so that there would be virtually no difference between running the tests locally and in CI.Basic workflow is:
pyenv
for this inCONTRIBUTING.md
poetry install --extras "test lint dev" (I want to collapse this down to
poetry install --extras dev` but I'm having trouble with circular dependencies, which apparently should be supported: https://discuss.python.org/t/pyproject-toml-optional-dependencies-redundancy-aka-dry-extras/8428/5).poetry run tox
which will run tests across all python versions and linting.