Skip to content

Commit 860d9b8

Browse files
authored
Merge pull request #273 from consideRatio/pr/general-maint
maint: req py36+ and jh 1.5.1+, fix tests, add RELEASE.md, add pre-commit hooks, add dependabot
2 parents 2eb5e94 + a2f2d61 commit 860d9b8

File tree

19 files changed

+442
-361
lines changed

19 files changed

+442
-361
lines changed

.flake8

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
1+
# flake8 is used for linting Python code setup to automatically run with
2+
# pre-commit.
3+
#
4+
# ref: https://flake8.pycqa.org/en/latest/user/configuration.html
5+
#
16
[flake8]
2-
# Ignore style and complexity
37
# E: style errors
48
# W: style warnings
59
# C: complexity
6-
# F401: module imported but unused
7-
# F403: import *
8-
# F811: redefinition of unused `name` from line `N`
9-
# F841: local variable assigned but never used
10-
# E402: module level import not at top of file
11-
# I100: Import statements are in the wrong order
12-
# I101: Imported names are in the wrong order. Should be
13-
ignore = E, W, C, F401, F403, F811, F841, E402, I100, I101, D400
10+
# D: docstring warnings (unused pydocstyle extension)
11+
ignore = E, C, W, D

.github/dependabot.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# dependabot.yaml reference: https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
2+
#
3+
# Notes:
4+
# - Status and logs from dependabot are provided at
5+
# https://github.com/jupyterhub/tmpauthenticator/network/updates.
6+
#
7+
version: 2
8+
updates:
9+
# Maintain dependencies in our GitHub Workflows
10+
- package-ecosystem: github-actions
11+
directory: /
12+
labels: [ci]
13+
schedule:
14+
interval: monthly
15+
time: "05:00"
16+
timezone: Etc/UTC

.github/workflows/test.yaml

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
# This is a GitHub workflow defining a set of jobs with a set of steps.
2+
# ref: https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions
3+
#
4+
name: Test
5+
6+
on:
7+
pull_request:
8+
paths-ignore:
9+
- "**.md"
10+
- ".github/workflows/*.yaml"
11+
- "!.github/workflows/test.yaml"
12+
push:
13+
paths-ignore:
14+
- "**.md"
15+
- ".github/workflows/*.yaml"
16+
- "!.github/workflows/test.yaml"
17+
branches-ignore:
18+
- "dependabot/**"
19+
- "pre-commit-ci-update-config"
20+
tags: ["**"]
21+
workflow_dispatch:
22+
23+
jobs:
24+
pytest:
25+
name: Run pytest
26+
runs-on: ${{ matrix.runs-on || 'ubuntu-22.04' }}
27+
28+
strategy:
29+
fail-fast: false
30+
matrix:
31+
include:
32+
# test oldest supported version
33+
- python-version: "3.6"
34+
pip-install-spec: "jupyterhub==1.5.1 sqlalchemy==1.*"
35+
runs-on: ubuntu-20.04 # python 3.6 is only available in 20.04
36+
37+
- python-version: "3.7"
38+
pip-install-spec: "jupyterhub==2.* sqlalchemy==1.*"
39+
- python-version: "3.8"
40+
pip-install-spec: "jupyterhub==3.*"
41+
- python-version: "3.10"
42+
pip-install-spec: "jupyterhub==4.*"
43+
- python-version: "3.11"
44+
pip-install-spec: "jupyterhub==4.*"
45+
46+
# test unreleased jupyterhub, failures tolerated
47+
- python-version: "3.X"
48+
pip-install-spec: "git+https://github.com/jupyterhub/jupyterhub"
49+
allow-failure: true
50+
51+
steps:
52+
- uses: actions/checkout@v3
53+
- uses: actions/setup-node@v3
54+
with:
55+
node-version: "18"
56+
- uses: actions/setup-python@v4
57+
with:
58+
python-version: "${{ matrix.python-version }}"
59+
60+
- name: Install Node dependencies
61+
run: |
62+
npm install -g configurable-http-proxy
63+
64+
- name: Install Python dependencies
65+
run: |
66+
pip install --upgrade pip
67+
pip install ${{ matrix.pip-install-spec }}
68+
pip install -e ".[test]"
69+
70+
- name: List dependencies
71+
run: |
72+
pip freeze
73+
74+
- name: pytest
75+
run: |
76+
pytest
77+
78+
# GitHub action reference: https://github.com/codecov/codecov-action
79+
- uses: codecov/codecov-action@v3

.github/workflows/test.yml

Lines changed: 0 additions & 88 deletions
This file was deleted.

.pre-commit-config.yaml

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,34 @@
99
# - Register git hooks: pre-commit install --install-hooks
1010
#
1111
repos:
12+
# Autoformat: Python code, syntax patterns are modernized
13+
- repo: https://github.com/asottile/pyupgrade
14+
rev: v3.3.2
15+
hooks:
16+
- id: pyupgrade
17+
args:
18+
- --py38-plus
19+
20+
# Autoformat: Python code
21+
- repo: https://github.com/PyCQA/autoflake
22+
rev: v2.1.1
23+
hooks:
24+
- id: autoflake
25+
# args ref: https://github.com/PyCQA/autoflake#advanced-usage
26+
args:
27+
- --in-place
28+
29+
# Autoformat: Python code
30+
- repo: https://github.com/pycqa/isort
31+
rev: 5.12.0
32+
hooks:
33+
- id: isort
34+
1235
# Autoformat: Python code
1336
- repo: https://github.com/psf/black
1437
rev: "23.9.1"
1538
hooks:
1639
- id: black
17-
args:
18-
- --target-version=py36
19-
- --target-version=py37
20-
- --target-version=py38
21-
- --target-version=py39
22-
- --target-version=py310
23-
- --target-version=py311
2440

