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

👷 Divide pip constraints into distinct pairs #7460

Merged
merged 1 commit into from
Aug 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 18 additions & 12 deletions .github/workflows/ci-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,13 @@ jobs:
uses: actions/checkout@v3
with:
submodules: true
- name: >-
Verify that `requirements/runtime-deps.in`
is in sync with `setup.cfg`
run: |
set -eEuo pipefail
make sync-direct-runtime-deps
git diff --exit-code -- requirements/runtime-deps.in
- name: Setup Python
uses: actions/setup-python@v4
with:
Expand All @@ -54,10 +61,10 @@ jobs:
python -m pip install -U pip wheel setuptools build twine
- name: Install dependencies
run: |
python -m pip install -r requirements/lint.txt -c requirements/constraints.txt
python -m pip install -r requirements/lint.in -c requirements/lint.txt
- name: Install self
run: |
python -m pip install .
python -m pip install . -c requirements/runtime-deps.txt
env:
AIOHTTP_NO_EXTENSIONS: 1
- name: Run mypy
Expand All @@ -67,14 +74,14 @@ jobs:
run: |
# Some extra requirements are needed to ensure all modules
# can be scanned by slotscheck.
pip install -r requirements/base.txt -c requirements/constraints.txt
pip install -r requirements/base.in -c requirements/base.txt
slotscheck -v -m aiohttp
- name: Install libenchant
run: |
sudo apt install libenchant-2-dev
- name: Install spell checker
run: |
pip install -r requirements/doc-spelling.txt -c requirements/constraints.txt
pip install -r requirements/doc-spelling.in -c requirements/doc-spelling.txt
- name: Run docs spelling
run: |
# towncrier --yes # uncomment me after publishing a release
Expand Down Expand Up @@ -203,7 +210,7 @@ jobs:
python -m pip install -U pip wheel setuptools build twine
- name: Install dependencies
run: |
python -m pip install -r requirements/test.txt -c requirements/constraints.txt
python -m pip install -r requirements/test.in -c requirements/test.txt
- name: Cythonize
if: ${{ matrix.no-extensions == '' }}
run: |
Expand Down Expand Up @@ -294,8 +301,9 @@ jobs:
run: |
python -m pip install -U pip wheel setuptools build twine
- name: Install cython
run: |
python -m pip install -r requirements/cython.txt -c requirements/constraints.txt
run: >-
python -m
pip install -r requirements/cython.in -c requirements/cython.txt
- name: Restore llhttp generated files
uses: actions/download-artifact@v3
with:
Expand Down Expand Up @@ -359,8 +367,9 @@ jobs:
run: |
python -m pip install -U pip wheel setuptools build twine
- name: Install cython
run: |
python -m pip install -r requirements/cython.txt -c requirements/constraints.txt
run: >-
python -m
pip install -r requirements/cython.in -c requirements/cython.txt
- name: Restore llhttp generated files
uses: actions/download-artifact@v3
with:
Expand Down Expand Up @@ -396,9 +405,6 @@ jobs:
uses: actions/checkout@v3
with:
submodules: true
- name: Update pip, wheel, setuptools, build, twine
run: |
python -m pip install -U pip wheel setuptools build twine
- name: Login
run: |
echo "${{ secrets.GITHUB_TOKEN }}" | gh auth login --with-token
Expand Down
49 changes: 0 additions & 49 deletions .github/workflows/post-dependabot.yml

This file was deleted.

5 changes: 2 additions & 3 deletions .github/workflows/update-pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@ jobs:
with:
python-version: 3.8
- name: Install dependencies
uses: py-actions/py-dependency-install@v4
with:
path: requirements/lint.txt
run: >-
pip install -r requirements/lint.in -c requirements/lint.txt
- name: Run pre-commit autoupdate
run: pre-commit autoupdate
- id: generate_token
Expand Down
4 changes: 4 additions & 0 deletions .pip-tools.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[pip-tools]
allow-unsafe = true
resolver = "backtracking"
strip-extras = true
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ repos:
^docs/[^/]*\.svg$
- id: requirements-txt-fixer
exclude: >-
^requirements/constraints[.]txt$
^requirements/.*\.txt$
- id: trailing-whitespace
- id: file-contents-sorter
args: ['--ignore-case']
Expand Down
12 changes: 7 additions & 5 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@ build:
tools:
python: "3.11"

python:
install:
- method: pip
path: .
- requirements: requirements/doc.txt
jobs:
post_create_environment:
- >-
pip install
. -c requirements/runtime-deps.txt
-r requirements/doc.in -c requirements/doc.txt

...
22 changes: 12 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ endif
@python -m pip install --upgrade pip

.install-cython: .update-pip $(call to-hash,requirements/cython.txt)
@python -m pip install -r requirements/cython.txt -c requirements/constraints.txt
@python -m pip install -r requirements/cython.in -c requirements/cython.txt
@touch .install-cython

