Skip to content
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

Support version ranges #16

Merged
merged 3 commits into from
Jun 18, 2019
Merged

Support version ranges #16

merged 3 commits into from
Jun 18, 2019

Conversation

pglass
Copy link
Owner

@pglass pglass commented Jun 13, 2019

  • Update the README with the new feature
  • Rewrite check-pip-version.sh in python, to support checking a version
    (19.0) is contained within a version set ('!=19.1,>18.0'). This has a
    dependency on packaging which must be installed in each tox env,
    unfortunately (note: test requirement only, no changes to the setup.py)
  • Add tests/test-version-specifiers/ to test the new version ranges

Fixes #12
Fixes #15

- Update the README with the new feature
- Rewrite check-pip-version.sh in python, to support checking a version
(19.0) is contained within a version set ('!=19.1,>18.0'). This has a
dependency on `packaging` which must be installed in each tox env,
unfortunately.
- Add `tests/test-version-specifiers/` to test the new version ranges
@pglass pglass mentioned this pull request Jun 13, 2019
@jayvdb
Copy link

jayvdb commented Jun 14, 2019

Your PR intro comment sounds scary -- the dependency on packaging looks like it is only needed for the local tests here... -- or does it need to be installed into venvs in production usage of the plugin?

A dependency on packaging should only be in the outer environment. To do that, the parsing needs to be in an earlier phase -- tox_configure is a good hook for this -- all of the raw venv configs are available in tox_configure. Then inside the venv the plugin would trust that the value has already been validated.

@pglass
Copy link
Owner Author

pglass commented Jun 14, 2019

@jayvdb The dependency on packaging is only for the tests. No changes to the requirements in setup.py.

@jayvdb
Copy link

jayvdb commented Jun 14, 2019

Great. "unfortunately" in the commit message is what triggered me. If it is only a test dependency, it isnt unfortunate ;-)

README.md Outdated
version.
- A version with specifiers, like `pip_version = >=19.0`, which installs any
version matching the specifier set.
- A version with specifiers prefixed with "pip", like
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why allow a prefix of pip ?

Why should it be prefixed with only pip? Why not setuptools, etc :P

Does allowing pip prefix help with anything?

If not, I think you should prevent it in order to avoid misuse, even if it means more work to block that. Extra syntax which achieves nothing invites problems, and forward compatibility problems, in the future.

It does actually make sense to allow setuptools and wheel and anything else that could be needed before the testenv:deps are installed. But that should be a separate enhancement with a bit of design put into it, and potentially the plugin needs a rename then ;-) This plugin is doing a venv prep phase.

Copy link
Owner Author

@pglass pglass Jun 14, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, agreed. Appreciate the good feedback!

@jayvdb I'm actually leaning in the opposite direction, I think. I prefer using the pip-ful (including the prefix) syntax, mainly because I think it's slightly more consistent:

pip command pip-less pip-ful
pip install -U pip>19.0 pip_version = >19.0 pip_version = pip>19.0
pip install -U pip<19,>18 pip_version = <19,>18 pip_version = pip<19,>18
pip install -U pip pip_version = ''
pip_version = latest
???
pip_version = pip

That last line in the table is where there was no exact equivalent to a pip install -U pip and I didn't really like either empty string or latest to support that (open to suggestions though). It's true that a user can always write >19.0 to get latest, so not a huge practical concern.

In the future, I might expand this to pip_version = <flags> <packages> and pass those arguments straight to pip install <flags> <packages> to support other pip flags/options. So this is one step in that direction (and definitely hear you on the package rename, and moving toward treating this as a generic "venv prep" plugin, which makes sense to me).

Anyway, I agree that either the "pip-less" or "pip-ful" syntax should be removed. I don't feel that strongly one or another, but am leaning toward removing the "pip-less" syntax.

Copy link
Owner Author

@pglass pglass Jun 14, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One other point I missed:

Whichever syntax is settled on in this PR, I did want to keep the pip_version = 19.0 syntax (without any specifiers), for backwards-compatibility for now

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 to removing pip-less

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pip_version = >=19.0 is much more useful and expressive than pip_version = pip, or even pip_version = latest.

The former creates a log entry in the codebase history of what version was actually required at that time, without needing to see the build logs to know what version was being installed. People will likely only bump it occasionally, because the -U means they wont notice if the version specified isnt good enough for the usage of pip within the testenv, but it will encourage them to think about it occasionally.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure this is an argument one way or another? You will still be able to write pip_version = pip>=19.0.

In any case, updated to remove the "pip-less" syntax.

@pglass pglass merged commit 88549ad into master Jun 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow upgrading to latest support for ranges
3 participants