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

New Option for Dynamic Versioning, e.g. wheel==0.23.*, wheel==0.* or wheel #237

Closed
wants to merge 2 commits into from

Conversation

mapattacker
Copy link
Contributor

@mapattacker mapattacker commented Mar 25, 2021

Added new option "dynamic", for dynamic versioning.

Example:
wheel==0.23.0

There will be 3 possible args for this option, micro, minor or all. The result in requirements.txt will be as below.

  • wheel==0.23.* (micro)
  • wheel==0.* (minor)
  • wheel (all)

This will enable more targeted installations, esp if one is only looking at bug fixes, security patches or minor/micro version updates, or simply just install most recent updates.

--no-pin option is merged within this new option as the "all" arg.

@Jcch94

* added new option for dynamic versioning

* added quotes for dynamic options

Co-authored-by: Siyang <teo_siyang@imda.gov.sg>
@mapattacker mapattacker changed the title New Option for Dynamic Versioning New Option for Dynamic Versioning, e.g. wheel==0.23.* Mar 25, 2021
@coveralls
Copy link

Coverage Status

Coverage increased (+1.6%) to 73.134% when pulling 4eae479 on mapattacker:master into 1aff63c on bndr:master.

4 similar comments
@coveralls
Copy link

Coverage Status

Coverage increased (+1.6%) to 73.134% when pulling 4eae479 on mapattacker:master into 1aff63c on bndr:master.

@coveralls
Copy link

Coverage Status

Coverage increased (+1.6%) to 73.134% when pulling 4eae479 on mapattacker:master into 1aff63c on bndr:master.

@coveralls
Copy link

Coverage Status

Coverage increased (+1.6%) to 73.134% when pulling 4eae479 on mapattacker:master into 1aff63c on bndr:master.

@coveralls
Copy link

Coverage Status

Coverage increased (+1.6%) to 73.134% when pulling 4eae479 on mapattacker:master into 1aff63c on bndr:master.

@mapattacker mapattacker changed the title New Option for Dynamic Versioning, e.g. wheel==0.23.* New Option for Dynamic Versioning, e.g. wheel==0.23.*, wheel==0.* or wheel Mar 26, 2021
@alan-barzilay
Copy link
Collaborator

Hi, thank you for the PR! This seems like a good opportunity to also add support to the compatible release version specifier as a scheme, what do you think?

@mapattacker
Copy link
Contributor Author

mapattacker commented Mar 26, 2021

Hi, thank you for the PR! This seems like a good opportunity to also add support to the compatible release version specifier as a scheme, what do you think?

@alan-barzilay Saw u commented at the other post, glad there's a new maintainer to help out in this important library. :)

Can I understand the reason to add the compatible release format? Since, the current format using asterisks in this PR kinda achieves the same purpose. If compatible release is a standard by PEP 440, and * is going to be obsolete eventually, I can change to format entirely using ~= instead.

My team and I will be happy to settle any issues related to this PR efficiently, as this feature is something our team will like to incorporate. :)

@alan-barzilay
Copy link
Collaborator

alan-barzilay commented Mar 26, 2021

Can I understand the reason to add the compatible release format?

My understanding of the compatible release format is that it is useful if you want to ensure that you will have a compatible version of a package. Lets say you have a package in version 3.1.2 in your current project. By using ~=3.1.2 in your requirements, you will guarantee that you will get version 3.1.2 or later, but not version 3.2.0 or later. If you need a feature that was introduced in version 3.1.2 this will guarantee that you will have it, but it also guarantees that you will not get version 3.2.0 or later since a breaking change may have been introduced.

I agree that using asterisks kinda achieves the same purpose but I believe using the ~= notation would provide a more robust requirements.txt. Maybe we could adapt the micro and minor schemes to use ~=? The micro scheme would simply use the  compatible release notation and the minor scheme would also use ~= but only after stripping everything after the second ".". This approach would also have a smaller code surface to worry about.

If I may, I have a suggestion that would also contemplate PR #107.
I see 5 different mutually exclusive use cases:

  1. no-pin: I don't care what version of the packages I get, I just need these packages to exist in my environment regardless of their version
  2. >=: I don't care what version of the packages I get, I just need them to have a version equal or higher than X.Y.Z
  3. ~=: I want to ensure that the packages installed will have a version compatible with my project but I don't want to completely freeze their versions(similar to your micro scheme).
  4. ~=/minor: I want to ensure that the packages installed will have a version compatible with my project but I don't want to completely freeze their versions and I'm only worried about major version changes.
  5. (default)==: I want to be able to replicate my exact setup and will completely freeze all package versions

What do you think?

@mapattacker
Copy link
Contributor Author

mapattacker commented Mar 27, 2021

@alan-barzilay thanks for the detailed explanation.

It makes sense, and also a good idea to consider PR #107.

As they sort of belong to the same family, should we lump them together as a single option like below? Do edit the wordings if I used any of them inappropriately.