aiohttp/_find_header.c: $(call to-hash,aiohttp/hdrs.py ./tools/gen.py)
Expand All @@ -74,7 +74,7 @@ generate-llhttp: .llhttp-gen
cythonize: .install-cython $(PYXS:.pyx=.c)

.install-deps: .install-cython $(PYXS:.pyx=.c) $(call to-hash,$(CYS) $(REQS))
@python -m pip install -r requirements/dev.txt -c requirements/constraints.txt
@python -m pip install -r requirements/dev.in -c requirements/dev.txt
@touch .install-deps

.PHONY: lint
Expand All @@ -89,7 +89,7 @@ mypy:
mypy

.develop: .install-deps generate-llhttp $(call to-hash,$(PYS) $(CYS) $(CS))
python -m pip install -e . -c requirements/constraints.txt
python -m pip install -e . -c requirements/runtime-deps.txt
@touch .develop

.PHONY: test
Expand Down Expand Up @@ -177,15 +177,17 @@ doc:
doc-spelling:
@make -C docs spelling SPHINXOPTS="-W --keep-going -n -E"

.PHONY: compile-deps
compile-deps: .update-pip $(REQS)
pip-compile --no-header --allow-unsafe -q --strip-extras \
-o requirements/constraints.txt \
requirements/constraints.in

.PHONY: install
install: .update-pip
@python -m pip install -r requirements/dev.txt -c requirements/constraints.txt
@python -m pip install -r requirements/dev.in -c requirements/dev.txt

.PHONY: install-dev
install-dev: .develop

.PHONY: sync-direct-runtime-deps
sync-direct-runtime-deps:
@echo Updating 'requirements/runtime-deps.in' from 'setup.cfg'... >&2
@echo '# Extracted from `setup.cfg` via `make sync-direct-runtime-deps`' > requirements/runtime-deps.in
@echo >> requirements/runtime-deps.in
@python -c 'from configparser import ConfigParser; from itertools import chain; from pathlib import Path; cfg = ConfigParser(); cfg.read_string(Path("setup.cfg").read_text()); print("\n".join(line.strip() for line in chain(cfg["options"].get("install_requires").splitlines(), "\n".join(cfg["options.extras_require"].values()).splitlines()) if line.strip()))' \
>> requirements/runtime-deps.in
5 changes: 5 additions & 0 deletions requirements/base.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
-r typing-extensions.in
-r runtime-deps.in

gunicorn
uvloop; platform_system != "Windows" and implementation_name == "cpython" # MagicStack/uvloop#14
21 changes: 8 additions & 13 deletions requirements/base.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
-r multidict.txt
-r typing-extensions.txt
# required c-ares will not build on windows
aiodns==3.0.0; sys_platform=="linux" or sys_platform=="darwin"
aiosignal==1.3.1
async-timeout==4.0.2
Brotli==1.0.9
cchardet==2.1.7; python_version < "3.10" # Unmaintained: aio-libs/aiohttp#6819
charset-normalizer==3.2.0
frozenlist==1.4.0
gunicorn==21.2.0
uvloop==0.17.0; platform_system!="Windows" and implementation_name=="cpython" and python_version<"3.9" # MagicStack/uvloop#14
yarl==1.9.2
#
# This file is autogenerated by pip-compile with Python 3.8
# by the following command:
#
# pip-compile --allow-unsafe --output-file=requirements/base.txt --strip-extras requirements/multidict.txt
#
Copy link
Member Author

Choose a reason for hiding this comment

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

Looks like I messed up arguments of the for-loop I used locally. Will have to hotfix the lock files in a follow-up PR.

multidict==6.0.4
# via -r requirements/multidict.txt
2 changes: 2 additions & 0 deletions requirements/broken-projects.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Pillow < 10 # https://github.com/blockdiag/sphinxcontrib-blockdiag/issues/26
pydantic < 2 # looks like `python-on-whales` hasn't upgraded to support v2
Comment on lines +1 to +2
Copy link
Member

Choose a reason for hiding this comment

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

Do we want to track these? Normally easier to just have the locks at working versions and let Dependabot PRs figure out when they are passing and can be bumped.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, otherwise pip-tools will try to upgrade to non-working versions. And dependabot would also spam with PRs likely.

FWIW, we may want to reconsider after getting the hotfixes and backports for this in.

Copy link
Member

Choose a reason for hiding this comment

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

If it's PRs to bump pillow and pydantic, that'd be the expected behaviour to me. Once they start working, the PRs will get merged, and I can check open PRs to see which are still failing at any given time.

8 changes: 4 additions & 4 deletions requirements/constraints.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
-r cython.txt
-r dev.txt
-r doc-spelling.txt
-r lint.txt
-r cython.in
-r dev.in
-r doc-spelling.in
-r lint.in
Loading
Loading