Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

⬆️ Update to Sphinx 7 #1056

Merged
merged 1 commit into from
Nov 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 12 additions & 15 deletions .github/workflows/benchmark.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,14 @@ jobs:
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Install/Update build dependencies
- name: Update pip
run: python -m pip install --upgrade pip
- name: Install dependencies
run: |
python -m pip install --upgrade setuptools
python -m pip install --upgrade pip
- name: Install Poetry
run: |
curl -sL https://install.python-poetry.org | python -
- name: Update Pip
run: poetry run pip install -U pip setuptools
- name: Install Nox Dependencies
run: |
python -m pip install poetry nox nox-poetry pyparsing==3.0.4
python -m pip install -e .[test,benchmark,docs]
- name: Run Benchmark for time
run: nox --non-interactive --session benchmark_time -- --full-trace
run: pytest --benchmark-json output.json -k _time tests/benchmarks

- name: Download previous benchmark data
uses: actions/cache@v3
with:
Expand All @@ -53,13 +47,16 @@ jobs:
gh-pages-branch: "benchmarks"
benchmark-data-dir-path: "docs/bench"
alert-comment-cc-users: '@danwos'
- name: Run memory benchmark
run: nox --non-interactive --session benchmark_memory

- name: Run Benchmark for memory
run: pytest --benchmark-json output.json -k _time tests/benchmarks
- name: Create memory flamegraph
run: memray flamegraph -o mem_out.html mem_out.bin
- name: Publish memory flamegraph
run: |
git checkout benchmarks
cp mem_out.html docs/memory.html
git add docs/memory.html
git -c "user.name=Sphinx-Needs CI" -c "[email protected]" commit -m "memory.html update"
- name: Push changes
run: git push origin benchmarks
run: git push origin benchmarks
99 changes: 63 additions & 36 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -1,70 +1,97 @@
name: CI
on: [pull_request]
jobs:
tests:
name: "py${{ matrix.python-version }} sp${{ matrix.sphinx-version }} do${{ matrix.docutils-version }} ${{ matrix.os }}"

lint:
name: Lint
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.8
uses: actions/setup-python@v4
with:
python-version: '3.8'
- uses: pre-commit/[email protected]

tests-core:
name: "Core py${{ matrix.python-version }} sphinx~=${{ matrix.sphinx-version }} ${{ matrix.os }}"
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false # Set on "false" to get the results of ALL builds
matrix:
os: ["ubuntu-latest"]
# 3.9.8 seems to be broken with type_ast
# https://www.mail-archive.com/[email protected]/msg1829077.html
python-version: ["3.8", "3.10"]
sphinx-version: ['5.2.1', '4.5.0']
docutils-version: ['0.19', '0.15']
exclude:
- sphinx-version: "4.5.0"
docutils-version: "0.19"
python-version: ["3.8", "3.11"]
sphinx-version: ["5.0", "6.0", "7.0"]
include:
# Check only newest setups for win server
- os: "windows-latest"
python-version: "3.8"
sphinx-version: "4.5.0"
docutils-version: "0.15"
sphinx-version: "5.0"
steps:
- uses: actions/checkout@v4
- name: Set Up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install Nox Dependencies
run: |
python -m pip install poetry nox nox-poetry pyparsing==3.0.4
- name: Install other dependencies
- name: Update pip
run: python -m pip install --upgrade pip
- name: Install dependencies
run: |
python -m pip install setuptools
- name: Final package list
python -m pip install sphinx~=${{ matrix.sphinx-version }} -e .[test]
python -m pip freeze
- name: Run pytest
run: |
pip freeze

- name: Run Tests on Windows
run: nox --non-interactive --session "tests-${{ matrix.python-version }}(sphinx='${{ matrix.sphinx-version }}', docutils='${{ matrix.docutils-version }}')" -- --full-trace
if: runner.os == 'Windows'

- name: Run Tests on Linux
run: nox --non-interactive --session "tests-${{ matrix.python-version }}(sphinx='${{ matrix.sphinx-version }}', docutils='${{ matrix.docutils-version }}')" -- --full-trace
if: runner.os == 'Linux'
python -m pytest -v --ignore=tests/benchmarks -m "not jstest" tests

lint:
name: Lint
runs-on: ubuntu-20.04
tests-js:
name: "JS py${{ matrix.python-version }} sphinx~=${{ matrix.sphinx-version }} ${{ matrix.os }}"
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: "ubuntu-latest"
python-version: "3.8"
sphinx-version: "5.0"
- os: "ubuntu-latest"
python-version: "3.11"
sphinx-version: "7.0"
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.8
uses: actions/setup-python@v4
with:
python-version: '3.8'
- uses: pre-commit/[email protected]
- uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: 18
- name: Install Cypress Test Framework
run: npm install cypress
- name: Set Up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Update pip
run: python -m pip install --upgrade pip
- name: Install dependencies
run: |
python -m pip install sphinx~=${{ matrix.sphinx-version }} -e .[test]
python -m pip freeze
- name: Run pytest
run: |
python -m pytest -v --ignore=tests/benchmarks -m "jstest" tests

