Skip to content

Use environment marker to restrict flake8 install - #9510

Merged
AlexWaygood merged 2 commits into
python:mainfrom
Avasam:3.7-environment-marker
Jan 12, 2023
Merged

Use environment marker to restrict flake8 install#9510
AlexWaygood merged 2 commits into
python:mainfrom
Avasam:3.7-environment-marker

Conversation

@Avasam

@AvasamAvasam commented Jan 12, 2023

Copy link
Copy Markdown
Collaborator

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

cache-dependency-path: requirements-tests.txt
- name: Install dependencies
run: pip install $(grep mypy== requirements-tests.txt)
run: pip install -r requirements-tests.txt

@AvasamAvasamJan 12, 2023

Copy link
Copy Markdown
CollaboratorAuthor

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.

@AlexWaygoodAlexWaygoodJan 12, 2023

Copy link
Copy Markdown
Member

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!

@AvasamAvasamJan 12, 2023

Copy link
Copy Markdown
CollaboratorAuthor

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
Copy Markdown
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 👍

@AlexWaygoodAlexWaygood left a comment

Copy link
Copy Markdown
Member

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:mainJan 12, 2023
@Avasam
Avasam deleted the 3.7-environment-marker branch February 29, 2024 00:44
Sign up for freeto 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

@Avasam@AlexWaygood