Skip to content

Commit

Permalink
Revert "Don't depend on flake8 at runtime (#6830)"
Browse files Browse the repository at this point in the history
I realized I forgot to update the `.python-version` file to `3.8`, so
we're still installing an older `flake8` version. And it's also breaking
when :dependabot: runs on `dependabot-core` because it sees this `3.7`
and says "that's not a supported version!"

Furthermore, we haven't configured :dependabot: to watch the
`./requirements.txt` which is separate from `./python/helpers/requirements.txt`.

I started to update both of those but the complexity here didn't smell
right. This way of installing `flake8` is actually different than
linters for other native helpers, where we just include them in
`composer.json`, `package.json`, etc. So the intuitive thing is to
install `flake8` into `./python/helpers/requirements.txt`.

In fact we used to do this, but in
#6830 / f407685
we switched to this new method because `flake8` dropped `3.6` support
before we were ready to do that here in :dependabot:.

Given that in :dependabot: we're moving toward aligning our support
policies with upstream Python... ie, when they EOL a version, we will
also drop support for it, then the risk of having a `flake8` version
that's dropping support for a Python version that isn't yet EOL is quite
small.

Interestingly, `flake8` was very slow to drop `3.6`, but when they did,
the maintainer also dropped `3.7` to save himself time even though it
was a few months before it was EOL'd. So we could hit this scenario
again... but I think the odds of that are somewhat low given the amount
of blowback the maintainer got about dropping 3.7 before it was EOL'd.
And regardless the consequences are also low... we'd simply revert
that `flake8` version bump and temporarily hold it back for a few months
until the upstream python version was dropped.

Overall this feels like six one way, half a dozen the other as either
way we are protecting against something. But switching back to how we do
it for our other native helpers is both much simpler setup and also more
internally consistent.

So let's solve this by reverting back to the simpler way of installing
the linter alongside the helper.

As an aside, restoring this simplicity is yet another win from us
choosing to align with upstream Python's EOL policy.

This reverts commit f407685.
  • Loading branch information
jeffwidman committed Aug 17, 2023
1 parent 8347e1e commit 208f477
Show file tree
Hide file tree
Showing 6 changed files with 3 additions and 9 deletions.
5 changes: 0 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -241,9 +241,4 @@ jobs:
- uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- uses: actions/setup-python@v4
with:
python-version-file: .python-version
cache: pip
- run: pip install -r requirements.txt
- run: ./bin/lint
1 change: 0 additions & 1 deletion .python-version

This file was deleted.

2 changes: 0 additions & 2 deletions bin/lint
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,3 @@ shellcheck \
"$@"

bundle exec rubocop

flake8 python/helpers/. --count --exclude=./.*,./python/spec/fixtures --show-source --statistics
1 change: 1 addition & 0 deletions python/helpers/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
pip==23.2.0
pip-tools==7.2.0
flake8==5.0.4
hashin==0.17.0
pipenv==2022.4.8
pipfile==0.0.2
Expand Down
2 changes: 2 additions & 0 deletions python/script/ci-test
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,7 @@

set -e

pyenv exec flake8 helpers/. --count --exclude=./.*,./python/spec/fixtures --show-source --statistics

bundle install
bundle exec parallel_test spec/ -n "$CI_NODE_TOTAL" --only-group "$CI_NODE_INDEX" --group-by filesize --type rspec --verbose
1 change: 0 additions & 1 deletion requirements.txt

This file was deleted.

0 comments on commit 208f477

Please sign in to comment.