Skip to content

Commit 603f4c5

Browse files
committed
Update and improve project structure:
- add pre-commit hooks: - ruff - whitespace - add hawkeye for licence headers and attribution - run the above on all files - improve documentation
1 parent 8183695 commit 603f4c5

20 files changed

Lines changed: 511 additions & 69 deletions

.pre-commit-config.yaml

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,37 @@
1-
# Copyright (C) 2024 vanous
1+
# The MIT License (MIT)
22
#
3-
# This file is part of BlenderDMX.
3+
# Copyright (C) 2025 vanous
44
#
5-
# BlenderDMX is free software: you can redistribute it and/or modify it
6-
# under the terms of the GNU General Public License as published by the Free
7-
# Software Foundation, either version 3 of the License, or (at your option)
8-
# any later version.
5+
# This file is part of pymvr.
96
#
10-
# BlenderDMX is distributed in the hope that it will be useful, but WITHOUT
11-
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12-
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13-
# more details.
7+
# Permission is hereby granted, free of charge, to any person obtaining a copy of
8+
# this software and associated documentation files (the “Software”), to deal in
9+
# the Software without restriction, including without limitation the rights to
10+
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
11+
# of the Software, and to permit persons to whom the Software is furnished to do
12+
# so, subject to the following conditions:
1413
#
15-
# You should have received a copy of the GNU General Public License along
16-
# with this program. If not, see <https://www.gnu.org/licenses/>.
14+
# The above copyright notice and this permission notice shall be included in all
15+
# copies or substantial portions of the Software.
16+
#
17+
# THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23+
# SOFTWARE.
1724

1825
# See https://pre-commit.com for more information
1926
# See https://pre-commit.com/hooks.html for more hooks
2027
repos:
2128
- repo: https://github.com/pre-commit/pre-commit-hooks
22-
rev: v3.2.0
29+
rev: v5.0.0
2330
hooks:
2431
- id: trailing-whitespace
2532
- id: check-added-large-files
2633
- id: debug-statements
27-
- repo: local
28-
hooks:
29-
- id: check-prints
30-
name: Check for print statements without "INFO"
31-
entry: ./scripts/check-prints.py
32-
language: python
33-
types: [python]
34-
verbose: true
3534
- repo: https://github.com/astral-sh/ruff-pre-commit
36-
rev: v0.11.5
35+
rev: v0.12.5
3736
hooks:
3837
- id: ruff-format

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
### 1.0.0-dev0
44

5-
* Breaking changes!
5+
* Breaking changes. There is now an additional .scene object, plus several
6+
other collector objects. Look at the tests/readme for details.
67
* Big refactor of structure - ensure that XML structure is followed in code
78
* Implemented all MVR fields
89
* Big refactor for export

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,14 @@ uv sync
151151
uv run ruff format pymvr/*
152152
```
153153

154+
### Pre-commit hooks
155+
156+
- You can use the pre-commit hooks
157+
158+
```bash
159+
uv run pre-commit install
160+
```
161+
154162
### Testing
155163

156164
- to test, use pytest

RELEASE.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@
55
* push to master (via PR)
66
* `git tag versionCode`
77
* `git push origin versionCode`
8+
* License headers:
9+
* Make sure to install/update hawkeye
10+
* `cargo install hawkeye`
11+
* Update headers:
12+
* `hawkeye format`
813

914
* generate wheel with pip wheel:
1015

conftest.py

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,27 @@
1+
# The MIT License (MIT)
2+
#
3+
# Copyright (C) 2023 vanous
4+
#
5+
# This file is part of pymvr.
6+
#
7+
# Permission is hereby granted, free of charge, to any person obtaining a copy of
8+
# this software and associated documentation files (the “Software”), to deal in
9+
# the Software without restriction, including without limitation the rights to
10+
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
11+
# of the Software, and to permit persons to whom the Software is furnished to do
12+
# so, subject to the following conditions:
13+
#
14+
# The above copyright notice and this permission notice shall be included in all
15+
# copies or substantial portions of the Software.
16+
#
17+
# THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23+
# SOFTWARE.
24+
125
from pathlib import Path
226
import pytest
327
import pymvr
@@ -10,7 +34,9 @@
1034
@pytest.fixture(scope="function")
1135
def mvr_scene(request):
1236
file_name = request.param[0]
13-
test_mvr_scene_path = Path(Path(__file__).parents[0], "tests", file_name) # test file path is made from current directory, tests directory and a file name
37+
test_mvr_scene_path = Path(
38+
Path(__file__).parents[0], "tests", file_name
39+
) # test file path is made from current directory, tests directory and a file name
1440
mvr_scene = pymvr.GeneralSceneDescription(test_mvr_scene_path)
1541
yield mvr_scene
1642

@@ -26,4 +52,6 @@ def pytest_configure(config):
2652

2753

2854
def pytest_addoption(parser):
29-
parser.addoption("--file-path", action="store", default=None, help="Path to the input file")
55+
parser.addoption(
56+
"--file-path", action="store", default=None, help="Path to the input file"
57+
)

licenserc.toml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# The MIT License (MIT)
2+
#
3+
# Copyright (C) none
4+
#
5+
# This file is part of pymvr.
6+
#
7+
# Permission is hereby granted, free of charge, to any person obtaining a copy of
8+
# this software and associated documentation files (the “Software”), to deal in
9+
# the Software without restriction, including without limitation the rights to
10+
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
11+
# of the Software, and to permit persons to whom the Software is furnished to do
12+
# so, subject to the following conditions:
13+
#
14+
# The above copyright notice and this permission notice shall be included in all
15+
# copies or substantial portions of the Software.
16+
#
17+
# THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23+
# SOFTWARE.
24+
25+
headerPath = "mit-header.txt"
26+
27+
excludes = [
28+
".github/",
29+
]
30+
31+
[git]
32+
attrs = 'auto'
33+
ignore = 'auto'
34+
35+
[properties]
36+
inceptionYear = 2023
37+
projectName = "pymvr"
38+

mit-header.txt

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
The MIT License (MIT)
2+
3+
Copyright (C) {{attrs.git_file_created_year}} {{ attrs.git_authors | join(", ") }}
4+
5+
This file is part of {{props["projectName"]}}.
6+
7+
Permission is hereby granted, free of charge, to any person obtaining a copy of
8+
this software and associated documentation files (the “Software”), to deal in
9+
the Software without restriction, including without limitation the rights to
10+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
11+
of the Software, and to permit persons to whom the Software is furnished to do
12+
so, subject to the following conditions:
13+
14+
The above copyright notice and this permission notice shall be included in all
15+
copies or substantial portions of the Software.
16+
17+
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23+
SOFTWARE.

0 commit comments

Comments
 (0)