Skip to content

Commit e4446b1

Browse files
authored
Restyle with ruff (#190)
1 parent abf61e4 commit e4446b1

34 files changed

+2816
-4888
lines changed

.circleci/config.yml

Lines changed: 46 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,35 +4,59 @@ version: 2.1
44

55
.dockersetup: &dockersetup
66
docker:
7-
- image: pennlinc/babs_tests:datalad0.17.2_v5
8-
9-
# TODO:
10-
# runinstall: &runinstall
11-
# name: Install BABS
12-
# TODO: build; build_docs; see QSIPrep
13-
# TODO: add tests from flake8
7+
- image: pennlinc/babs_testing:0.3
148

159
jobs:
16-
pytest: # run pytest
10+
download_test_data:
11+
<<: *dockersetup
12+
resource_class: medium
13+
working_directory: /home/circleci/src/babs
14+
steps:
15+
- checkout:
16+
path: /home/circleci/src/babs
17+
- restore_cache:
18+
keys:
19+
- test-data-v1
20+
- run:
21+
name: Download test datasets
22+
command: |
23+
mkdir -p /home/circleci/test_data
24+
cd /home/circleci/test_data
25+
# Install datalad if not already in the image
26+
pip install datalad-osf
27+
# Download each dataset from origin_input_dataset.yaml
28+
python3 /home/circleci/src/babs/tests/download_datasets.py
29+
# Debug output
30+
echo "Contents of test_data directory:"
31+
ls -la /home/circleci/test_data/
32+
- save_cache:
33+
key: test-data-v1
34+
paths:
35+
- /home/circleci/test_data
36+
37+
pytest: # run pytest
1738
<<: *dockersetup
1839
resource_class: xlarge
1940
working_directory: /home/circleci/src/babs
2041
steps:
2142
- checkout:
2243
path: /home/circleci/src/babs
44+
- restore_cache:
45+
keys:
46+
- test-data-v1
2347
- run:
2448
name: pytest of BABS
2549
no_output_timeout: 1h
2650
command: |
2751
pip install .[tests]
28-
pytest -n 6 -sv
29-
30-
deployable: # checkpoint of deployable: requires all success
52+
pytest -n 4 -sv --durations=0 --timeout=300 --log-cli-level=DEBUG
53+
54+
deployable: # checkpoint of deployable: requires all success
3155
<<: *dockersetup
3256
steps:
3357
- run: echo Deploying!
3458

35-
deploy_pypi: # deploy to pypi
59+
deploy_pypi: # deploy to pypi
3660
<<: *dockersetup
3761
working_directory: /tmp/src/babs
3862
steps:
@@ -49,31 +73,32 @@ jobs:
4973
python3 -m twine upload dist/*
5074
# NOTE: if want to test with test pypi, add `--repository testpypi` after `twine upload`
5175

52-
5376
workflows:
5477
# version: 2
5578
build_test_deploy:
5679
jobs:
57-
# - build
58-
# - build_docs
80+
- download_test_data:
81+
filters:
82+
tags:
83+
only: /.*/
5984
- pytest:
60-
# requires:
61-
# - build
85+
requires:
86+
- download_test_data
6287
filters:
6388
tags:
64-
only: /.*/ # i.e., all branches and tags
89+
only: /.*/
6590
- deployable:
66-
requires: # should require all jobs' success before deploying
91+
requires:
6792
- pytest
68-
filters: # run when main branch + any tags
93+
filters:
6994
branches:
7095
only: main
7196
tags:
7297
only: /.*/
7398
- deploy_pypi:
7499
requires:
75100
- deployable
76-
filters: # runs for no branches but runs for any tags
101+
filters:
77102
branches:
78103
ignore: /.*/
79104
tags:

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
babs/_version.py export-subst

.github/workflows/e2e-slurm.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
---
22
name: Slurm
33

4-
on: [push]
4+
# Temporarily disabled
5+
on:
6+
push:
7+
branches-ignore:
8+
- '**' # This prevents the workflow from running on any branch
9+
510
jobs:
611
e2e-slurm:
712
name: Test e2e with SLURM

.github/workflows/ruff.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Ruff
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
ruff:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v4
10+
- name: Set up Python
11+
uses: actions/setup-python@v5
12+
with:
13+
python-version: '3.10'
14+
cache: 'pip'
15+
- name: Install dependencies
16+
run: |
17+
python -m pip install --upgrade pip
18+
pip install ruff
19+
- name: Run Ruff
20+
run: |
21+
ruff check .
22+
ruff format --check .

.github/workflows/shellcheck.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
- uses: actions/checkout@v4
1717
- name: Run shellcheck
1818
run: |
19-
shellcheck \
19+
shellcheck -x \
2020
tests/e2e-slurm/container/babs-user-script.sh \
2121
tests/e2e-slurm/container/ensure-env.sh \
2222
tests/e2e-slurm/container/walkthrough-tests.sh \

.gitignore

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,103 @@ __pycache__/*
44
BABS.egg-info/*
55
babs.egg-info/*
66

7+
babs/_version.py
8+
9+
# Byte-compiled / optimized / DLL files
10+
__pycache__/
11+
*.py[cod]
12+
*$py.class
13+
.pytest_cache/
14+
15+
# C extensions
16+
*.so
17+
*.c
18+
19+
# Distribution / packaging
20+
.Python
21+
env/
22+
# build/ # commented due to some strangeness with Docker/circle setup
23+
develop-eggs/
24+
dist/
25+
build/lib*
26+
build/temp*
27+
downloads/
28+
eggs/
29+
.eggs/
30+
lib/
31+
lib64/
32+
parts/
33+
sdist/
34+
var/
35+
*.egg-info/
36+
.installed.cfg
37+
*.egg
38+
39+
# PyInstaller
40+
# Usually these files are written by a python script from a template
41+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
42+
*.manifest
43+
*.spec
44+
45+
# Installer logs
46+
pip-log.txt
47+
pip-delete-this-directory.txt
48+
pip-wheel-metadata/
49+
50+
# PyBuilder
51+
target/
52+
53+
#Ipython Notebook
54+
.ipynb_checkpoints
55+
56+
# pycharm project settings
57+
.idea
58+
59+
# vscode project settings
60+
.vscode
61+
62+
# Spyder project settings
63+
.spyderproject
64+
.spyproject
65+
66+
auth/
67+
secrets.py
68+
local_settings.py
69+
70+
*.swp
71+
72+
*.DS_Store
73+
74+
scratch/
75+
.Rproj.user
76+
77+
Installer logs
78+
pip-log.txt
79+
pip-delete-this-directory.txt
80+
pip-wheel-metadata/
81+
82+
# Unit test / coverage reports
83+
htmlcov/
84+
.tox/
85+
.coverage
86+
.coverage.*
87+
.cache
88+
nosetests.xml
89+
coverage.xml
90+
*,cover
91+
.hypothesis/
92+
93+
# Translations
94+
*.mo
95+
*.pot
96+
97+
# Django stuff:
98+
*.log
99+
100+
# Sphinx documentation
101+
docs/_build/
102+
build/
103+
7104
# Sphinx documentation
8105
docs/build
9106
docs/source/generated

.readthedocs.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@ version: 2
33
build:
44
os: ubuntu-22.04
55
tools:
6-
python: "3.8"
6+
python: "3.10"
77

88
sphinx:
9-
configuration: docs/source/conf.py
9+
configuration: docs/conf.py
1010

1111
python:
1212
install:
1313
- method: pip
1414
path: .
1515
extra_requirements:
16-
- doc
16+
- doc

.vscode/launch.json

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

.vscode/settings.json

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,21 @@
33
"./babs"
44
],
55
"python.linting.enabled": true,
6-
"python.linting.flake8Enabled": true,
6+
"python.linting.pylintEnabled": false,
7+
"python.linting.flake8Enabled": false,
8+
"python.linting.pycodestyleEnabled": false,
79
"python.linting.lintOnSave": true,
810
"python.analysis.autoImportCompletions": false,
9-
"esbonio.sphinx.confDir": ""
11+
"esbonio.sphinx.confDir": "",
12+
"makefile.configureOnOpen": false,
13+
"python.analysis.typeCheckingMode": "off",
14+
"editor.formatOnSave": true,
15+
"[python]": {
16+
"editor.defaultFormatter": "charliermarsh.ruff",
17+
"editor.formatOnSave": true,
18+
"editor.codeActionsOnSave": {
19+
"source.fixAll": "explicit",
20+
"source.organizeImports": "explicit"
21+
}
22+
}
1023
}

0 commit comments

Comments
 (0)