Skip to content

Commit 268033f

Browse files
committed
Update pre-commit checks
1 parent 9d23615 commit 268033f

10 files changed

Lines changed: 133 additions & 129 deletions

File tree

.github/workflows/lint.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Lint
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
lint:
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.13"
14+
cache: pip
15+
- name: Install dependencies
16+
run: pip install .[dev]
17+
- name: Run pre-commit checks
18+
run: pre-commit run --all-files --show-diff-on-failure

.github/workflows/tests.yml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ on: [push, pull_request]
44

55
jobs:
66
build:
7-
87
strategy:
98
matrix:
109
os: [ubuntu-latest, macos-latest, windows-latest]
@@ -20,11 +19,5 @@ jobs:
2019
cache: pip
2120
- name: Install dependencies
2221
run: pip install .[dev]
23-
- name: Check types
24-
run: mypy src/
25-
- name: Style flake8
26-
run: flake8 src/
27-
- name: Style pylint
28-
run: pylint src/
2922
- name: Run tests
3023
run: pytest --cov=cloudnet_submit

.pre-commit-config.yaml

Lines changed: 22 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,40 @@
11
repos:
22
- repo: https://github.com/pre-commit/pre-commit-hooks
3-
rev: v4.4.0
3+
rev: v5.0.0
44
hooks:
5-
- id: detect-private-key
6-
- id: trailing-whitespace
7-
- id: end-of-file-fixer
8-
- id: check-yaml
9-
- id: check-toml
10-
- id: debug-statements
11-
- id: check-added-large-files
125
- id: check-case-conflict
136
- id: check-executables-have-shebangs
147
- id: check-merge-conflict
158
- id: check-shebang-scripts-are-executable
9+
- id: end-of-file-fixer
1610
- id: fix-byte-order-marker
1711
- id: mixed-line-ending
1812
args: ["--fix", "lf"]
19-
20-
- repo: https://github.com/psf/black
21-
rev: 23.1.0
22-
hooks:
23-
- id: black
24-
25-
- repo: https://github.com/pycqa/isort
26-
rev: 5.12.0
27-
hooks:
28-
- id: isort
29-
args: ["--profile", "black", "--filter-files"]
30-
31-
- repo: https://github.com/pycqa/flake8
32-
rev: 6.0.0
33-
hooks:
34-
- id: flake8
35-
36-
- repo: local
13+
- id: trailing-whitespace
14+
- repo: https://github.com/astral-sh/ruff-pre-commit
15+
rev: v0.11.6
3716
hooks:
38-
- id: pylint
39-
name: pylint
40-
entry: pylint
41-
language: system
42-
types: [python]
43-
args:
44-
[
45-
"-rn", # Only display messages
46-
"-sn", # Don't display the score
47-
]
48-
17+
- id: ruff
18+
args: ["--fix"]
19+
- id: ruff-format
4920
- repo: local
5021
hooks:
5122
- id: mypy
5223
name: mypy
5324
entry: mypy
5425
language: system
5526
types: [python]
56-
exclude: ^(tests/|release|setup.py)
27+
require_serial: true
28+
- repo: https://github.com/pre-commit/mirrors-prettier
29+
rev: v3.1.0
30+
hooks:
31+
- id: prettier
32+
- repo: https://github.com/pappasam/toml-sort
33+
rev: v0.24.2
34+
hooks:
35+
- id: toml-sort-fix
36+
exclude: ^(src|tests)/.*\.toml$
37+
- repo: https://github.com/crate-ci/typos
38+
rev: v1.31.1
39+
hooks:
40+
- id: typos

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,22 @@
77
## 0.0.8 – 2023-11-07
88

99
### Added
10+
1011
- Add `peridiocity` to instrument configuration
1112
- Print summary of the submitted files
1213

1314
### Changed
15+
1416
- Validate `path_fmt` in instrument and model configuration
1517

1618
## 0.0.7 – 2023-10-20
1719

1820
### Fixed
21+
1922
- Get current date in UTC
2023

2124
## 0.0.6 – 2023-08-28
2225

2326
### Added
27+
2428
- Links to instrument list

