Skip to content

Commit ab78255

Browse files
adamgayosopre-commit-ci[bot]Martin Kim
authored
Precommit updates (scverse#1724)
* update pre commit config * update flake8 config * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * update precommit * add more flake8 * add more flake8 * remove unused func and use private * Flake 8 * fix import * more ignore * more ignore * flake8 * flake8 * flake 8 * docs * remove D101, D102, E266, static code checks * All done locally * hopefully final * Static code checks * static * codacy why Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Martin Kim <[email protected]>
1 parent 7f3f108 commit ab78255

File tree

173 files changed

+5178
-4828
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

173 files changed

+5178
-4828
lines changed

.flake8

+59-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,61 @@
11
[flake8]
2-
ignore = E203, E266, E501, W503, W605, N812
3-
exclude = .git,docs
42
max-line-length = 119
5-
3+
ignore =
4+
# Unnecessary dict call - rewrite as a literal.
5+
C408
6+
# line break before a binary operator -> black does not adhere to PEP8
7+
W503
8+
# line break occured after a binary operator -> black does not adhere to PEP8
9+
W504
10+
# line too long -> we accept long comment lines; black gets rid of long code lines
11+
E501
12+
# whitespace before : -> black does not adhere to PEP8
13+
E203
14+
# missing whitespace after ,', ';', or ':' -> black does not adhere to PEP8
15+
E231
16+
# continuation line over-indented for hanging indent -> black does not adhere to PEP8
17+
E126
18+
# too many leading '#' for block comment -> this is fine for indicating sections
19+
E262
20+
# Do not assign a lambda expression, use a def -> lambda expression assignments are convenient
21+
E731
22+
# allow I, O, l as variable names -> I is the identity matrix
23+
E741
24+
# Missing docstring in public package
25+
D104
26+
# Missing docstring in public module
27+
D100
28+
# Missing docstring in __init__
29+
D107
30+
# Missing docstring in magic method
31+
D105
32+
# format string does contain unindexed parameters
33+
P101
34+
# first line should end with a period [Bug: doesn't work with single-line docstrings]
35+
D400
36+
# First line should be in imperative mood; try rephrasing
37+
D401
38+
exclude = .git,__pycache__,build,docs/_build,dist
39+
per-file-ignores =
40+
tests/*: D
41+
*/__init__.py: F401
42+
extend-immutable-calls =
43+
# Add functions returning immutable values here to avoid B008
44+
pathlib.Path
45+
Path
46+
rst-roles =
47+
class,
48+
func,
49+
ref,
50+
meth,
51+
doc,
52+
py:class,
53+
method,
54+
attr,
55+
rst-directives =
56+
envvar,
57+
exception,
58+
rst-substitutions =
59+
version,
60+
extend-ignore =
61+
RST307,RST210,RST201,RST203,RST301,RST306 # TODO(martinkim0): Address 306 in new issue

.github/ISSUE_TEMPLATE/bug_report.md

+9-5
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,31 @@
11
---
22
name: Bug report
33
about: Create a report to help us improve
4-
title: ''
4+
title: ""
55
labels: bug
6-
assignees: ''
7-
6+
assignees: ""
87
---
98

109
<!-- Describe the bug -->
10+
1111
[TEXT HERE]
1212

1313
<!-- To reproduce -->
14+
1415
```python
15-
[CODE HERE]
16+
# Your code here
1617
```
1718

1819
<!-- Put your Error output in this code block (if applicable, else delete the block): -->
20+
1921
```pytb
20-
[ERROR HERE]
22+
[Paste the error output produced by the above code here]
2123
```
2224

2325
#### Versions:
26+
2427
<!-- Output of scvi.__version__ -->
28+
2529
> VERSION
2630
2731
<!-- Relevant screenshots -->

.github/ISSUE_TEMPLATE/config.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
contact_links:
2-
- name: Usage question
3-
url: https://discourse.scvi-tools.org/
4-
about: Please ask and answer non-development questions at https://discourse.scvi-tools.org/.
2+
- name: Usage question
3+
url: https://discourse.scvi-tools.org/
4+
about: Please ask and answer non-development questions at https://discourse.scvi-tools.org/.

.github/ISSUE_TEMPLATE/feature_request.md

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
---
22
name: Feature request
33
about: Suggest an idea for this project
4-
title: ''
4+
title: ""
55
labels: enhancement
6-
assignees: ''
7-
6+
assignees: ""
87
---
98

109
**Is your feature request related to a problem? Please describe.**

.github/workflows/release.yml

+29-29
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,39 @@
11
name: Release
22

33
on:
4-
push:
5-
tags:
6-
- '*.*.*'
4+
push:
5+
tags:
6+
- "*.*.*"
77

88
jobs:
9-
release:
10-
name: Release
11-
runs-on: ubuntu-latest
12-
steps:
13-
# will use ref/SHA that triggered it
14-
- name: Checkout code
15-
uses: actions/checkout@v3
9+
release:
10+
name: Release
11+
runs-on: ubuntu-latest
12+
steps:
13+
# will use ref/SHA that triggered it
14+
- name: Checkout code
15+
uses: actions/checkout@v3
1616

17-
- name: Set up Python 3.9
18-
uses: actions/setup-python@v2
19-
with:
20-
python-version: "3.9"
17+
- name: Set up Python 3.9
18+
uses: actions/setup-python@v2
19+
with:
20+
python-version: "3.9"
2121

22-
- name: Install poetry
23-
uses: abatilo/[email protected]
24-
with:
25-
poetry-version: 1.1.11
22+
- name: Install poetry
23+
uses: abatilo/[email protected]
24+
with:
25+
poetry-version: 1.1.11
2626

27-
- name: Build project for distribution
28-
run: poetry build
27+
- name: Build project for distribution
28+
run: poetry build
2929

30-
- name: Check Version
31-
id: check-version
32-
run: |
33-
[[ "$(poetry version --short)" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] \
34-
|| echo ::set-output name=prerelease::true
30+
- name: Check Version
31+
id: check-version
32+
run: |
33+
[[ "$(poetry version --short)" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] \
34+
|| echo ::set-output name=prerelease::true
3535
36-
- name: Publish to PyPI
37-
env:
38-
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_TOKEN }}
39-
run: poetry publish
36+
- name: Publish to PyPI
37+
env:
38+
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_TOKEN }}
39+
run: poetry publish

