diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 7f31c3e1..5ee2b15e 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -8,7 +8,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"] + python-version: ["3.10", "3.11", "3.12", "3.13", "3.14", "3.15"] steps: - uses: actions/checkout@v5 @@ -36,3 +36,69 @@ jobs: with: github-token: ${{ secrets.GITHUB_TOKEN }} path-to-lcov: coverage.lcov + + format: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v5 + - name: Set up Python + uses: actions/setup-python@v6 + with: + python-version: "3.12" + - name: Install black + run: | + python -m pip install --upgrade pip + pip install "black~=26.0" + - name: Check formatting with black + run: | + black --check --diff . + + docs: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v5 + - name: Set up Python + uses: actions/setup-python@v6 + with: + # same version as the ReadTheDocs build (.readthedocs.yaml) + python-version: "3.11" + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -e ".[docs]" + - name: Build documentation, treating warnings as errors + run: | + sphinx-build -W --keep-going -b html doc doc/_build/html + + package: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v5 + - name: Set up Python + uses: actions/setup-python@v6 + with: + python-version: "3.12" + - name: Build wheel + run: | + python -m pip install --upgrade pip build + python -m build --wheel --outdir dist . + - name: Install wheel in a clean environment + run: | + python -m venv "$RUNNER_TEMP/wheelenv" + "$RUNNER_TEMP/wheelenv/bin/pip" install dist/*.whl + - name: Import every module from the installed wheel + # run outside the checkout, in isolated mode, so that the source tree cannot be imported + working-directory: ${{ runner.temp }} + run: | + "$RUNNER_TEMP/wheelenv/bin/python" -I -c ' + import importlib, pkgutil, fairgraph + print(fairgraph.__file__, fairgraph.__version__) + for m in pkgutil.walk_packages(fairgraph.__path__, "fairgraph."): + importlib.import_module(m.name) + ' diff --git a/doc/contributing.rst b/doc/contributing.rst index cf8b94b5..7c6e910a 100644 --- a/doc/contributing.rst +++ b/doc/contributing.rst @@ -197,6 +197,9 @@ Coding standards and style All code should conform as much as possible to `PEP 8`_. We use black_ to auto-format the code, with a line length of 119 characters. Please run ``black`` before making a commit. +Continuous integration checks the formatting with:: + + $ black --check . As a basic check of code quality, run:: @@ -231,6 +234,12 @@ To build the documentation:: Then open `_build/html/index.html` in your browser. +Continuous integration builds the documentation with warnings treated as errors, +so before submitting changes, check that the following runs without warnings:: + + $ cd doc + $ sphinx-build -W --keep-going -b html . _build/html + Committing your changes ----------------------- diff --git a/doc/release_notes.rst b/doc/release_notes.rst index 8bf82261..36fa272d 100644 --- a/doc/release_notes.rst +++ b/doc/release_notes.rst @@ -23,6 +23,9 @@ New features Changes in behaviour -------------------- +- fairgraph now requires Python 3.10 or later, as Python 3.9 has reached end of life. + It is tested with Python 3.10 to 3.15. + - Leading and trailing whitespace is now removed from text properties before they are saved Text loaded from the Knowledge Graph is left as it is until saved, so saving a fetched object corrects any untrimmed text that is stored. diff --git a/pyproject.toml b/pyproject.toml index f03f8110..ba24f645 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,7 +6,7 @@ readme = "README.md" authors = [ { name="Andrew P. Davison", email="andrew.davison@cnrs.fr" } ] -requires-python = ">=3.9" +requires-python = ">=3.10" license = "Apache-2.0" classifiers = [ "Development Status :: 4 - Beta", @@ -60,4 +60,4 @@ include = ["fairgraph*"] [tool.black] line-length = 119 -target-version = ["py39"] +target-version = ["py310"]