check:

# This job does nothing and is only used for the branch protection
# see https://github.com/marketplace/actions/alls-green#why

if: always()

needs:
- lint
- tests
- tests-core
- tests-js

runs-on: ubuntu-latest

steps:
- name: Decide whether the needed jobs succeeded or failed
uses: re-actors/alls-green@release/v1
Expand Down
11 changes: 7 additions & 4 deletions .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,11 @@ jobs:
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Install Nox Dependencies
- name: Update pip
run: python -m pip install --upgrade pip
- name: Install Dependencies
run: |
python -m pip install poetry nox nox-poetry pyparsing==3.0.4
- name: Run LinkCheck
run: nox --non-interactive --session linkcheck -- --full-trace
python -m pip install -e .[docs]
- name: Run linkcheck
run: sphinx-build -b linkcheck . _build
working-directory: docs
7 changes: 2 additions & 5 deletions .github/workflows/js_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,9 @@ jobs:
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install Python dependencies
- name: Install package
run: |
pip install -r docs/requirements.txt
- name: Install Sphinx-Needs from master
run: |
pip install -e .
pip install -e .[docs]
- name: Install Node dependencies
run: npm install cypress
- name: Build Docs
Expand Down
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/psf/black
rev: 23.7.0
rev: 23.10.1
hooks:
- id: black

Expand All @@ -20,14 +20,14 @@ repos:
- id: isort

- repo: https://github.com/asottile/pyupgrade
rev: v3.10.1
rev: v3.15.0
hooks:
- id: pyupgrade
args:
- --py36-plus

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.5.1
rev: v1.6.1
hooks:
- id: mypy
files: sphinx_needs/.*
Expand All @@ -39,6 +39,6 @@ repos:
- types-requests

- repo: https://github.com/python-poetry/poetry
rev: 1.5.0
rev: 1.7.0
hooks:
- id: poetry-check
1 change: 0 additions & 1 deletion .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ sphinx:

python:
install:
- requirements: docs/requirements.txt
- method: pip
path: .
extra_requirements:
Expand Down
42 changes: 20 additions & 22 deletions docs/contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,42 +26,32 @@ Your PR should conform with the following rules:
Installing Dependencies
-----------------------

**Sphinx-Needs** requires only
`Poetry <https://python-poetry.org/>`__ to be installed as a system
dependency, the rest of the dependencies are 'bootstrapped' and
installed in an isolated environment by Poetry.
To develop **Sphinx-Needs** it can be installed, with development extras, into an existing Python environment using ``pip``:

1. `Install Poetry <https://python-poetry.org/docs/#installation>`__
.. code-block:: bash

2. Install project dependencies
pip install sphinx-needs[test,benchmark,docs]

.. code-block:: bash
or using `Poetry <https://python-poetry.org/>`__ to install the dependencies into an isolated environment:

poetry install

3. `Install Pre-Commit <https://pre-commit.com/>`__
1. `Install Poetry <https://python-poetry.org/docs/#installation>`__

4. Install the Pre-Commit hooks
2. Install project dependencies

.. code-block:: bash

pre-commit install

5. For running tests, install the dependencies of our official documentation:
poetry install --all-extras

.. code-block:: bash
To run the formatting and linting suite, pre-commit is used:

pip install -r docs/requirements.txt
1. `Install Pre-Commit <https://pre-commit.com/>`__

2. Install the Pre-Commit hooks

List make targets
-----------------

**Sphinx-Needs** uses ``make`` to invoke most development related actions.
.. code-block:: bash

Use ``make list`` to get a list of available targets.
pre-commit install

.. program-output:: make --no-print-directory --directory ../ list

Build docs
----------
Expand Down Expand Up @@ -293,6 +283,14 @@ See the Poetry documentation for a list of commands.
In order to run custom commands inside the isolated environment, they
should be prefixed with ``poetry run`` (ie. ``poetry run <command>``).

List make targets
-----------------

**Sphinx-Needs** uses ``make`` to invoke most development related actions.

Use ``make list`` to get a list of available targets.

.. program-output:: make --no-print-directory --directory ../ list

Publishing a new release
------------------------
Expand Down
10 changes: 0 additions & 10 deletions docs/requirements.txt

This file was deleted.

Loading