-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adapt to level config to match other Jupyter repos (#237)
- Loading branch information
Showing
18 changed files
with
408 additions
and
180 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
version: 2 | ||
updates: | ||
# GitHub Actions | ||
- package-ecosystem: "github-actions" | ||
directory: "/" | ||
schedule: | ||
interval: "weekly" | ||
# Python | ||
- package-ecosystem: "pip" | ||
directory: "/" | ||
schedule: | ||
interval: "weekly" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,23 @@ | ||
name: tests | ||
|
||
on: [push, pull_request] | ||
on: | ||
push: | ||
branches: ["main"] | ||
pull_request: | ||
schedule: | ||
- cron: "0 8 * * *" | ||
|
||
jobs: | ||
|
||
pre-commit: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-python@v3 | ||
with: | ||
python-version: 3.8 | ||
- uses: pre-commit/[email protected] | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-python@v3 | ||
with: | ||
python-version: "3.10" | ||
- uses: pre-commit/[email protected] | ||
|
||
tests: | ||
|
||
strategy: | ||
matrix: | ||
python-version: ["3.8", "3.9", "3.10", "3.11", " 3.12"] | ||
|
@@ -28,21 +31,18 @@ jobs: | |
runs-on: ${{ matrix.os }} | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v3 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- uses: actions/checkout@v4 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v3 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install -r requirements.txt | ||
python -m bash_kernel.install # For testing a non-standard kernel | ||
pip install . | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip hatch | ||
- name: Run tests | ||
run: pytest | ||
- name: Run tests | ||
run: hatch run test:test -x | ||
|
||
docs: | ||
runs-on: ubuntu-latest | ||
|
@@ -51,16 +51,13 @@ jobs: | |
- uses: actions/setup-python@v3 | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install -r requirements.txt | ||
pip install . | ||
python -m pip install --upgrade pip hatch | ||
- name: Build docs | ||
run: | | ||
cd doc | ||
make html-strict | ||
hatch run doc:build | ||
publish: | ||
|
||
name: Publish to PyPi | ||
needs: [tests] | ||
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags') | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
.tox/ | ||
.venv | ||
*.py[cod] | ||
|
||
# Packages | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,76 @@ | ||
ci: | ||
autoupdate_schedule: monthly | ||
autoupdate_commit_msg: "chore: update pre-commit hooks" | ||
|
||
repos: | ||
- repo: "https://github.com/pre-commit/pre-commit-hooks" | ||
rev: v4.3.0 | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.5.0 | ||
hooks: | ||
- id: trailing-whitespace | ||
- id: check-case-conflict | ||
- id: check-ast | ||
- id: check-docstring-first | ||
- id: check-executables-have-shebangs | ||
- id: check-added-large-files | ||
- id: check-case-conflict | ||
- id: check-merge-conflict | ||
- id: check-json | ||
- id: check-toml | ||
- id: check-yaml | ||
- id: debug-statements | ||
- id: end-of-file-fixer | ||
- repo: "https://github.com/pycqa/flake8/" | ||
rev: 3.9.2 | ||
- id: trailing-whitespace | ||
|
||
- repo: https://github.com/python-jsonschema/check-jsonschema | ||
rev: 0.27.1 | ||
hooks: | ||
- id: check-github-workflows | ||
|
||
- repo: https://github.com/executablebooks/mdformat | ||
rev: 0.7.17 | ||
hooks: | ||
- id: mdformat | ||
|
||
- repo: https://github.com/pre-commit/mirrors-prettier | ||
rev: "v3.0.3" | ||
hooks: | ||
- id: prettier | ||
types_or: [yaml, html, json] | ||
|
||
- repo: https://github.com/adamchainz/blacken-docs | ||
rev: "1.16.0" | ||
hooks: | ||
- id: blacken-docs | ||
additional_dependencies: [black==23.7.0] | ||
exclude: | | ||
(?x)^( | ||
doc/source/index.rst| | ||
tests/test_execute.py | ||
)$(|) | ||
- repo: https://github.com/codespell-project/codespell | ||
rev: "v2.2.6" | ||
hooks: | ||
- id: flake8 | ||
- repo: "https://github.com/ambv/black" | ||
rev: 22.3.0 | ||
- id: codespell | ||
args: ["-L", "sur,nd"] | ||
|
||
- repo: https://github.com/pre-commit/pygrep-hooks | ||
rev: "v1.10.0" | ||
hooks: | ||
- id: black | ||
language_version: python3 | ||
- repo: "https://github.com/PyCQA/isort" | ||
rev: 5.12.0 | ||
- id: rst-backticks | ||
- id: rst-directive-colons | ||
- id: rst-inline-touching-normal | ||
|
||
- repo: https://github.com/astral-sh/ruff-pre-commit | ||
rev: v0.1.5 | ||
hooks: | ||
- id: isort | ||
- repo: https://github.com/asottile/pyupgrade | ||
rev: v2.34.0 | ||
- id: ruff | ||
types_or: [python, jupyter] | ||
args: ["--fix", "--show-fixes"] | ||
- id: ruff-format | ||
types_or: [python, jupyter] | ||
|
||
- repo: https://github.com/scientific-python/cookie | ||
rev: "2023.10.27" | ||
hooks: | ||
- id: pyupgrade | ||
args: ["--py36-plus"] | ||
- id: sp-repo-review | ||
additional_dependencies: ["repo-review[cli]"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,138 @@ | ||
# General Jupyter contributor guidelines | ||
|
||
If you're reading this section, you're probably interested in | ||
contributing to Jupyter. Welcome and thanks for your interest in | ||
contributing! | ||
|
||
Please take a look at the Contributor documentation, familiarize | ||
yourself with using the Jupyter Server, and introduce yourself on the | ||
mailing list and share what area of the project you are interested in | ||
working on. | ||
|
||
For general documentation about contributing to Jupyter projects, see | ||
the [Project Jupyter Contributor | ||
Documentation](https://jupyter.readthedocs.io/en/latest/contributing/content-contributor.html). | ||
|
||
# Setting Up a Development Environment | ||
|
||
## Installing the Jupyter Server | ||
|
||
The development version of the server requires | ||
[node](https://nodejs.org/en/download/) and | ||
[pip](https://pip.pypa.io/en/stable/installing/). | ||
|
||
Once you have installed the dependencies mentioned above, use the | ||
following steps: | ||
|
||
``` | ||
pip install --upgrade pip | ||
git clone https://github.com/jupyter/jupyter-sphinx | ||
cd jupyter-server | ||
pip install -e ".[test]" | ||
``` | ||
|
||
## Code Styling and Quality Checks | ||
|
||
`jupyter-sphinx` has adopted automatic code formatting so you shouldn't | ||
need to worry too much about your code style. As long as your code is | ||
valid, the pre-commit hook should take care of how it should look. | ||
`pre-commit` and its associated hooks will automatically be installed | ||
when you run `pip install -e ".[test]"` | ||
|
||
To install `pre-commit` hook manually, run the following: | ||
|
||
``` | ||
pre-commit install | ||
``` | ||
|
||
You can invoke the pre-commit hook by hand at any time with: | ||
|
||
``` | ||
pre-commit run | ||
``` | ||
|
||
which should run any autoformatting on your code and tell you about any | ||
errors it couldn't fix automatically. You may also install [black | ||
integration](https://github.com/psf/black#editor-integration) into your | ||
text editor to format code automatically. | ||
|
||
If you have already committed files before setting up the pre-commit | ||
hook with `pre-commit install`, you can fix everything up using | ||
`pre-commit run --all-files`. You need to make the fixing commit | ||
yourself after that. | ||
|
||
Some of the hooks only run on CI by default, but you can invoke them by | ||
running with the `--hook-stage manual` argument. | ||
|
||
There are three hatch scripts that can be run locally as well: | ||
`hatch run lint:build` will enforce styling. | ||
|
||
# Running Tests | ||
|
||
Install dependencies: | ||
|
||
``` | ||
pip install -e .[test] | ||
``` | ||
|
||
To run the Python tests, use: | ||
|
||
``` | ||
pytest | ||
``` | ||
|
||
You can also run the tests using `hatch` without installing test | ||
dependencies in your local environment: | ||
|
||
``` | ||
pip install hatch | ||
hatch run test:test | ||
``` | ||
|
||
The command takes any argument that you can give to `pytest`, e.g.: | ||
|
||
``` | ||
hatch run test:test -k name_of_method_to_test | ||
``` | ||
|
||
You can also drop into a shell in the test environment by running: | ||
|
||
``` | ||
hatch -e test shell | ||
``` | ||
|
||
# Building the Docs | ||
|
||
Install the docs requirements using `pip`: | ||
|
||
``` | ||
pip install .[doc] | ||
``` | ||
|
||
Once you have installed the required packages, you can build the docs | ||
with: | ||
|
||
``` | ||
cd docs | ||
make html | ||
``` | ||
|
||
You can also run the tests using `hatch` without installing test | ||
dependencies in your local environment. | ||
|
||
```bash | ||
pip install hatch | ||
hatch run docs:build | ||
``` | ||
|
||
You can also drop into a shell in the docs environment by running: | ||
|
||
``` | ||
hatch -e docs shell | ||
``` | ||
|
||
After that, the generated HTML files will be available at | ||
`build/html/index.html`. You may view the docs in your browser. | ||
|
||
You should also have a look at the [Project Jupyter Documentation | ||
Guide](https://jupyter.readthedocs.io/en/latest/contributing/content-contributor.html). |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.