.github/workflows/test.yml

+56-56
Original file line numberDiff line numberDiff line change
@@ -4,71 +4,71 @@
44
name: scvi-tools
55

66
on:
7-
push:
8-
branches: [master, 0.15.x, 0.16.x, 0.17.x, 0.18.x]
9-
pull_request:
10-
branches: [master, 0.15.x, 0.16.x, 0.17.x, 0.18.x]
7+
push:
8+
branches: [master, 0.15.x, 0.16.x, 0.17.x, 0.18.x]
9+
pull_request:
10+
branches: [master, 0.15.x, 0.16.x, 0.17.x, 0.18.x]
1111

1212
jobs:
13-
build:
14-
runs-on: ubuntu-latest
15-
timeout-minutes: 20
16-
strategy:
17-
matrix:
18-
python-version: ["3.7", "3.8", "3.9", "3.10"]
13+
build:
14+
runs-on: ubuntu-latest
15+
timeout-minutes: 20
16+
strategy:
17+
matrix:
18+
python-version: ["3.7", "3.8", "3.9", "3.10"]
1919

20-
steps:
21-
- uses: actions/checkout@v2
20+
steps:
21+
- uses: actions/checkout@v2
2222

23-
- name: Set up Python ${{ matrix.python-version }}
24-
uses: actions/setup-python@v2
25-
with:
26-
python-version: ${{ matrix.python-version }}
23+
- name: Set up Python ${{ matrix.python-version }}
24+
uses: actions/setup-python@v2
25+
with:
26+
python-version: ${{ matrix.python-version }}
2727

28-
- name: Cache pip
29-
uses: actions/cache@v2
30-
with:
31-
path: ~/.cache/pip
32-
key: ${{ runner.os }}-pip-v1-${{ hashFiles('**/requirements.txt') }}
33-
restore-keys: |
34-
${{ runner.os }}-pip-v1-
28+
- name: Cache pip
29+
uses: actions/cache@v2
30+
with:
31+
path: ~/.cache/pip
32+
key: ${{ runner.os }}-pip-v1-${{ hashFiles('**/requirements.txt') }}
33+
restore-keys: |
34+
${{ runner.os }}-pip-v1-
3535
36-
- name: Install dependencies
37-
id: dependencies
38-
run: |
39-
pip install pytest-cov
40-
pip install .[dev,pymde]
36+
- name: Install dependencies
37+
id: dependencies
38+
run: |
39+
pip install pytest-cov
40+
pip install .[dev,pymde]
4141
42-
# Following checks are independent and are run even if one fails
43-
- name: Lint with flake8
44-
run: |
45-
flake8
46-
if: ${{ steps.dependencies.outcome == 'success' && always() }}
42+
# Following checks are independent and are run even if one fails
43+
- name: Lint with flake8
44+
run: |
45+
flake8
46+
if: ${{ steps.dependencies.outcome == 'success' && always() }}
4747

