Skip to content

Commit b78ef22

Browse files
authored
fixing the pre-commit (#95)
* fixing the pre-commit * changing names to actions. * updating the pre-commit version. * fixing pre-commit * fixing some additional pre-commit
1 parent c32816a commit b78ef22

Some content is hidden

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

41 files changed

+1829
-1302
lines changed

.github/workflows/ci.yml

Lines changed: 7 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,7 @@ jobs:
99
timeout-minutes: 30
1010
strategy:
1111
matrix:
12-
python-version: ["3.10"]
13-
aiida-version: ["stable"]
14-
12+
python-version: ['3.11', '3.12', '3.13']
1513
services:
1614
postgres:
1715
image: postgres:10
@@ -25,45 +23,27 @@ jobs:
2523
--health-timeout 5s
2624
--health-retries 5
2725
ports:
28-
- 5432:5432
26+
- 5432:5432
2927
rabbitmq:
3028
image: rabbitmq:latest
3129
ports:
32-
- 5672:5672
30+
- 5672:5672
3331

3432
steps:
35-
- uses: actions/checkout@v2
33+
- uses: actions/checkout@v4
3634

3735
- name: Set up Python ${{ matrix.python-version }}
38-
uses: actions/setup-python@v2
36+
uses: actions/setup-python@v5
3937
with:
4038
python-version: ${{ matrix.python-version }}
4139

4240
- name: Install python dependencies
4341
run: |
4442
pip install --upgrade pip
45-
pip install -e .[testing]
43+
pip install -e .[run,testing]
4644
4745
- name: Run test suite
4846
env:
4947
# show timings of tests
50-
PYTEST_ADDOPTS: "--durations=0"
48+
PYTEST_ADDOPTS: --durations=0
5149
run: pytest --cov aiida_atomistic --cov-append .
52-
53-
pre-commit:
54-
runs-on: ubuntu-latest
55-
timeout-minutes: 15
56-
steps:
57-
- uses: actions/checkout@v2
58-
- name: Set up Python 3.8
59-
uses: actions/setup-python@v2
60-
with:
61-
python-version: "3.8"
62-
- name: Install python dependencies
63-
run: |
64-
pip install --upgrade pip
65-
pip install -e .[pre-commit,docs,testing]
66-
- name: Run pre-commit
67-
run: |
68-
pre-commit install
69-
pre-commit run --all-files || ( git status --short ; git diff ; exit 1 )

.github/workflows/deploy.yml

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: aiida-atomistic GitHub Pages Deploy
1+
name: gh-pages-deploy
22
on:
33
push:
44
branches: [main, develop, mkdocs]
@@ -11,7 +11,7 @@ permissions:
1111

1212
# Allow only one concurrent deployment; do NOT cancel in-progress runs.
1313
concurrency:
14-
group: 'pages'
14+
group: pages
1515
cancel-in-progress: false
1616

1717
jobs:
@@ -21,24 +21,24 @@ jobs:
2121
url: ${{ steps.deployment.outputs.page_url }}
2222
runs-on: ubuntu-latest
2323
steps:
24-
- uses: actions/checkout@v4
25-
with:
26-
fetch-depth: 0 # required by git-revision-date-localized
27-
- name: Setup Pages
28-
uses: actions/configure-pages@v4
29-
- uses: actions/setup-python@v5
30-
with:
31-
python-version: '3.11'
32-
- name: Install dependencies
33-
run: |
34-
python -m pip install --upgrade pip
35-
pip install -e .[docs]
36-
- name: Build MkDocs documentation
37-
run: mkdocs build --site-dir ./build
38-
- name: Upload artifact
39-
uses: actions/upload-pages-artifact@v3
40-
with:
41-
path: './build'
24+
- uses: actions/checkout@v4
25+
with:
26+
fetch-depth: 0 # required by git-revision-date-localized
27+
- name: Setup Pages
28+
uses: actions/configure-pages@v4
29+
- uses: actions/setup-python@v5
30+
with:
31+
python-version: '3.11'
32+
- name: Install dependencies
33+
run: |
34+
python -m pip install --upgrade pip
35+
pip install -e .[docs]
36+
- name: Build MkDocs documentation
37+
run: mkdocs build --site-dir ./build
38+
- name: Upload artifact
39+
uses: actions/upload-pages-artifact@v3
40+
with:
41+
path: ./build
4242

4343
deploy:
4444
environment:
@@ -47,6 +47,6 @@ jobs:
4747
runs-on: ubuntu-latest
4848
needs: build
4949
steps:
50-
- name: Deploy to GitHub Pages
51-
id: deployment
52-
uses: actions/deploy-pages@v4
50+
- name: Deploy to GitHub Pages
51+
id: deployment
52+
uses: actions/deploy-pages@v4

.github/workflows/precommit.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: pre-commit
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
7+
pre-commit:
8+
runs-on: ubuntu-latest
9+
timeout-minutes: 15
10+
steps:
11+
- uses: actions/checkout@v4
12+
- name: Set up Python
13+
uses: actions/setup-python@v5
14+
with:
15+
python-version: '3.12'
16+
- name: Install python dependencies
17+
run: |
18+
pip install --upgrade pip
19+
pip install -e .[pre-commit]
20+
- name: Run pre-commit
21+
run: |
22+
pre-commit clean
23+
git add .pre-commit-config.yaml
24+
pre-commit install
25+
pre-commit run --all-files || ( git status --short ; git diff ; exit 1 )

.github/workflows/publish-on-pypi.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
name: Publish on PyPI
1+
name: pypi-publish
22

33
on:
44
push:
55
tags:
66
# After vMajor.Minor.Patch _anything_ is allowed (without "/") !
7-
- v[0-9]+.[0-9]+.[0-9]+*
7+
- v[0-9]+.[0-9]+.[0-9]+*
88

99
jobs:
1010
publish:
@@ -30,4 +30,4 @@ jobs:
3030
flit publish
3131
env:
3232
FLIT_USERNAME: __token__
33-
FLIT_PASSWORD: ${{ secrets.pypi_token }}
33+
FLIT_PASSWORD: ${{ secrets.pypi_token }}

.pre-commit-config.yaml

Lines changed: 45 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,46 @@
11
repos:
2-
- repo: https://github.com/pre-commit/pre-commit-hooks
3-
rev: v3.2.0
4-
hooks:
5-
- id: trailing-whitespace
6-
- id: end-of-file-fixer
7-
- id: check-yaml
8-
- id: check-added-large-files
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v5.0.0
4+
hooks:
5+
- id: check-merge-conflict
6+
- id: check-added-large-files
7+
exclude: uv.lock
8+
- id: check-yaml
9+
- id: end-of-file-fixer
10+
exclude: &exclude_pre_commit_hooks >
11+
(?x)^(
12+
tests/.*(?<!\.py)$|
13+
docs/source/.+\.aiida/repo/.+|
14+
CHANGELOG.md|
15+
)$
16+
- id: fix-encoding-pragma
17+
args: [--remove]
18+
- id: mixed-line-ending
19+
args: [--fix=lf]
20+
- id: trailing-whitespace
21+
exclude: *exclude_pre_commit_hooks
22+
23+
- repo: https://github.com/python-jsonschema/check-jsonschema
24+
rev: 0.37.0
25+
hooks:
26+
- id: check-github-workflows
27+
28+
- repo: https://github.com/astral-sh/ruff-pre-commit
29+
rev: v0.15.4
30+
hooks:
31+
- id: ruff-format
32+
- id: ruff
33+
args: [--fix, --exit-non-zero-on-fix, --show-fixes]
34+
35+
- repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks
36+
rev: v2.16.0
37+
hooks:
38+
- id: pretty-format-toml
39+
args: [--autofix]
40+
- id: pretty-format-yaml
41+
args: [--autofix]
42+
exclude: >-
43+
(?x)^(
44+
tests/.*|
45+
environment.yml|
46+
)$

.readthedocs.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
version: 2
22

33
python:
4-
version: "3.8"
4+
version: '3.8'
55
install:
6-
- method: pip
7-
path: .
8-
extra_requirements:
9-
- docs
6+
- method: pip
7+
path: .
8+
extra_requirements:
9+
- docs

docs/how_to/creation_mutation.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -668,4 +668,3 @@ Final structure ready for calculations!
668668
Is alloy: False
669669
Total charge: -1.0
670670
```
671-

docs/how_to/query.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ qb.append(
224224
print(f"Structures with charges in ({min_charge}, {max_charge}): {len(qb.all())}")
225225
```
226226

227-
!!! tip
227+
!!! tip
228228
**Using Statistics for Efficient Queries**
229229

230230
Statistical properties enable efficient filtering without loading large arrays:

docs/in_depth/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,4 @@ Comprehensive explanations of core concepts and advanced topics in `aiida-atomis
2222

2323
[Storage Backends](storage_backends.md)
2424

25-
</div>
25+
</div>

docs/in_depth/properties.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ Each `Site` object can have the following properties:
6767

6868
- Type: `str` for pure elements, `list[str]` for alloys
6969
- Example: `'Cu'` or `['Cu', 'Zn']`
70-
70+
7171
- **`position`**: Atomic coordinates in Cartesian space
7272

7373
- Type: `np.ndarray` (shape: `(3,)`)
@@ -381,7 +381,7 @@ print(field_info.json_schema_extra) # {'store_in': 'db'}
381381

382382
# Properties with 'singular_form' are site properties
383383
field_info = StructureBaseModel.model_computed_fields['charges']
384-
print(field_info.json_schema_extra)
384+
print(field_info.json_schema_extra)
385385
# {'store_in': 'repository', 'singular_form': 'charge'}
386386
```
387387

@@ -390,10 +390,10 @@ print(field_info.json_schema_extra)
390390
- **`store_in`**: Where to store the property
391391
- `'db'`: Database attributes (fast queries, size-limited)
392392
- `'repository'`: File repository (large arrays, slower queries)
393-
393+
394394
- **`singular_form`**: Links plural computed property to singular site property
395395
- Example: `charges` (plural) ↔ `charge` (singular)
396-
396+
397397
- **`statistic`**: Statistical aggregation for querying
398398
- `'max'`: Maximum value across all sites
399399
- `'min'`: Minimum value across all sites
@@ -467,4 +467,4 @@ builder.properties.sites.append({'symbol': 'Cu', 'position': [0, 0, 0]}) # OK
467467
# StructureData: immutable (use for storing in database)
468468
structure = StructureData(cell=[[3, 0, 0], [0, 3, 0], [0, 0, 3]], pbc=[True]*3, sites=[...])
469469
structure.properties.sites.append(...) # Error: immutable
470-
```
470+
```

0 commit comments

Comments
 (0)