Skip to content

Use environment marker to restrict flake8 install #9510

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 2 commits into from
Jan 12, 2023

Conversation

Avasam
Copy link
Collaborator

@Avasam Avasam commented Jan 12, 2023

From #8974 (comment)

Use of environment marker to indicate that a dependency isn't usable with Python 3.7

  • More obvious than grepping
  • Reduces duplication
  • Keeps the CI the same as others
  • Works locally
  • pip will event log why it's not installing flake8

@@ -44,6 +44,6 @@ jobs:
cache: pip
cache-dependency-path: requirements-tests.txt
- name: Install dependencies
run: pip install $(grep mypy== requirements-tests.txt)
run: pip install -r requirements-tests.txt
Copy link
Collaborator Author

@Avasam Avasam Jan 12, 2023

Choose a reason for hiding this comment

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

Arguably only installing the 1-2 dependency we need for a single test doesn't sound like a bad idea either.
And might be doable for other tests as well.

Copy link
Member

@AlexWaygood AlexWaygood Jan 12, 2023

Choose a reason for hiding this comment

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

Ah, it would be good to keep the stubtest stdlib ones as they are. Because stubtest does runtime inspection, the --no-site-packages flag doesn't provide the same level of isolation as it does for when we're just running mypy; and unlike stubtest third-party, this script doesn't create venvs on the fly. It's useful to be 100% sure that it's running in as isolated an environment as possible.

Looks like we don't need the tomli requirement in daily.yml though!

Copy link
Collaborator Author

@Avasam Avasam Jan 12, 2023

Choose a reason for hiding this comment

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

But keep -r requirements-tests.txt for third party right?
I meant daily, and that's also stubtest-stdlib

Copy link
Member

Choose a reason for hiding this comment

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

Yup, the third-party one depends on utils.py, and we can be sure it's testing packages in isolation because of the way it creates venvs on the fly 👍

Copy link
Member

@AlexWaygood AlexWaygood left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks!

@AlexWaygood AlexWaygood merged commit 63c7fb0 into python:main Jan 12, 2023
@Avasam Avasam deleted the 3.7-environment-marker branch February 29, 2024 00:44
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