Skip to content

Commit

Permalink
build: Fix installation issues in modern Python 3.8+
Browse files Browse the repository at this point in the history
  • Loading branch information
MRichards99 committed Oct 2, 2024
1 parent 642ea8b commit 88d6390
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .github/workflows/ci-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,10 @@ jobs:
- name: Create search_api_mapping.json
run: cp datagateway_api/search_api_mapping.json.example datagateway_api/search_api_mapping.json

# See comment in noxfile.py for explanation regarding this step
- name: Downgrade setuptools
run: poetry run pip install --upgrade setuptools==70.0.0
if: matrix.python-version == '3.8' || matrix.python-version == '3.9' || matrix.python-version == '3.10'
- name: Install dependencies
run: poetry install

Expand Down Expand Up @@ -284,6 +288,9 @@ jobs:
- name: Install Requests
run: pip install 'requests<2.30'

# See comment in noxfile.py for explanation regarding this step
- name: Downgrade setuptools
run: poetry run pip install --upgrade setuptools==70.0.0
- name: Install dependencies
run: poetry install

Expand Down Expand Up @@ -339,6 +346,9 @@ jobs:
- name: Create search_api_mapping.json
run: cd /home/runner/work/datagateway-api/datagateway-api; cp datagateway_api/search_api_mapping.json.example datagateway_api/search_api_mapping.json

# See comment in noxfile.py for explanation regarding this step
- name: Downgrade setuptools
run: poetry run pip install --upgrade setuptools==70.0.0
- name: Install dependencies
run: poetry install

Expand Down
11 changes: 11 additions & 0 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,12 +198,23 @@ def safety(session):
@nox.session(python=["3.6", "3.7", "3.8", "3.9", "3.10"], reuse_venv=True)
def unit_tests(session):
args = session.posargs
# Explicitly installing/downgrading setuptools is done to fix poetry install on 3.8+
# as per https://github.com/pypa/setuptools/issues/4483#issuecomment-2236327987.
# A cleaner fix would be to upgrade the packaging library to 22.0+ (as per
# https://github.com/pypa/setuptools/issues/4483#issuecomment-2236339726) but this
# cannot be done on this repo until support for Python 3.6 is dropped
if session.python in ["3.8", "3.9", "3.10"]:
session.run("pip", "install", "--upgrade", "setuptools==70.0.0")
session.run("poetry", "install", external=True)
session.run("pytest", "test/unit", *args)


@nox.session(python=["3.6", "3.7", "3.8", "3.9", "3.10"], reuse_venv=True)
def integration_tests(session):
args = session.posargs
# Explicit downgrade of setuptools also performed here. See explanation in
# `unit_tests()`
if session.python in ["3.8", "3.9", "3.10"]:
session.run("pip", "install", "--upgrade", "setuptools==70.0.0")
session.run("poetry", "install", external=True)
session.run("pytest", "test/integration", *args)

0 comments on commit 88d6390

Please sign in to comment.