Skip to content

Commit be7dc17

Browse files
authored
Update scaffolding (#11)
1 parent a4fcc1d commit be7dc17

19 files changed

+506
-142
lines changed

.github/dependabot.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
version: 2
2+
updates:
3+
# Set update schedule for GitHub Actions
4+
- package-ecosystem: "github-actions"
5+
directory: "/"
6+
schedule:
7+
# Check for updates to GitHub Actions every weekday
8+
interval: "weekly"

.github/workflows/codeql-analysis.yml

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
# For most projects, this workflow file will not need changing; you simply need
2+
# to commit it to your repository.
3+
#
4+
# You may wish to alter this file to override the set of languages analyzed,
5+
# or to provide custom queries or build logic.
6+
#
7+
# ******** NOTE ********
8+
# We have attempted to detect the languages in your repository. Please check
9+
# the `language` matrix defined below to confirm you have the correct set of
10+
# supported CodeQL languages.
11+
# ******** NOTE ********
12+
13+
name: "CodeQL"
14+
15+
on:
16+
push:
17+
branches: [master]
18+
pull_request:
19+
# The branches below must be a subset of the branches above
20+
branches: [master]
21+
schedule:
22+
# Make a pass every Saturday at 06:41 UTC
23+
- cron: "41 6 * * 6"
24+
25+
permissions:
26+
security-events: write
27+
28+
jobs:
29+
analyze:
30+
name: Analyze
31+
runs-on: ubuntu-latest
32+
33+
strategy:
34+
fail-fast: false
35+
matrix:
36+
language: ["python"]
37+
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
38+
# Learn more...
39+
# https://docs.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#overriding-automatic-language-detection
40+
41+
steps:
42+
- name: Checkout repository
43+
uses: actions/checkout@v2
44+
45+
# Initializes the CodeQL tools for scanning.
46+
- name: Initialize CodeQL
47+
uses: github/codeql-action/init@v1
48+
with:
49+
languages: ${{ matrix.language }}
50+
# If you wish to specify custom queries, you can do so here or in a config file.
51+
# By default, queries listed here will override any specified in a config file.
52+
# Prefix the list here with "+" to use these queries and those in the config file.
53+
# queries: ./path/to/local/query, your-org/your-repo/queries@main
54+
queries: security-and-quality
55+
56+
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
57+
# If this step fails, then you should remove it and run the build manually (see below)
58+
- name: Autobuild
59+
uses: github/codeql-action/autobuild@v1
60+
61+
# ℹ️ Command-line programs to run using the OS shell.
62+
# 📚 https://git.io/JvXDl
63+
64+
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
65+
# and modify them (or add more) to build your code if your project
66+
# uses a compiled language
67+
68+
#- run: |
69+
# make bootstrap
70+
# make release
71+
72+
- name: Perform CodeQL Analysis
73+
uses: github/codeql-action/analyze@v1

.github/workflows/test.yml

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
2+
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
3+
4+
name: Python package
5+
6+
on:
7+
push:
8+
pull_request:
9+
schedule:
10+
- cron: "0 8 * * *"
11+
12+
concurrency:
13+
group: >-
14+
${{ github.workflow }}-
15+
${{ github.ref_type }}-
16+
${{ github.event.pull_request.number || github.sha }}
17+
cancel-in-progress: true
18+
19+
jobs:
20+
build:
21+
runs-on: ${{ matrix.os }}
22+
strategy:
23+
fail-fast: false
24+
matrix:
25+
os: [ubuntu-latest, windows-latest, macos-latest]
26+
python-version: ["3.7", "3.10"]
27+
include:
28+
- os: windows-latest
29+
python-version: "3.9"
30+
- os: ubuntu-latest
31+
python-version: "pypy-3.8"
32+
- os: macos-latest
33+
python-version: "3.8"
34+
steps:
35+
- uses: actions/checkout@v2
36+
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
37+
- name: Install dependencies
38+
run: |
39+
pip install -e ".[test]"
40+
- name: Test with pytest
41+
run: |
42+
python -m pytest -vv --timeout 60 --cov jupyter_core --cov-report term-missing:skip-covered
43+
- name: Check CLI
44+
run: |
45+
cd $HOME
46+
jupyter troubleshoot
47+
48+
test_miniumum_versions:
49+
name: Test Minimum Versions
50+
runs-on: ubuntu-latest
51+
timeout-minutes: 10
52+
steps:
53+
- uses: actions/checkout@v2
54+
- name: Base Setup
55+
uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
56+
with:
57+
python_version: "3.7"
58+
- name: Install miniumum versions
59+
uses: jupyterlab/maintainer-tools/.github/actions/install-minimums@v1
60+
- name: Run the unit tests
61+
run: pytest -vv -W default || pytest -vv -W default --lf
62+
63+
test_prereleases:
64+
name: Test Prereleases
65+
timeout-minutes: 10
66+
runs-on: ubuntu-latest
67+
steps:
68+
- name: Checkout
69+
uses: actions/checkout@v2
70+
- name: Base Setup
71+
uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
72+
- name: Install the Python dependencies
73+
run: |
74+
pip install --upgrade --upgrade-strategy eager --pre -e ".[test]"
75+
- name: List installed packages
76+
run: |
77+
pip freeze
78+
pip check
79+
- name: Run the tests
80+
run: |
81+
pytest -vv || pytest -vv --lf
82+
83+
make_sdist:
84+
name: Make SDist
85+
runs-on: ubuntu-latest
86+
timeout-minutes: 10
87+
steps:
88+
- uses: actions/checkout@v2
89+
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
90+
- uses: jupyterlab/maintainer-tools/.github/actions/make-sdist@v1
91+
92+
test_sdist:
93+
runs-on: ubuntu-latest
94+
needs: [make_sdist]
95+
name: Install from SDist and Test
96+
timeout-minutes: 20
97+
steps:
98+
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
99+
- uses: jupyterlab/maintainer-tools/.github/actions/test-sdist@v1
100+
101+
pre-commit:
102+
name: pre-commit
103+
runs-on: ubuntu-latest
104+
steps:
105+
- uses: actions/checkout@v2
106+
- uses: actions/setup-python@v2
107+
- uses: pre-commit/[email protected]
108+
with:
109+
extra_args: --all-files --hook-stage=manual
110+
- name: Help message if pre-commit fail
111+
if: ${{ failure() }}
112+
run: |
113+
echo "You can install pre-commit hooks to automatically run formatting"
114+
echo "on each commit with:"
115+
echo " pre-commit install"
116+
echo "or you can run by hand on staged files with"
117+
echo " pre-commit run"
118+
echo "or after-the-fact on already committed files with"
119+
echo " pre-commit run --all-files --hook-stage=manual"

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,5 +132,5 @@ dmypy.json
132132
# Pyre type checker
133133
.pyre/
134134

135-
#
135+
#
136136
.DS_Store

.pre-commit-config.yaml

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
default_language_version:
2+
node: system
3+
4+
repos:
5+
- repo: https://github.com/pre-commit/pre-commit-hooks
6+
rev: v4.3.0
7+
hooks:
8+
- id: end-of-file-fixer
9+
- id: check-case-conflict
10+
- id: check-executables-have-shebangs
11+
- id: requirements-txt-fixer
12+
- id: check-added-large-files
13+
- id: check-case-conflict
14+
- id: check-toml
15+
- id: check-yaml
16+
- id: debug-statements
17+
- id: forbid-new-submodules
18+
- id: check-builtin-literals
19+
- id: trailing-whitespace
20+
21+
- repo: https://github.com/psf/black
22+
rev: 22.10.0
23+
hooks:
24+
- id: black
25+
args: [--line-length=100]
26+
27+
- repo: https://github.com/PyCQA/isort
28+
rev: 5.10.1
29+
hooks:
30+
- id: isort
31+
files: \.py$
32+
args: [--profile=black]
33+
34+
- repo: https://github.com/pre-commit/mirrors-mypy
35+
rev: v0.991
36+
hooks:
37+
- id: mypy
38+
additional_dependencies: [types-requests]
39+
40+
- repo: https://github.com/abravalheri/validate-pyproject
41+
rev: v0.10.1
42+
hooks:
43+
- id: validate-pyproject
44+
stages: [manual]
45+
46+
- repo: https://github.com/executablebooks/mdformat
47+
rev: 0.7.16
48+
hooks:
49+
- id: mdformat
50+
51+
- repo: https://github.com/asottile/pyupgrade
52+
rev: v3.2.2
53+
hooks:
54+
- id: pyupgrade
55+
args: [--py38-plus]
56+
57+
- repo: https://github.com/PyCQA/doc8
58+
rev: v1.0.0
59+
hooks:
60+
- id: doc8
61+
args: [--max-line-length=200]
62+
stages: [manual]
63+
64+
- repo: https://github.com/john-hen/Flake8-pyproject
65+
rev: 1.2.0
66+
hooks:
67+
- id: Flake8-pyproject
68+
alias: flake8
69+
additional_dependencies:
70+
["flake8-bugbear==22.6.22", "flake8-implicit-str-concat==0.2.0"]
71+
stages: [manual]
72+
73+
- repo: https://github.com/pre-commit/mirrors-eslint
74+
rev: v8.28.0
75+
hooks:
76+
- id: eslint
77+
stages: [manual]
78+
79+
- repo: https://github.com/python-jsonschema/check-jsonschema
80+
rev: 0.19.2
81+
hooks:
82+
- id: check-github-workflows

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,4 +56,4 @@ With this in mind, the following banner should be used in any source code file
5656
to indicate the copyright and license terms:
5757

5858
# Copyright (c) Jupyter Development Team.
59-
# Distributed under the terms of the Modified BSD License.
59+
# Distributed under the terms of the Modified BSD License.

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,31 @@ A set of pytest plugins for Jupyter libraries and extensions.
55
## Basic Usage
66

77
First, install `pytest-jupyter` from PyPI using pip:
8+
89
```bash
910
pip install pytest-jupyter
1011
```
12+
1113
This installs the basic pytest-jupyter package that includes fixture definitions for the various Jupyter-based pytest plugins.
1214

1315
To use one of these plugins, you'll also need to install their dependencies. This requires a second `pip install` call. For example, if you'd like to use the `jupyter_server` plugin, you'll need to call:
16+
1417
```bash
1518
pip install "pytest-jupyter[server]"
1619
```
20+
1721
This *should* install everything you need for the plugin to work.
1822

1923
To use a plugin, add it to the `pytest_plugins` list in the `conftest.py` of your project's root test directory.
24+
2025
```python
2126
# inside the conftest.py
2227

2328
pytest_plugins = ["pytest_jupyter.jupyter_server"]
2429
```
30+
2531
All fixtures inside the plugin (e.g. jupyter_server) will be available to all of your project's unit tests. You can use a fixtures by passing it as an argument to your unit test function:
32+
2633
```python
2734
async def test_jupyter_server_api(jp_fetch):
2835
# Send request to a temporary Jupyter Server Web Application
@@ -33,7 +40,9 @@ async def test_jupyter_server_api(jp_fetch):
3340
```
3441

3542
You can list the fixtures for a given plugin using the `--fixtures` argument from the pytest command line interface:
43+
3644
```bash
3745
pytest --fixtures -p pytest_jupyter.jupyter_server
3846
```
47+
3948
or by calling the `pytest --fixtures` where the plugin is listed in the `pytest_plugins` variable of a given test directory.

RELEASE.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
First, bump the version to final release version.
44

55
Then follow these steps (which expect a Bash shell; they might not work with other shells).
6+
67
```
78
git clean -dffx
89
pip install -q 517
@@ -15,4 +16,4 @@ git push --tags
1516
pip install twine
1617
twine check dist/*
1718
twine upload dist/*
18-
```
19+
```

codecov.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
coverage:
2+
status:
3+
project:
4+
default:
5+
target: auto
6+
threshold: 1
7+
patch:
8+
default:
9+
target: 0%

0 commit comments

Comments
 (0)