Skip to content

Commit e71039a

Browse files
authored
Ruff and 3.11 (#276)
* Ruff and 3.11 Signed-off-by: zethson <[email protected]> * Also support 3.8 Signed-off-by: zethson <[email protected]> --------- Signed-off-by: zethson <[email protected]>
1 parent c316156 commit e71039a

24 files changed

+206
-103
lines changed

.github/workflows/build.yml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
strategy:
1313
fail-fast: false
1414
matrix:
15-
python-version: ["3.8", "3.9", "3.10"]
15+
python-version: ["3.8", "3.11"]
1616

1717
steps:
1818
- name: Checkout main
@@ -26,26 +26,31 @@ jobs:
2626
ssh-key: ${{ secrets.READ_LNDOCS }}
2727
path: lndocs
2828
ref: main
29+
2930
- name: Setup Python
3031
uses: actions/setup-python@v4
3132
with:
3233
python-version: ${{ matrix.python-version }}
3334
cache: "pip"
3435
cache-dependency-path: ".github/workflows/build.yml" # See dependencies below
36+
3537
- name: Cache nox
3638
uses: actions/cache@v3
3739
with:
3840
path: .nox
3941
key: nox-${{ runner.os }}
42+
4043
- name: Cache pre-commit
4144
uses: actions/cache@v3
4245
with:
4346
path: ~/.cache/pre-commit
4447
key: pre-commit-${{ runner.os }}-${{ hashFiles('.pre-commit-config.yaml') }}
48+
4549
- name: Install Python dependencies
4650
run: |
4751
python -m pip install -U pip
4852
pip install -U laminci
53+
4954
- name: Configure AWS
5055
uses: aws-actions/configure-aws-credentials@v2
5156
with:
@@ -54,13 +59,15 @@ jobs:
5459
aws-region: eu-central-1
5560
# - run: nox -s lint
5661
- run: nox -s build
62+
5763
- name: Codecov
58-
if: matrix.python-version == '3.9'
64+
if: matrix.python-version == '3.11'
5965
uses: codecov/codecov-action@v2
6066
with:
6167
token: ${{ secrets.CODECOV_TOKEN }}
68+
6269
- name: Deploy docs
63-
if: matrix.python-version == '3.9'
70+
if: matrix.python-version == '3.11'
6471
id: netlify
6572
uses: nwtgck/[email protected]
6673
with:

.pre-commit-config.yaml

Lines changed: 42 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,56 @@
1+
fail_fast: false
2+
default_language_version:
3+
python: python3
4+
default_stages:
5+
- commit
6+
- push
7+
minimum_pre_commit_version: 2.16.0
18
repos:
2-
- repo: https://github.com/pre-commit/pre-commit-hooks
3-
rev: v3.2.0
9+
- repo: https://github.com/pre-commit/mirrors-prettier
10+
rev: v4.0.0-alpha.4
411
hooks:
5-
- id: trailing-whitespace
6-
- id: end-of-file-fixer
12+
- id: prettier
713
exclude: |
814
(?x)(
9-
.github/workflows/latest-changes.jinja2
15+
docs/changelog.md
1016
)
11-
- id: check-yaml
12-
- id: check-added-large-files
13-
- repo: https://github.com/psf/black
14-
rev: 22.6.0
15-
hooks:
16-
- id: black-jupyter
17-
- repo: https://github.com/pycqa/flake8
18-
rev: 4.0.1
17+
- repo: https://github.com/kynan/nbstripout
18+
rev: 0.6.1
1919
hooks:
20-
- id: flake8
21-
additional_dependencies:
22-
- flake8-black==0.3.3
23-
- flake8-typing-imports==1.10.0
24-
language_version: python3
25-
args:
26-
- --max-line-length=88
27-
- --ignore=E203
20+
- id: nbstripout
2821
exclude: |
2922
(?x)(
30-
__init__.py
23+
docs/examples/|
24+
docs/notes/
3125
)
32-
- repo: https://github.com/pre-commit/mirrors-prettier
33-
rev: v2.6.2
34-
hooks:
35-
- id: prettier
36-
- repo: https://github.com/kynan/nbstripout
37-
rev: 0.3.9
26+
- repo: https://github.com/astral-sh/ruff-pre-commit
27+
rev: v0.1.7
3828
hooks:
39-
- id: nbstripout
40-
- repo: https://github.com/Lucas-C/pre-commit-hooks
41-
rev: v1.1.9
42-
hooks:
43-
- id: forbid-crlf
44-
- id: remove-crlf
45-
- repo: https://github.com/pre-commit/mirrors-isort
46-
rev: v5.8.0
29+
- id: ruff
30+
args: [--fix, --exit-non-zero-on-fix, --unsafe-fixes]
31+
- id: ruff-format
32+
- repo: https://github.com/pre-commit/pre-commit-hooks
33+
rev: v4.5.0
4734
hooks:
48-
- id: isort
49-
args: ["--profile", "black"]
35+
- id: detect-private-key
36+
- id: check-ast
37+
- id: end-of-file-fixer
38+
exclude: |
39+
(?x)(
40+
.github/workflows/latest-changes.jinja2
41+
)
42+
- id: mixed-line-ending
43+
args: [--fix=lf]
44+
- id: trailing-whitespace
45+
- id: check-case-conflict
5046
- repo: https://github.com/pre-commit/mirrors-mypy
51-
rev: v0.940
47+
rev: v1.7.1
5248
hooks:
5349
- id: mypy
54-
- repo: https://github.com/pycqa/pydocstyle
55-
rev: 6.1.1
56-
hooks:
57-
- id: pydocstyle
58-
args: # google style + __init__, see http://www.pydocstyle.org/en/stable/error_codes.html
59-
- --ignore=D100,D101,D102,D103,D105,D107,D203,D204,D213,D215,D400,D401,D404,D406,D407,D408,D409,D413
50+
args: [--no-strict-optional, --ignore-missing-imports]
51+
additional_dependencies:
52+
["types-pkg-resources", "types-requests", "types-attrs"]
53+
exclude: |
54+
(?x)(
55+
test_notebooks.py
56+
)

CITATION.cff

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
11
cff-version: 1.2.0
22
title: "nbproject: Manage Jupyter notebooks"
33
authors:
4-
- family-names: Rybakov
5-
given-names: Sergei
6-
orcid: https://orcid.org/0000-0002-4944-6586
7-
- family-names: Wolf
8-
given-names: Alex
9-
orcid: https://orcid.org/0000-0002-8760-7838
10-
url: https://github.com/laminlabs/nbproject
11-
preferred-citation:
12-
type: article
13-
title: "nbproject: Manage Jupyter notebooks"
14-
authors:
154
- family-names: Rybakov
165
given-names: Sergei
176
orcid: https://orcid.org/0000-0002-4944-6586
18-
- family-names: Heumos
19-
given-names: Lukas
20-
orcid: https://orcid.org/0000-0002-8937-3457
217
- family-names: Wolf
228
given-names: Alex
239
orcid: https://orcid.org/0000-0002-8760-7838
10+
url: https://github.com/laminlabs/nbproject
11+
preferred-citation:
12+
type: article
13+
title: "nbproject: Manage Jupyter notebooks"
14+
authors:
15+
- family-names: Rybakov
16+
given-names: Sergei
17+
orcid: https://orcid.org/0000-0002-4944-6586
18+
- family-names: Heumos
19+
given-names: Lukas
20+
orcid: https://orcid.org/0000-0002-8937-3457
21+
- family-names: Wolf
22+
given-names: Alex
23+
orcid: https://orcid.org/0000-0002-8760-7838
2424
doi: 10.56528/nbp
2525
journal: Lamin Reports
2626
year: 2022

nbproject/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
# trying to init ipylab JupyterFrontEnd can lead to errors on jupyter notebook
3333
try:
3434
_init_frontend()
35-
except:
35+
except: # noqa: E722
3636
pass
3737

3838
from . import dev

nbproject/_cli.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ def sync(
8181
else:
8282
logger.info(f"Yaml of the project is: {yaml_file.as_posix()}.")
8383

84-
with open(yaml_file, "r") as stream:
84+
with open(yaml_file) as stream:
8585
yaml_proj = yaml.load(stream, Loader=yaml.FullLoader)
8686

8787
nbs = notebooks_from_files_dirs(files_dirs)

nbproject/_header.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,9 @@ def header(
105105
try:
106106
nb = read_notebook(filepath) # type: ignore
107107
except FileNotFoundError:
108-
raise RuntimeError("Try passing the filepath manually to nbproject.Header().")
108+
raise RuntimeError(
109+
"Try passing the filepath manually to nbproject.Header()."
110+
) from None
109111

110112
# make time_run available through API
111113
time_run = datetime.now(timezone.utc)

nbproject/_is_run_from_ipython.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# From https://github.com/scverse/scanpy/blob/d7e13025b931ad4afd03b4344ef5ff4a46f78b2b/scanpy/_settings.py # noqa
1+
# From https://github.com/scverse/scanpy/blob/d7e13025b931ad4afd03b4344ef5ff4a46f78b2b/scanpy/_settings.py
22
# Under BSD 3-Clause License
33
# Copyright (c) 2017 F. Alexander Wolf, P. Angerer, Theis Lab
44
import builtins

nbproject/_logger.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
from lamin_utils import colors, logger # noqa
1+
from lamin_utils import colors, logger

nbproject/_meta.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99

1010
# https://stackoverflow.com/questions/128573/using-property-on-classmethods/64738850#64738850
11-
class classproperty(object):
11+
class classproperty:
1212
def __init__(self, fget):
1313
self.fget = fget
1414

nbproject/_publish.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ def publish(
9595
sets the version to the passed version. Consider semantic versioning.
9696
i_confirm_i_saved: Only relevant outside Jupyter Lab as a safeguard against
9797
losing the editor buffer content because of accidentally publishing.
98+
kwargs: Additional arguments for publishing.
9899
"""
99100
if "calling_statement" in kwargs:
100101
calling_statement = kwargs.pop("calling_statement")

0 commit comments

Comments
 (0)