Options:

    --dynamic <scheme>    Enables dynamic version install by <minor>, <micro>, <gt> or <non-pin> schemes.
                          <micro>  | e.g. Flask~=1.1.2 | install micro updates only
                          <minor>  | e.g. Flask~=1.1   | install minor updates only
                          <gt>     | e.g. Flask>=1.1.2 | install version greater or equals to stated
                          <no-pin> | e.g. Flask        | version not important, if not exist install the latest

@alan-barzilay
Copy link
Collaborator

I have a question for you @mapattacker, what is the use case that you envisioned for the minor scheme?
After thinking about it I realized I never had the need for such a mode. To me it seems like an unlikely situation wanting to keep compatibility and also being able to ensure that only "major" versions can break compatibility given that each package has their own versioning policies.
I would appreciate if you could help me understand the motivation behind this scheme.

As they sort of belong to the same family, should we lump them together as a single option like below?

Agreed! I edited a few things to make it more succinct and intuitive, let me know what you think :) (I skipped the minor scheme because I couldn't think of an intuitive/descriptive name for it, maybe something like weak or relaxed compatibility? )

Options:
      --mode <scheme>      Enables dynamic versioning with <compat>, <gt> or <non-pin> schemes. 
                           <compat> | e.g. Flask~=1.1.2 (equivalent to >=1.1.2,==1.1.*)
                           <gt>     | e.g. Flask>=1.1.2 
                           <no-pin> | e.g. Flask 

@mapattacker
Copy link
Contributor Author

mapattacker commented Mar 28, 2021

I have a question for you @mapattacker, what is the use case that you envisioned for the minor scheme?
I would appreciate if you could help me understand the motivation behind this scheme.

@alan-barzilay That's a good question haha, our main goal for this PR is actually for the micro/compat scheme. I just thought there might be somebody who might value a minor scheme update for some reason. I guess till someone require it, then only it makes sense to include in. The code changes will be a lot simplified without that option too.

                       <compat> | e.g. Flask~=1.1.2 (equivalent to >=1.1.2,==1.1.*)

I think for this line, I feel we should remove >=1.1.2, as despite citing in PEP 440, it is still not exactly equivalent. E.g. if we put Flask>=1.1.2, pip will install the latest version, e.g. Flask 2.0.0 if the environment does not have an existing installation. There might also be some confusion of why having the "gt" option if this is equivalent. What do u think?

If the above are ok, me and @Jcch94 should be able to update the PR pretty soon.

@alan-barzilay
Copy link
Collaborator

Ok! Lets drop the minor scheme then and remove the "explanation" for the compat mode.

Options:
      --mode <scheme>      Enables dynamic versioning with <compat>, <gt> or <non-pin> schemes. 
                           <compat> | e.g. Flask~=1.1.2 
                           <gt>     | e.g. Flask>=1.1.2 
                           <no-pin> | e.g. Flask 

* fixed MySQL + krbV mappings to be reversed

* Working on issue bndr#88

* More --clean tests.

* Fixed bndr#88

* mapping aws-sam-translator

https://pypi.org/project/aws-sam-translator/
https://github.com/awslabs/serverless-application-model

* Fixed#133

Sorted `imports` based on `lowercase` package's `name`, similar to `pip freeze`.

* Tweak formatting

* Add pyAFQ Mapping

* Add discord mapping

Map discord to discord.py

* Add PyFunctional mapping

Maps `functional` to `pyfunctional`. Fixes bndr#232.

* Upgrade pip before running tests on travis

This should ensure that all tests use the same version of pip and this should hopefully fix the pypy build that is using pip 19

* Upgrading pypy to pypy3

Maybe forcing pypy to use python 3 will solve the issue (although it works fine with python 2.7 at the moment)

* Remove unecessary pip upgrade step

* Mapping for github3

* changes based on discussions w maintainer

* remove obsolete '=='

Co-authored-by: Hari Sekhon <harisekhon@gmail.com>
Co-authored-by: AlexPHorta <alexandre.horta@gmail.com>
Co-authored-by: Pat Myron <PatMyron@users.noreply.github.com>
Co-authored-by: Abhishek Kumar Singh <toanant@users.noreply.github.com>
Co-authored-by: Ben Bodenmiller <bbodenmiller@gmail.com>
Co-authored-by: John Kruper <36000@users.noreply.github.com>
Co-authored-by: Paweł Kalemba <5924586+pkalemba@users.noreply.github.com>
Co-authored-by: SwiftWinds <12981958+SwiftWinds@users.noreply.github.com>
Co-authored-by: Alan Barzilay <alan-barzilay@users.noreply.github.com>
Co-authored-by: alan-barzilay <alan.barzilay@gmail.com>
Co-authored-by: ryan-rozario <ryan.rozario1999@gmail.com>
Co-authored-by: Siyang <teo_siyang@imda.gov.sg>
@alan-barzilay
Copy link
Collaborator

Feature implemented in PR#239

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.

None yet

3 participants