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

aws-sam-cli: avoid hard-coded requests version (use the nix package version) #67286

Closed
wants to merge 1 commit into from

Conversation

scoates
Copy link
Contributor

@scoates scoates commented Aug 22, 2019

Motivation for this change

aws-sam-cli had a hard-coded number dependency on pythonModule.requests's version. This small PR makes it use ${requests.version} instead (thanks to a pointer from @grahamc).

This package has been out of date several times for me (today is the first time I knew how to fix it); this should make it forward-compatible.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nix-review --run "nix-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.
Notify maintainers

cc @andreabedini @dhl

Copy link
Contributor

@jonringer jonringer left a comment

Choose a reason for hiding this comment

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

nix-review doesn't rebuild anything

I'm a little weary since we don't have tests, but it's unlikely that those tests would do much anyway since requests package does network I/O.

However, it might be good to have an assertion that the "requests" package is less than 3. Something like assert lib.versionOlder ${requests.version} "3". But at the point we may as well just do

substituteInPlace requirements/base.txt --replace "requests==2.20.1" "requests<3"

@scoates
Copy link
Contributor Author

scoates commented Aug 22, 2019

I'm certainly OK with changing it to requests<3, too, if that's more acceptable.

@jonringer
Copy link
Contributor

Seems that the requests library is faithful to SemVer according to https://2.python-requests.org/en/master/dev/philosophy/#semantic-versioning . So i think it's safe to do the request<3.

However, I also want to point out that the left side of the replace needs to match exactly each time they decide to bump it as well. It might be worth while to do just a sed -i replace line command like:

sed -i '/requests==/c\requests<3' requirements/base.txt

@jonringer
Copy link
Contributor

I opened a PR to fix this upstream, I don't blame them for being adverse to having more flexible versioning, but it would make life easier.

aws/aws-sam-cli#1363

@dhl
Copy link
Contributor

dhl commented Aug 23, 2019

I've been feeling guilty for neglecting this package, and seeing this gives me a rush of relief. Thank you @scoates and @jonringer!

@@ -56,7 +56,7 @@ buildPythonApplication rec {
];

postPatch = ''
substituteInPlace requirements/base.txt --replace "requests==2.20.1" "requests==2.22.0"
substituteInPlace requirements/base.txt --replace "requests==2.20.1" "requests==${requests.version}"
Copy link
Contributor

Choose a reason for hiding this comment

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

Our version should always be the latest, i say we should just use the compatible operator, and be done with it. (It's the same as saying requests>=2.2,2.*. So it will break if requests ever releases a major bump, but should work otherwise. This should prevent us from needing to touch this ever again)

Suggested change
substituteInPlace requirements/base.txt --replace "requests==2.20.1" "requests==${requests.version}"
sed -i '/requests==2/c\requests~=2.2' requirements/base.txt

@stale
Copy link

stale bot commented Jun 1, 2020

Thank you for your contributions.
This has been automatically marked as stale because it has had no activity for 180 days.
If this is still important to you, we ask that you leave a comment below. Your comment can be as simple as "still important to me". This lets people see that at least one person still cares about this. Someone will have to do this at most twice a year if there is no other activity.
Here are suggestions that might help resolve this more quickly:

  1. Search for maintainers and people that previously touched the
    related code and @ mention them in a comment.
  2. Ask on the NixOS Discourse. 3. Ask on the #nixos channel on
    irc.freenode.net.

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jun 1, 2020
@andreabedini
Copy link
Contributor

I should take myself off the maintainers. I am not using this package anymore

@stale stale bot removed the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jun 1, 2020
@stale
Copy link

stale bot commented Jun 4, 2021

I marked this as stale due to inactivity. → More info

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jun 4, 2021
@Mindavi
Copy link
Contributor

Mindavi commented Nov 27, 2021

Since aws-sam-cli has advanced to a version much higher than it was at the point this PR was made, I assume it can be closed. Please resubmit or rebase if there's still anything of value.

@Mindavi Mindavi closed this Nov 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.status: merge conflict 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md 10.rebuild-darwin: 0 10.rebuild-linux: 0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants