Skip to content

Commit

Permalink
👷 Divide pip constraints into distinct pairs
Browse files Browse the repository at this point in the history
The in+txt key pairs can be managed by pip-tools and upgraded by
Dependabot natively.
  • Loading branch information
webknjaz committed Aug 1, 2023
1 parent 36bc687 commit b1a998c
Show file tree
Hide file tree
Showing 28 changed files with 875 additions and 145 deletions.
23 changes: 11 additions & 12 deletions .github/workflows/ci-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,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 +67,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 +203,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 +294,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 +360,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 +398,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
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" and python_version < "3.9" # MagicStack/uvloop#14
43 changes: 36 additions & 7 deletions requirements/base.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,42 @@
-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"
#
# This file is autogenerated by pip-compile with Python 3.9
# by the following command:
#
# pip-compile --allow-unsafe --output-file=requirements/base.txt --strip-extras requirements/base.in
#
aiodns==3.0.0 ; sys_platform == "linux" or sys_platform == "darwin"
# via -r requirements/runtime-deps.in
aiosignal==1.3.1
# via -r requirements/runtime-deps.in
async-timeout==4.0.2
Brotli==1.0.9
cchardet==2.1.7; python_version < "3.10" # Unmaintained: aio-libs/aiohttp#6819
# via -r requirements/runtime-deps.in
brotli==1.0.9
# via -r requirements/runtime-deps.in
cchardet==2.1.7 ; python_version < "3.10"
# via -r requirements/runtime-deps.in
cffi==1.15.1
# via pycares
charset-normalizer==3.2.0
# via -r requirements/runtime-deps.in
frozenlist==1.4.0
# via
# -r requirements/runtime-deps.in
# aiosignal
gunicorn==21.2.0
uvloop==0.17.0; platform_system!="Windows" and implementation_name=="cpython" and python_version<"3.9" # MagicStack/uvloop#14
# via -r requirements/base.in
idna==3.4
# via yarl
multidict==6.0.4
# via
# -r requirements/runtime-deps.in
# yarl
packaging==23.1
# via gunicorn
pycares==4.3.0
# via aiodns
pycparser==2.21
# via cffi
typing-extensions==4.1.1
# via -r requirements/typing-extensions.in
yarl==1.9.2
# via -r requirements/runtime-deps.in
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

0 comments on commit b1a998c

Please sign in to comment.