Skip to content

Pin build dependencies and configure dependabot #389

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

Merged
merged 5 commits into from
Dec 17, 2021

Conversation

lavaleri
Copy link
Contributor

Note that the deps per tox environment are less granular now, which means that some targets will spend time installing deps they don't necessarily need. We could create requirements files specific to each target, although it might be a bit unweildly. The approach in this PR seems like a decent compromise.

I still need to test that dependabot will be able to find files such as linter-requirements.txt, as the docs only specify requirements.txt, however I've seen other setups that suggest it's not quite that stict.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Check any applicable:

  • Were any files moved? Moving files changes their URL, which breaks all hyperlinks to the files.

@lavaleri lavaleri requested a review from a team as a code owner December 16, 2021 00:48
texastony
texastony previously approved these changes Dec 16, 2021
Copy link
Contributor

@texastony texastony left a comment

Choose a reason for hiding this comment

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

Extra Groovy

tox.ini Outdated
Comment on lines 134 to 129
deps =
flake8
# https://github.com/JBKahn/flake8-print/pull/30
flake8-print>=3.1.0
deps = -rlinter-requirements.txt
Copy link
Contributor

Choose a reason for hiding this comment

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

This is where things are going south. Flake8 is pretty generous, compared to flake8 with all the deps in linter-requirements... I vote we expand the ignore fields below to include all the errors from https://github.com/aws/aws-encryption-sdk-python/runs/4541757457?check_suite_focus=true

Can we do something like --ignore D**. That would be awesome...

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, we can: https://flake8.pycqa.org/en/3.1.1/user/options.html#cmdoption-flake8--ignore

So --ignore D would work. In our case, --ignore F811,E203,W503,D

Copy link
Contributor

Choose a reason for hiding this comment

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

I am pretty sure D is for documents, and I am okay with having a lower bar for test's documentation.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch. I'm still curious why this run failed but this one didn't: https://github.com/aws/aws-encryption-sdk-python/runs/4541406129?check_suite_focus=true

They appear to be using the same flake8 versions, but maybe I'm missing a transitive dependency that's different.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I see, linter-requirements includes flake8-docstrings while the original flake8-tests target did not. I agree that the right path forward is to just ignore all doc stuff for the tests.

schedule:
interval: "daily"
- package-ecosystem: "pip"
directory: "/decrypt_oracle"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Note, according to dependabot/feedback#113, any .txt file at or one level below directory should be looked at.

@lavaleri
Copy link
Contributor Author

realized that decrypt_oracle also has it's on tox which defines dependencies. Instead of pinning all of them, bringing decrypt_oracle out of scope for this PR.

texastony
texastony previously approved these changes Dec 16, 2021
Copy link
Contributor

@texastony texastony left a comment

Choose a reason for hiding this comment

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

Groovy

@lavaleri
Copy link
Contributor Author

Tested on fork that dependebot is able to see all the relevant requirements files.

Putting this in draft because there are a couple confounding issues I'm not yet sure how to resolve:

  • dependabot doesn't work super well when dependencies are defined across different files, and those files may repeat the same dependency. For example if doc/requirements is pinned to an old sphinx, but linter-requirements is pinned to a newer one, dependabot seems to just see the newer one and doesn't issue a PR to update doc/requirements.
  • our upstream-requirements-py37.txt can't reasonably be updated by dependabot (just updating one dependency usually results in conflicts). It also exacerbates the above issue.

If I can't think of a good resolution to these problems, we may have to scale back to just pinning the linter requirements, as those are the ones that are most likely to break up from updates.

@lavaleri lavaleri marked this pull request as draft December 16, 2021 22:45
@lavaleri
Copy link
Contributor Author

Moved all pinned dependencies to a top level dir, which we point dependabot at. decrypt_oracle remains unaffected, and the freeze-upstream-requirements remains unaffected. I think this is the best balance we can strike right now between stabilizing builds and keeping things simple.

@lavaleri lavaleri marked this pull request as ready for review December 17, 2021 16:58
Comment on lines +9 to +21
# mainline-1.x
- package-ecosystem: "pip"
directory: "/dev_requirements"
schedule:
interval: "daily"
target-branch: "mainline-1.x"

# mainline-2.x
- package-ecosystem: "pip"
directory: "/dev_requirements"
schedule:
interval: "daily"
target-branch: "mainline-2.x"
Copy link
Contributor

Choose a reason for hiding this comment

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

Err... what happens when dev_requirements does not yet exist? I assume an error... you may want to remove these until we back port dev_requirements to the other branches.

NVM: Dependabot will probably just not find anything, and move on.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah when I tested this on my fork dependbot just shrugged for whichever targets it didn't find. It will "just work" as soon as those branches are correctly updated.

@lavaleri lavaleri merged commit bc5f5a8 into aws:master Dec 17, 2021
@lavaleri lavaleri deleted the pin-deps branch December 17, 2021 19:41
lavaleri added a commit to lavaleri/aws-encryption-sdk-python that referenced this pull request Dec 17, 2021
* chore: Pin build dependencies and configure dependabot

* Ignore flake8 document linting on tests

* Unpin decrypt_oracle dependencies for now

* Pin tox

* Isolate pinned dependencies to dev_requirements dir
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.

2 participants