From afc8105d6371a671c5a8aa8082f454e1c8155ef1 Mon Sep 17 00:00:00 2001 From: Marta Kostrova Date: Sun, 25 Feb 2024 00:40:56 +0200 Subject: [PATCH 1/4] Optimize requirements installation across CI jobs The `dev.txt` requirements file contains all needed dependencies, and those versions already account for base requirements constraint because it is generated by `pip-compile` with the `--constraint` option. That's why installing dependencies from the `dev.txt` file is enough." --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e741624..5c09863 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,7 +17,7 @@ jobs: python-version: 3.11 - name: Install requirements - run: python -m pip install -r requirements/dev.in -c requirements/dev.txt + run: python -m pip install -r requirements/dev.txt - name: Run tests run: python -m manage test @@ -34,7 +34,7 @@ jobs: python-version: 3.11 - name: Install requirements - run: python -m pip install -r requirements/dev.in -c requirements/dev.txt + run: python -m pip install -r requirements/dev.txt - name: Install pre-commit run: python -m pip install --upgrade pre-commit From b0646d8dd1f894d027caa11c5ec103ff4ff6c17e Mon Sep 17 00:00:00 2001 From: Marta Kostrova Date: Sun, 25 Feb 2024 01:28:35 +0200 Subject: [PATCH 2/4] Switch to `pip --constraints` for constraints Updated the handling of requirements constraints by transitioning from using `pip-compile` to directly utilizing the `--constraints` option with `pip`. --- requirements/base.txt | 14 +++++++------- requirements/dev.in | 1 + requirements/dev.txt | 45 +++++++++++++++++++++++-------------------- 3 files changed, 32 insertions(+), 28 deletions(-) diff --git a/requirements/base.txt b/requirements/base.txt index 4c1cf46..dea0bcd 100644 --- a/requirements/base.txt +++ b/requirements/base.txt @@ -1,14 +1,14 @@ # -# This file is autogenerated by pip-compile with Python 3.11 +# This file is autogenerated by pip-compile with Python 3.12 # by the following command: # -# pip-compile --constraint=dev.txt base.in +# pip-compile requirements/base.in # -asgiref == 3.7.2 +asgiref==3.7.2 # via django -django == 3.2.20 - # via -r base.in -pytz == 2023.3 +django==3.2.20 + # via -r requirements/base.in +pytz==2023.3 # via django -sqlparse == 0.4.4 +sqlparse==0.4.4 # via django diff --git a/requirements/dev.in b/requirements/dev.in index 3a7f2a1..41db4dd 100644 --- a/requirements/dev.in +++ b/requirements/dev.in @@ -1,2 +1,3 @@ +-c base.txt -r base.txt pylint diff --git a/requirements/dev.txt b/requirements/dev.txt index 096068e..db8393f 100644 --- a/requirements/dev.txt +++ b/requirements/dev.txt @@ -1,40 +1,43 @@ # -# This file is autogenerated by pip-compile with Python 3.11 +# This file is autogenerated by pip-compile with Python 3.12 # by the following command: # -# pip-compile --constraint=base.in dev.in +# pip-compile requirements/dev.in # -asgiref == 3.7.2 +asgiref==3.7.2 # via - # -r base.txt + # -c requirements/base.txt + # -r requirements/base.txt # django -astroid == 2.15.6 +astroid==2.15.6 # via pylint -dill == 0.3.7 +dill==0.3.7 # via pylint -django == 3.2.20 +django==3.2.20 # via - # -c base.in - # -r base.txt -isort == 5.12.0 + # -c requirements/base.txt + # -r requirements/base.txt +isort==5.12.0 # via pylint -lazy-object-proxy == 1.9.0 +lazy-object-proxy==1.9.0 # via astroid -mccabe == 0.7.0 +mccabe==0.7.0 # via pylint -platformdirs == 3.10.0 +platformdirs==3.10.0 # via pylint -pylint == 2.17.5 - # via -r dev.in -pytz == 2023.3 +pylint==2.17.5 + # via -r requirements/dev.in +pytz==2023.3 # via - # -r base.txt + # -c requirements/base.txt + # -r requirements/base.txt # django -sqlparse == 0.4.4 +sqlparse==0.4.4 # via - # -r base.txt + # -c requirements/base.txt + # -r requirements/base.txt # django -tomlkit == 0.12.1 +tomlkit==0.12.1 # via pylint -wrapt == 1.15.0 +wrapt==1.15.0 # via astroid From 23dc13f0c22dd9034516dc9b3b6b36fee18269ea Mon Sep 17 00:00:00 2001 From: Marta Kostrova Date: Sun, 25 Feb 2024 01:31:25 +0200 Subject: [PATCH 3/4] Exclude base requirements from dev requirements This approach enhances clarity and reduces redundancy by isolating dependencies. --- .github/workflows/ci.yml | 4 ++-- requirements/dev.in | 2 +- requirements/dev.txt | 19 ------------------- 3 files changed, 3 insertions(+), 22 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5c09863..170d38f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,7 +17,7 @@ jobs: python-version: 3.11 - name: Install requirements - run: python -m pip install -r requirements/dev.txt + run: python -m pip install -r requirements/base.txt -r requirements/dev.txt - name: Run tests run: python -m manage test @@ -34,7 +34,7 @@ jobs: python-version: 3.11 - name: Install requirements - run: python -m pip install -r requirements/dev.txt + run: python -m pip install -r requirements/base.txt -r requirements/dev.txt - name: Install pre-commit run: python -m pip install --upgrade pre-commit diff --git a/requirements/dev.in b/requirements/dev.in index 41db4dd..34d17e8 100644 --- a/requirements/dev.in +++ b/requirements/dev.in @@ -1,3 +1,3 @@ -c base.txt --r base.txt + pylint diff --git a/requirements/dev.txt b/requirements/dev.txt index db8393f..a2ead0a 100644 --- a/requirements/dev.txt +++ b/requirements/dev.txt @@ -4,19 +4,10 @@ # # pip-compile requirements/dev.in # -asgiref==3.7.2 - # via - # -c requirements/base.txt - # -r requirements/base.txt - # django astroid==2.15.6 # via pylint dill==0.3.7 # via pylint -django==3.2.20 - # via - # -c requirements/base.txt - # -r requirements/base.txt isort==5.12.0 # via pylint lazy-object-proxy==1.9.0 @@ -27,16 +18,6 @@ platformdirs==3.10.0 # via pylint pylint==2.17.5 # via -r requirements/dev.in -pytz==2023.3 - # via - # -c requirements/base.txt - # -r requirements/base.txt - # django -sqlparse==0.4.4 - # via - # -c requirements/base.txt - # -r requirements/base.txt - # django tomlkit==0.12.1 # via pylint wrapt==1.15.0 From ac47ca9904040367838d601ede5238bbd31bf473 Mon Sep 17 00:00:00 2001 From: Marta Kostrova Date: Sun, 25 Feb 2024 01:37:14 +0200 Subject: [PATCH 4/4] Update README for requirements installation As development requirements no longer include base requirements, both need to be specified during installation. Using `--constraints` is unnecessary; the requirements `.txt` files already account for it. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 3646416..1f64c64 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ This is my educational project within IT KPI Python mentorship program by @webkn 2. Install requirements: ```console - $ pip install -r requirements/base.in -c requirements/base.txt + $ pip install -r requirements/base.txt -r requirements/dev.txt ```