2541
# Autoformat: markdown, yaml
2642
- repo: https://github.com/pre-commit/mirrors-prettier

MANIFEST.in

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,2 @@
11
include *.md
22
include LICENSE
3-
include version.py
4-
include requirements.txt

README.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
# batchspawner for Jupyterhub
22

3-
[![GitHub Workflow Status - Test](https://img.shields.io/github/workflow/status/jupyterhub/batchspawner/Test?logo=github&label=tests)](https://github.com/jupyterhub/batchspawner/actions)
4-
[![Latest PyPI version](https://img.shields.io/pypi/v/batchspawner?logo=pypi&logoColor=white)](https://pypi.python.org/pypi/batchspawner)
5-
[![GitHub](https://img.shields.io/badge/issue_tracking-github-blue?logo=github)](https://github.com/jupyterhub/batchspawner/issues)
6-
[![Discourse](https://img.shields.io/badge/help_forum-discourse-blue?logo=discourse)](https://discourse.jupyter.org/c/jupyterhub)
7-
[![Gitter](https://img.shields.io/badge/social_chat-gitter-blue?logo=gitter)](https://gitter.im/jupyterhub/jupyterhub)
3+
[![Latest PyPI version](https://img.shields.io/pypi/v/batchspawner?logo=pypi)](https://pypi.python.org/pypi/batchspawner)
4+
[![Latest conda-forge version](https://img.shields.io/conda/vn/conda-forge/batchspawner?logo=conda-forge)](https://anaconda.org/conda-forge/batchspawner)
5+
[![GitHub Workflow Status - Test](https://img.shields.io/github/actions/workflow/status/jupyterhub/batchspawner/test.yaml?logo=github&label=tests)](https://github.com/jupyterhub/batchspawner/actions)
6+
[![Test coverage of code](https://codecov.io/gh/jupyterhub/batchspawner/branch/main/graph/badge.svg)](https://codecov.io/gh/jupyterhub/batchspawner)
7+
[![Issue tracking - GitHub](https://img.shields.io/badge/issue_tracking-github-blue?logo=github)](https://github.com/jupyterhub/batchspawner/issues)
8+
[![Help forum - Discourse](https://img.shields.io/badge/help_forum-discourse-blue?logo=discourse)](https://discourse.jupyter.org/c/jupyterhub)
89
[![Contribute](https://img.shields.io/badge/I_want_to_contribute!-grey?logo=jupyter)](https://github.com/jupyterhub/batchspawner/blob/master/CONTRIBUTING.md)
910

1011
This is a custom spawner for [Jupyterhub](https://jupyterhub.readthedocs.io/) that is designed for installations on clusters using batch scheduling software.

RELEASE.md

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# How to make a release
2+
3+
`batchspawner` is a package available on [PyPI] and on [conda-forge].
4+
5+
These are the instructions on how to make a release.
6+
7+
## Pre-requisites
8+
9+
- Push rights to this GitHub repository
10+
11+
## Steps to make a release
12+
13+
1. Create a PR updating `CHANGELOG.md` with [github-activity] and continue when
14+
its merged.
15+
16+
Advice on this procedure can be found in [this team compass
17+
issue](https://github.com/jupyterhub/team-compass/issues/563).
18+
19+
2. Checkout main and make sure it is up to date.
20+
21+
```shell
22+
git checkout main
23+
git fetch origin main
24+
git reset --hard origin/main
25+
```
26+
27+
3. Update the version, make commits, and push a git tag with `tbump`.
28+
29+
```shell
30+
pip install tbump
31+
```
32+
33+
`tbump` will ask for confirmation before doing anything.
34+
35+
```shell
36+
# Example versions to set: 1.0.0, 1.0.0b1
37+
VERSION=
38+
tbump ${VERSION}
39+
```
40+
41+
Following this, the [CI system] will build and publish a release.
42+
43+
4. Reset the version back to dev, e.g. `1.0.1.dev` after releasing `1.0.0`.
44+
45+
```shell
46+
# Example version to set: 1.0.1.dev
47+
NEXT_VERSION=
48+
tbump --no-tag ${NEXT_VERSION}.dev
49+
```
50+
51+
5. Following the release to PyPI, an automated PR should arrive within 24 hours
52+
to [conda-forge/batchspawner-feedstock] with instructions on releasing to
53+
conda-forge. You are welcome to volunteer doing this, but aren't required as
54+
part of making this release to PyPI.
55+
56+
[github-activity]: https://github.com/executablebooks/github-activity
57+
[pypi]: https://pypi.org/project/batchspawner/
58+
[ci system]: https://github.com/jupyterhub/batchspawner/actions/workflows/release.yaml
59+
[conda-forge]: https://anaconda.org/conda-forge/batchspawner
60+
[conda-forge/batchspawner-feedstock]: https://github.com/conda-forge/batchspawner-feedstock

batchspawner/__init__.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1-
from .batchspawner import *
2-
from . import api
1+
from . import api # noqa
2+
from ._version import __version__, version_info # noqa
3+
from .batchspawner import * # noqa

batchspawner/_version.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# __version__ should be updated using tbump, based on configuration in
2+
# pyproject.toml, according to instructions in RELEASE.md.
3+
#
4+
__version__ = "1.3.0.dev"
5+
6+
# version_info looks like (1, 2, 3, "dev") if __version__ is 1.2.3.dev
7+
version_info = tuple(int(p) if p.isdigit() else p for p in __version__.split("."))

0 commit comments

Comments
 (0)