diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 77f7b0394..093e3b06d 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -28,14 +28,15 @@ jobs: uses: actions/cache@v3 with: path: ~/.cache/pip - key: pip-cache-${{ hashFiles('requirements/*/*.txt') }} + key: pip-cache-${{ hashFiles('requirements/*.txt') }} restore-keys: | pip-cache - name: Install python requirements run: | - python3 -m pip install --upgrade pip setuptools wheel - python3 -m pip install -r requirements-dev.txt + python -m pip install --upgrade pip + python -m pip install --upgrade build setuptools twine + python -m pip install -r requirements/dev.txt - name: Create cache directory run: | @@ -51,7 +52,7 @@ jobs: - name: Install Fast-F1 from sources run: | - python3 -m pip install -e . + python -m pip install -e . - name: Create doc build dir run: | diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 81bfbd96b..136255918 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -13,11 +13,11 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-python@v4 with: - python-version: '3.8' + python-version: '3.12' - name: Install dependencies run: | python -m pip install --upgrade pip - pip install --upgrade build twine + python -m pip install --upgrade build setuptools twine # if this is a release, upload to PyPI - name: Build and publish release diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index b357ed725..199585de7 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -12,9 +12,18 @@ jobs: run-code-tests: runs-on: ubuntu-latest strategy: + fail-fast: false matrix: - python-version: [ '3.8', '3.9', '3.10', '3.11', '3.12'] - name: Tests on ${{ matrix.python-version }} + include: + - name-suffix: "(Minimum Versions)" + python-version: "3.8" + extra-requirements: "-c requirements/minver.txt" + - python-version: "3.8" + - python-version: "3.9" + - python-version: "3.10" + - python-version: "3.11" + - python-version: "3.12" + name: Tests on ${{ matrix.python-version }} ${{ matrix.name-suffix }} steps: - name: Setup python uses: actions/setup-python@v4 @@ -28,14 +37,15 @@ jobs: uses: actions/cache@v3 with: path: ~/.cache/pip - key: pip-cache-${{ hashFiles('requirements/*/*.txt') }} + key: pip-cache-${{ hashFiles('requirements/*.txt') }} restore-keys: | pip-cache - name: Install python requirements run: | - python3 -m pip install --upgrade pip setuptools wheel - python3 -m pip install -r requirements-dev.txt + python -m pip install --upgrade pip + python -m pip install --upgrade build setuptools twine + python -m pip install -r requirements/dev.txt ${{ matrix.extra-requirements }} - name: Install Fast-F1 from sources run: | @@ -57,14 +67,15 @@ jobs: run: | pytest -ra + run-lint-checks: runs-on: ubuntu-latest - name: Linting Ruff + name: Linting (Ruff) steps: - name: Setup python uses: actions/setup-python@v4 with: - python-version: '3.8' + python-version: '3.12' - name: Checkout repo uses: actions/checkout@v3 @@ -73,18 +84,19 @@ jobs: uses: actions/cache@v3 with: path: ~/.cache/pip - key: pip-cache-${{ hashFiles('requirements/*/*.txt') }} + key: pip-cache-${{ hashFiles('requirements/*.txt') }} restore-keys: | pip-cache - name: Install python requirements run: | - python3 -m pip install --upgrade pip - python3 -m pip install -r requirements-dev.txt + python -m pip install --upgrade pip + python -m pip install --upgrade build setuptools twine + python -m pip install -r requirements/dev.txt - - name: Install Fast-F1 from sources + - name: Install FastF1 from sources run: | - python3 -m pip install -e . + python -m pip install -e . - name: Run tests if: ${{ github.ref != 'refs/heads/master' }} @@ -94,53 +106,26 @@ jobs: # ruff with default config ruff check . - - name: Run tests (master push) - if: ${{ github.ref == 'refs/heads/master' && env.GITHUB_EVENT_NAME == 'push'}} - env: - LAST_PUSH_SHA: ${{ github.event.before }} - run: | - mkdir test_cache # make sure cache dir exists - git fetch origin --quiet - # flake8 with default config - flake8 fastf1 examples scripts - # flake8 check new shorter line length only on diff - echo "Flake8 line length check on diff against $LAST_PUSH_SHA" - git diff $LAST_PUSH_SHA -U0 --relative | flake8 --max-line-length 79 --diff --select E501 fastf1 examples scripts - run-readme-render-test: name: Test readme renders on PyPi runs-on: ubuntu-latest - steps: - - name: Setup python - uses: actions/setup-python@v4 - with: - python-version: '3.9' - - - name: Checkout repo - uses: actions/checkout@v3 - - name: Cache pip - uses: actions/cache@v3 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 with: - path: ~/.cache/pip - key: pip-cache-${{ hashFiles('requirements/*/*.txt') }} - restore-keys: | - pip-cache - - - name: Install python requirements + python-version: '3.12' + - name: Install dependencies run: | - python3 -m pip install --upgrade pip setuptools wheel - python3 -m pip install -r requirements-dev.txt + python -m pip install --upgrade pip + python -m pip install --upgrade build setuptools twine - - name: Install Fast-F1 from sources + - name: Build release and check long form description run: | - python3 -m pip install -e . + python -m build + twine check dist/* - - name: Run tests - run: | - mkdir test_cache # not really need but pytest setup relies on it - pytest -rf --prj-doc run-sphinx-build-test: name: Test Docs diff --git a/pyproject.toml b/pyproject.toml index 797eea4ad..ad3eab3c1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -11,18 +11,20 @@ readme = "README.md" license = { file = "LICENSE" } +# minimum python version additionally needs to be changed in the test matrix requires-python = ">=3.8" +# minimum package versions additionally need to be changed in requirement/minver.txt dependencies = [ "matplotlib>=3.4.2,<4.0.0", "numpy>=1.20.3,<2.0.0", "pandas>=1.2.4,<2.1.0", "python-dateutil", - "requests>=2.28.0", + "requests>=2.28.1", "requests-cache>=0.8.0", "scipy>=1.6.3,<2.0.0", "thefuzz", "timple>=0.1.6", - "websockets>=8.1", + "websockets>=10.3", ] [project.urls] diff --git a/requirements-dev.txt b/requirements/dev.txt similarity index 100% rename from requirements-dev.txt rename to requirements/dev.txt diff --git a/requirements/minver.txt b/requirements/minver.txt new file mode 100644 index 000000000..949caedd5 --- /dev/null +++ b/requirements/minver.txt @@ -0,0 +1,8 @@ +matplotlib==3.4.2 +numpy==1.20.3 +pandas==1.2.4 +requests==2.28.1 +requests-cache==0.8.0 +scipy==1.6.3 +timple==0.1.6 +websockets==10.3 \ No newline at end of file