Skip to content

Commit 388fc60

Browse files
committed
Update pre-commit checks
1 parent 1abfbe3 commit 388fc60

10 files changed

Lines changed: 133 additions & 153 deletions

File tree

.github/workflows/tests.yml

Lines changed: 3 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,8 @@ 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/
22+
- name: Run pre-commit checks
23+
if: startsWith(matrix.os, 'ubuntu-')
24+
run: pre-commit run --all-files --show-diff-on-failure
2925
- name: Run tests
3026
run: pytest --cov=cloudnet_submit

.pre-commit-config.yaml

Lines changed: 21 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,39 @@
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+
- repo: https://github.com/crate-ci/typos
37+
rev: v1.31.1
38+
hooks:
39+
- 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) :)

pyproject.toml

Lines changed: 46 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -5,70 +5,54 @@ build-backend = "setuptools.build_meta"
55
[project]
66
name = "cloudnet-submit"
77
authors = [
8-
{ name="Niko Leskinen", email="niko.leskinen@fmi.fi" },
8+
{name = "Niko Leskinen", email = "niko.leskinen@fmi.fi"},
99
]
1010
description = "Cloudnet data submission tool"
1111
dynamic = ["version"]
1212
requires-python = ">=3.8"
1313
readme = "README.md"
14-
license = { file="LICENSE" }
14+
license = {file = "LICENSE"}
1515
classifiers = [
16-
"Development Status :: 4 - Beta",
17-
"Programming Language :: Python :: 3",
18-
"Programming Language :: Python :: 3.8",
19-
"Programming Language :: Python :: 3.9",
20-
"Programming Language :: Python :: 3.10",
21-
"Programming Language :: Python :: 3.11",
22-
"Programming Language :: Python :: 3.12",
23-
"License :: OSI Approved :: MIT License",
24-
"Intended Audience :: Science/Research",
25-
"Operating System :: OS Independent",
16+
"Development Status :: 4 - Beta",
17+
"Intended Audience :: Science/Research",
18+
"License :: OSI Approved :: MIT License",
19+
"Operating System :: OS Independent",
20+
"Programming Language :: Python :: 3",
21+
"Programming Language :: Python :: 3.10",
22+
"Programming Language :: Python :: 3.11",
23+
"Programming Language :: Python :: 3.12",
24+
"Programming Language :: Python :: 3.8",
25+
"Programming Language :: Python :: 3.9",
2626
]
27-
2827
dependencies = [
28+
"braceexpand",
2929
"requests >= 2.28.1",
3030
"toml >= 0.10.2",
31-
"braceexpand",
3231
]
3332

34-
[project.urls]
35-
Homepage = "https://github.com/actris-cloudnet/cloudnet-submit"
36-
Repository = "https://github.com/actris-cloudnet/cloudnet-submit"
37-
Changelog = "https://github.com/actris-cloudnet/cloudnet-submit/blob/main/CHANGELOG.md"
38-
"Bug Tracker" = "https://github.com/actris-cloudnet/cloudnet-submit/issues"
39-
4033
[project.optional-dependencies]
4134
dev = [
4235
"mypy",
36+
"pre-commit",
4337
"pytest",
4438
"pytest-cov",
45-
"black",
46-
"flake8",
47-
"pylint",
48-
"autoflake",
49-
"isort",
50-
"pre-commit",
5139
"types-requests",
40+
"types-setuptools",
5241
"types-toml",
5342
]
5443
# Not supported on Python <= 3.10
5544
release = [
56-
"release-version"
45+
"release-version",
5746
]
47+
5848
[project.scripts]
5949
cloudnet-submit = "cloudnet_submit.main:main"
6050

61-
[tool.setuptools.packages.find]
62-
where = ["src"]
63-
[tool.setuptools.dynamic]
64-
version = {attr = "cloudnet_submit.version.__version__"}
65-
66-
67-
[tool.pytest.ini_options]
68-
addopts = "--cov=cloudnet_submit --cov-report html"
69-
testpaths = [
70-
"tests",
71-
]
51+
[project.urls]
52+
Homepage = "https://github.com/actris-cloudnet/cloudnet-submit"
53+
Repository = "https://github.com/actris-cloudnet/cloudnet-submit"
54+
Changelog = "https://github.com/actris-cloudnet/cloudnet-submit/blob/main/CHANGELOG.md"
55+
"Bug Tracker" = "https://github.com/actris-cloudnet/cloudnet-submit/issues"
7256

7357
[tool.mypy]
7458
check_untyped_defs = true
@@ -79,29 +63,33 @@ show_error_codes = true
7963
warn_return_any = true
8064
warn_unused_ignores = true
8165

82-
[tool.black]
83-
line-length = 88
84-
target-version = ['py38']
85-
preview = true
86-
87-
[tool.isort]
88-
profile= "black"
89-
line_length = 88
90-
91-
[tool.pylint]
92-
ignore-patterns = "test_.*\\.py,release"
93-
ignore-paths = "^tests/.*"
94-
good-names = ["i", "j", "k", "f",]
95-
max-line-length = 88
96-
disable = [
97-
"missing-module-docstring",
98-
"missing-class-docstring",
99-
"missing-function-docstring",
100-
"too-few-public-methods",
101-
"too-many-arguments"
66+
[tool.pytest.ini_options]
67+
addopts = "--cov=cloudnet_submit --cov-report html"
68+
testpaths = [
69+
"tests",
10270
]
10371

10472
[tool.release-version]
10573
filename = "src/cloudnet_submit/version.py"
10674
pattern = "__version__ = \"(?P<major>\\d+)\\.(?P<minor>\\d+)\\.(?P<patch>\\d+)\""
10775
changelog = "CHANGELOG.md"
76+
77+
[tool.ruff.lint]
78+
select = ["B", "D", "E", "F", "I", "PLC", "PLE", "PLW", "SIM"]
79+
ignore = ["D1"]
80+
81+
[tool.ruff.lint.per-file-ignores]
82+
"__init__.py" = ["PLC0414"]
83+
84+
[tool.ruff.lint.pydocstyle]
85+
convention = "google"
86+
87+
[tool.setuptools.dynamic]
88+
version = {attr = "cloudnet_submit.version.__version__"}
89+
90+
[tool.setuptools.packages.find]
91+
where = ["src"]
92+
93+
[tool.tomlsort]
94+
trailing_comma_inline_array = true
95+
sort_inline_arrays = true

src/cloudnet_submit/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
from cloudnet_submit.version import __version__
1+
from cloudnet_submit.version import __version__ as __version__

0 commit comments

Comments
 (0)