README.md

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,23 @@
11
# Cloudnet data submission tool
2+
23
![Tests](https://github.com/actris-cloudnet/cloudnet-submit/actions/workflows/tests.yml/badge.svg)
34
[![PyPI version](https://badge.fury.io/py/cloudnet-submit.svg)](https://badge.fury.io/py/cloudnet-submit)
45

56
## Installation
67

78
### Linux/macOS
9+
810
If you have `python` and `pip` installed (`python >= 3.8`),
911
run the command:
12+
1013
```sh
1114
pip install cloudnet-submit
1215
```
1316

1417
After that, you can use `cloudnet-submit` command to run the program.
1518

1619
### Windows
20+
1721
If you are using Windows Subsystem for Linux,
1822
then the aforementioned Linux installation should work.
1923

@@ -26,11 +30,13 @@ pip install cloudnet-submit
2630
```
2731

2832
Test if the `cloudnet-submit` command works:
33+
2934
```sh
3035
cloudnet-submit --version
3136
```
3237

3338
If not, you can use an alternative way to run the program:
39+
3440
```sh
3541
python -m cloudnet_submit --version
3642
```
@@ -40,6 +46,7 @@ python -m cloudnet_submit --version
4046
### Configuration file
4147

4248
Generate a configuration file:
49+
4350
```sh
4451
cloudnet-submit --generate-config
4552
```
@@ -62,7 +69,6 @@ If your instrument does not have PID yet,
6269
please [fill the form](https://docs.google.com/forms/d/e/1FAIpQLSeY4nvAah-K5xPfF-VMhDbmmY9lq7BbtTDKTT9BZMqT7tC7zA/viewform)
6370
first.
6471

65-
6672
```toml
6773
# cloudnet-config.toml
6874
[user_account]
@@ -115,18 +121,19 @@ for a given measurement date.
115121

116122
Use the following format codes:
117123

118-
| Directive | Meaning | Example |
119-
|-----------|------------------------------------|:--------------------------:|
124+
| Directive | Meaning | Example |
125+
| --------- | ---------------------------------- | :------------------------: |
120126
| `%Y` | Year with century | 0001, ..., 2023, ..., 9999 |
121-
| `%y` | Year without century (zero-padded) | 00, ..., 23, ..., 99 |
122-
| `%m` | Month (zero-padded) | 01, 02, ..., 12 |
123-
| `%d` | Day (zero-padded) | 01, 02, ..., 31 |
127+
| `%y` | Year without century (zero-padded) | 00, ..., 23, ..., 99 |
128+
| `%m` | Month (zero-padded) | 01, 02, ..., 12 |
129+
| `%d` | Day (zero-padded) | 01, 02, ..., 31 |
124130

125131
You can also use wildcard character `*` in `path_fmt` field.
126132

127133
By default, `cloudnet-submit` expects the `cloudnet-config.toml` file to be
128134
in your working directory.
129135
You can also use `--config` to specify another location for the config file:
136+
130137
```sh
131138
cloudnet-submit --config /path/to/your/config.toml
132139
```
@@ -148,26 +155,31 @@ of the month, the file will be resubmitted and replaces the previously submitted
148155
By default, `cloudnet-submit` submits data from the past three days.
149156

150157
Use `--dry-run` to list files that would be submitted:
158+
151159
```sh
152160
cloudnet-submit --dry-run
153161
```
154162

155163
Submit data to the Cloudnet data portal:
164+
156165
```sh
157166
cloudnet-submit
158167
```
159168

160169
You can also set the number of days to be submitted (including today):
170+
161171
```sh
162172
cloudnet-submit --last-ndays 5
163173
```
164174

165175
You can also specify a date you want to submit:
176+
166177
```sh
167178
cloudnet-submit --date 2022-06-21
168179
```
169180

170181
Or a list of dates:
182+
171183
```sh
172184
cloudnet-submit --date 2022-06-21 2022-05-01
173185
```
@@ -179,10 +191,12 @@ cloudnet-submit --from-date 2022-05-01 --to-date 2022-06-24
179191
```
180192

181193
See all the options:
194+
182195
```sh
183196
cloudnet-submit --help
184197
```
185198

186199
## Feedback and contact
200+
187201
- Bugs, feature requests, documentation: [Create an issue](https://github.com/actris-cloudnet/cloudnet-submit/issues/new/choose) on Github
188202
- Or just [send us mail](mailto:actris-cloudnet@fmi.fi) :)

0 commit comments

Comments
 (0)