48-
- name: Format with black
49-
run: |
50-
black --check .
51-
if: ${{ steps.dependencies.outcome == 'success' && always() }}
48+
- name: Format with black
49+
run: |
50+
black --check .
51+
if: ${{ steps.dependencies.outcome == 'success' && always() }}
5252

53-
- name: Import sort
54-
run: |
55-
isort --check-only .
56-
if: ${{ steps.dependencies.outcome == 'success' && always() }}
53+
- name: Import sort
54+
run: |
55+
isort --check-only .
56+
if: ${{ steps.dependencies.outcome == 'success' && always() }}
5757

58-
- name: Test with pytest
59-
run: |
60-
pytest --cov-report=xml --cov=scvi --internet-tests --color=yes
61-
if: ${{ steps.dependencies.outcome == 'success' && always() }}
62-
# --------------------------------------------------------------
58+
- name: Test with pytest
59+
run: |
60+
pytest --cov-report=xml --cov=scvi --internet-tests --color=yes
61+
if: ${{ steps.dependencies.outcome == 'success' && always() }}
62+
# --------------------------------------------------------------
6363

64-
- name: After success
65-
run: |
66-
codecov
67-
pip list
64+
- name: After success
65+
run: |
66+
codecov
67+
pip list
6868
69-
- name: Codacy upload
70-
env:
71-
CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }}
72-
run: |
73-
bash <(curl -Ls https://coverage.codacy.com/get.sh) report -l Python -r coverage.xml
74-
continue-on-error: true
69+
- name: Codacy upload
70+
env:
71+
CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }}
72+
run: |
73+
bash <(curl -Ls https://coverage.codacy.com/get.sh) report -l Python -r coverage.xml
74+
continue-on-error: true

.pre-commit-config.yaml

+61-6
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,70 @@
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:
29
- repo: https://github.com/psf/black
3-
rev: 22.8.0
10+
rev: 22.10.0
411
hooks:
512
- id: black
13+
- repo: https://github.com/pre-commit/mirrors-prettier
14+
rev: v3.0.0-alpha.0
15+
hooks:
16+
- id: prettier
17+
- repo: https://github.com/asottile/blacken-docs
18+
rev: v1.12.1
19+
hooks:
20+
- id: blacken-docs
21+
- repo: https://github.com/PyCQA/isort
22+
rev: 5.10.1
23+
hooks:
24+
- id: isort
25+
- repo: https://github.com/asottile/yesqa
26+
rev: v1.4.0
27+
hooks:
28+
- id: yesqa
29+
additional_dependencies:
30+
- flake8-tidy-imports
31+
- flake8-docstrings
32+
- flake8-rst-docstrings
33+
- flake8-comprehensions
34+
- flake8-bugbear
35+
- flake8-blind-except
36+
- repo: https://github.com/pre-commit/pre-commit-hooks
37+
rev: v4.3.0
38+
hooks:
39+
- id: detect-private-key
40+
- id: check-ast
41+
- id: end-of-file-fixer
42+
- id: mixed-line-ending
43+
args: [--fix=lf]
44+
- id: trailing-whitespace
45+
- id: check-case-conflict
46+
- repo: https://github.com/myint/autoflake
47+
rev: v1.7.0
48+
hooks:
49+
- id: autoflake
50+
args:
51+
- --in-place
52+
- --remove-all-unused-imports
53+
- --remove-unused-variable
54+
- --ignore-init-module-imports
655
- repo: https://github.com/PyCQA/flake8
756
rev: 5.0.4
857
hooks:
958
- id: flake8
10-
- repo: https://github.com/pycqa/isort
11-
rev: 5.10.1
59+
additional_dependencies:
60+
- flake8-tidy-imports
61+
- flake8-docstrings
62+
- flake8-rst-docstrings
63+
- flake8-comprehensions
64+
- flake8-bugbear
65+
- flake8-blind-except
66+
- repo: https://github.com/asottile/pyupgrade
67+
rev: v3.0.0
1268
hooks:
13-
- id: isort
14-
name: isort (python)
15-
additional_dependencies: [toml]
69+
- id: pyupgrade
70+
args: [--py3-plus, --py38-plus, --keep-runtime-typing]

0 commit comments

Comments
 (0)