diff --git a/.github/workflows/downstream.yml b/.github/workflows/downstream.yml new file mode 100644 index 0000000..9a51e2f --- /dev/null +++ b/.github/workflows/downstream.yml @@ -0,0 +1,82 @@ +name: Test downstream projects + +on: + push: + branches: ["main"] + pull_request: + +concurrency: + group: downstream-${{ github.ref }} + cancel-in-progress: true + +jobs: + ipykernel: + runs-on: ubuntu-latest + timeout-minutes: 15 + steps: + - uses: actions/checkout@v4 + - uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1 + - uses: jupyterlab/maintainer-tools/.github/actions/downstream-test@v1 + with: + package_name: ipykernel + + nbclient: + runs-on: ubuntu-latest + timeout-minutes: 15 + steps: + - uses: actions/checkout@v4 + - uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1 + - uses: jupyterlab/maintainer-tools/.github/actions/downstream-test@v1 + with: + package_name: nbclient + env_values: IPYKERNEL_CELL_NAME=\ + + nbconvert: + runs-on: ubuntu-latest + timeout-minutes: 15 + steps: + - uses: actions/checkout@v4 + - uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1 + - uses: jupyterlab/maintainer-tools/.github/actions/downstream-test@v1 + with: + package_name: nbconvert + package_spec: pip install -e ".[test]" + + jupyter_server: + runs-on: ubuntu-latest + timeout-minutes: 15 + steps: + - uses: actions/checkout@v4 + - uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1 + - uses: jupyterlab/maintainer-tools/.github/actions/downstream-test@v1 + with: + package_name: jupyter_server + + jupyter_client: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Base Setup + uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1 + + - name: Run Test + uses: jupyterlab/maintainer-tools/.github/actions/downstream-test@v1 + with: + package_name: jupyter_client + + downstreams_check: # This job does nothing and is only used for the branch protection + if: always() + needs: + - ipykernel + - nbclient + - nbconvert + - jupyter_server + - jupyter_client + runs-on: ubuntu-latest + steps: + - name: Decide whether the needed jobs succeeded or failed + uses: re-actors/alls-green@release/v1 + with: + jobs: ${{ toJSON(needs) }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 3f6e617..2e994b7 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -112,7 +112,7 @@ jobs: - name: Run Linters run: | hatch run typing:test - hatch run lint:style + hatch run lint:build pipx run interrogate -v . pipx run doc8 --max-line-length=200 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 180a6c2..7bf78c9 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -44,6 +44,15 @@ repos: - id: blacken-docs additional_dependencies: [black==23.7.0] + - repo: https://github.com/pre-commit/mirrors-mypy + rev: "v1.6.1" + hooks: + - id: mypy + files: jupyter_core + stages: [manual] + args: ["--install-types", "--non-interactive"] + additional_dependencies: ["traitlets>=5.13", "platformdirs>=3.11"] + - repo: https://github.com/codespell-project/codespell rev: "v2.2.6" hooks: diff --git a/pyproject.toml b/pyproject.toml index fbd7cdc..ae82f7b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -88,25 +88,16 @@ test = "python -m pytest -vv --cov jupyter_core --cov-branch --cov-report term-m nowarn = "test -W default {args}" [tool.hatch.envs.typing] -features = ["test"] -dependencies = ["mypy~=1.6.0", "traitlets>=5.13.0"] +dependencies = ["pre-commit"] +detached = true [tool.hatch.envs.typing.scripts] -test = "mypy --install-types --non-interactive {args}" +test = "pre-commit run --all-files --hook-stage manual mypy" [tool.hatch.envs.lint] -dependencies = ["mdformat>0.7", "ruff==0.1.3"] +dependencies = ["pre-commit"] detached = true [tool.hatch.envs.lint.scripts] -style = [ - "ruff {args:.}", - "ruff format {args:.}", - "mdformat --check {args:*.md}" -] -fmt = [ - "ruff --fix {args:.}", - "ruff format {args:.}", - "mdformat {args:*.md}" -] +build = ["pre-commit run --all-files ruff"] [tool.mypy] files = "jupyter_core" @@ -219,4 +210,4 @@ toplevel = ["jupyter_core/", "jupyter.py"] ignore = ["W002"] [tool.repo-review] -ignore = ["PY007", "PP308", "GH102", "PC140"] +ignore = ["PY007", "PP308", "GH102"]