Skip to content

Commit 75e6853

Browse files
authored
Merge pull request #86 from nvaccess/main
Creating pyproject.toml and .pre-commit-config.yaml
2 parents a373183 + 836ebc0 commit 75e6853

37 files changed

+4172
-3022
lines changed

.github/workflows/automaticRelease.yaml

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@ jobs:
2525
git commit -m "Update translations" --allow-empty
2626
git pull
2727
git push
28-
29-
zip-rules:
28+
29+
zip-rules:
3030
name: zip up the rules directory
3131
runs-on: ubuntu-latest
3232
steps:
3333
- name: Checkout code
3434
uses: actions/checkout@v3
35-
- name: Build Rust Library
35+
- name: Build Rust Library
3636
run: |
3737
cargo build --target x86_64-unknown-linux-gnu # doesn't need a release build since all that we want is the Rules dir
3838
- name: create rules.zip
@@ -42,15 +42,15 @@ jobs:
4242
filename: 'Rules.zip'
4343
directory: 'addon/globalPlugins/MathCAT'
4444
path: 'Rules'
45-
- name: Upload Rules.zip
45+
- name: Upload Rules.zip
4646
uses: actions/upload-artifact@v4
4747
with:
4848
name: 'Rules.zip'
4949
path: 'addon/globalPlugins/MathCAT/Rules.zip'
5050
compression-level: 0
5151
retention-days: 1
5252

53-
rust-32:
53+
rust-32:
5454
name: Build 32 bit windows pyd file
5555
runs-on: windows-latest # needs to run on windows because of bzip2
5656
steps:
@@ -61,7 +61,7 @@ jobs:
6161
with:
6262
python-version: 3.11
6363
architecture: 'x86'
64-
- name: Build Rust Library
64+
- name: Build Rust Library
6565
run: |
6666
cargo build --target i686-pc-windows-msvc --release
6767
- name: Setup Example dir
@@ -79,15 +79,15 @@ jobs:
7979
filename: '../libmathcat_py-32-3.11-win.zip'
8080
directory: 'Example'
8181
path: 'libmathcat_py.pyd'
82-
- name: Upload 32 bit pyd file
82+
- name: Upload 32 bit pyd file
8383
uses: actions/upload-artifact@v4
8484
with:
8585
name: libmathcat_py-32-3.11-win.zip
8686
path: libmathcat_py-32-3.11-win.zip
8787
compression-level: 0
8888
retention-days: 1
89-
90-
rust-64:
89+
90+
rust-64:
9191
name: Build 64 bit windows pyd file
9292
runs-on: windows-latest # needs to run on windows because of bzip2
9393
steps:
@@ -98,7 +98,7 @@ jobs:
9898
with:
9999
python-version: 3.11
100100
architecture: 'x64'
101-
- name: Build Rust Library
101+
- name: Build Rust Library
102102
run: |
103103
cargo build --target x86_64-pc-windows-msvc --release
104104
- name: Setup Example dir
@@ -116,15 +116,15 @@ jobs:
116116
run: |
117117
cd Example
118118
python test.py
119-
- name: Upload 64 bit pyd file
119+
- name: Upload 64 bit pyd file
120120
uses: actions/upload-artifact@v4
121121
with:
122122
name: libmathcat_py-64-3.11-win.zip
123123
path: libmathcat_py-64-3.11-win.zip
124124
compression-level: 0
125125
retention-days: 1
126-
127-
linux-64:
126+
127+
linux-64:
128128
name: Build linux pyd file (64-bit intel)
129129
runs-on: ubuntu-latest
130130
steps:
@@ -135,7 +135,7 @@ jobs:
135135
with:
136136
python-version: 3.11
137137
architecture: 'x64'
138-
- name: Build Rust Library
138+
- name: Build Rust Library
139139
run: |
140140
cargo build --target x86_64-unknown-linux-gnu --release
141141
- name: Setup Example dir
@@ -154,14 +154,14 @@ jobs:
154154
filename: '../libmathcat_py-64-3.11-linux.zip'
155155
directory: 'Example'
156156
path: 'libmathcat_py.so'
157-
- name: Upload 64 bit pyd file
157+
- name: Upload 64 bit pyd file
158158
uses: actions/upload-artifact@v4
159159
with:
160160
name: libmathcat_py-64-3.11-linux.zip
161161
path: libmathcat_py-64-3.11-linux.zip
162162
compression-level: 0
163163
retention-days: 1
164-
164+
165165
build-addon:
166166
name: build-addon
167167
continue-on-error: false
@@ -202,15 +202,15 @@ jobs:
202202
- name: Run scons to build .addon file
203203
run: |
204204
scons
205-
- name: Upload the addon
205+
- name: Upload the addon
206206
uses: actions/upload-artifact@v4
207207
with:
208208
name: addon
209209
path: "*.nvda-addon"
210210
compression-level: 0
211211
retention-days: 1
212212

213-
pre-release:
213+
pre-release:
214214
name: Pre Release
215215
continue-on-error: false
216216
needs: [zip-rules, rust-32, rust-64, linux-64, build-addon]

.github/workflows/checkTranslatorsComments.yml renamed to .github/workflows/checkTranslatorsComments.yaml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
pip install scons markdown
3030
sudo apt update
3131
sudo apt install gettext
32-
32+
3333
- name: Generate the .pot file
3434
run: scons pot
3535

@@ -43,7 +43,7 @@ jobs:
4343
# checkPot.EXPECTED_MESSAGES_WITHOUT_COMMENTS = set()
4444
# res = checkPot.checkPot('$(ls *.pot)')
4545
# exit(res)
46-
#shell: python
46+
#shell: python
4747
run: |
4848
python -c "import checkPot;checkPot.EXPECTED_MESSAGES_WITHOUT_COMMENTS = set();exit(checkPot.checkPot('$(ls *.pot)'))"
4949
echo "nb_errors=$?" >> "$GITHUB_OUTPUT"
@@ -58,4 +58,3 @@ jobs:
5858
echo "Translators comments: FAIL"
5959
exit 1;
6060
fi
61-

.github/workflows/lint.yaml

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

.github/workflows/manualRelease.yaml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Manual release
33
on:
44
workflow_dispatch:
55
inputs:
6-
version:
6+
version:
77
description: 'Add-on version'
88
required: true
99
default: '0.0.0'
@@ -20,7 +20,7 @@ jobs:
2020
buildAndUpload:
2121
continue-on-error: true
2222
runs-on: ubuntu-latest
23-
23+
2424
permissions:
2525
contents: write
2626

@@ -50,7 +50,7 @@ jobs:
5050
f.seek(0)
5151
f.write(text)
5252
f.truncate()
53-
shell: python
53+
shell: python
5454
- name: Build add-on
5555
run: scons
5656
- name: Push changes
@@ -67,7 +67,7 @@ jobs:
6767
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
6868
passphrase: ${{ secrets.PASSPHRASE }}
6969
- if: ${{ inputs.signAddOn }}
70-
name: Sign add-on
70+
name: Sign add-on
7171
run: gpg --detach-sign *.nvda-addon
7272
- name: Calculate sha256
7373
run: sha256sum *.nvda-addon >> sha256.txt
@@ -82,4 +82,3 @@ jobs:
8282
artifacts: "*.nvda-addon,*.sig,publicKey.asc,sha256.txt"
8383
generateReleaseNotes: true
8484
prerelease: ${{ inputs.prerelease }}
85-

.github/workflows/requirements.txt

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

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@ manifest.ini
99
*.nvda-addon
1010
.sconsign.dblite
1111
/[0-9]*.[0-9]*.[0-9]*.json
12+
.venv/

.pre-commit-config.yaml

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
2+
# https://pre-commit.ci/
3+
# Configuration for Continuous Integration service
4+
ci:
5+
skip: [pyrightLocal]
6+
autoupdate_schedule: monthly
7+
autoupdate_commit_msg: "Pre-commit auto-update"
8+
autofix_commit_msg: "Pre-commit auto-fix"
9+
submodules: true
10+
11+
default_language_version:
12+
python: python3.11
13+
14+
repos:
15+
- repo: https://github.com/pre-commit-ci/pre-commit-ci-config
16+
rev: v1.6.1
17+
hooks:
18+
- id: check-pre-commit-ci-config
19+
20+
- repo: meta
21+
hooks:
22+
# ensures that exclude directives apply to any file in the repository.
23+
- id: check-useless-excludes
24+
# ensures that the configured hooks apply to at least one file in the repository.
25+
- id: check-hooks-apply
26+
27+
- repo: https://github.com/pre-commit/pre-commit-hooks
28+
rev: v5.0.0
29+
hooks:
30+
# Prevents commits to certain branches
31+
- id: no-commit-to-branch
32+
args: ["--branch", "main"]
33+
# Checks that large files have not been added. Default cut-off for "large" files is 500kb.
34+
- id: check-added-large-files
35+
# Checks python syntax
36+
- id: check-ast
37+
# Checks for filenames that will conflict on case insensitive filesystems (the majority of Windows filesystems, most of the time)
38+
- id: check-case-conflict
39+
# Checks for artifacts from resolving merge conflicts.
40+
- id: check-merge-conflict
41+
# Checks Python files for debug statements, such as python's breakpoint function, or those inserted by some IDEs.
42+
- id: debug-statements
43+
# Removes trailing whitespace.
44+
- id: trailing-whitespace
45+
types_or: [python, batch, markdown, toml, yaml, rust]
46+
# Ensures all files end in 1 (and only 1) newline.
47+
- id: end-of-file-fixer
48+
types_or: [python, batch, markdown, toml, yaml, rust]
49+
# Removes the UTF-8 BOM from files that have it.
50+
# See https://github.com/nvaccess/nvda/blob/master/projectDocs/dev/codingStandards.md#encoding
51+
- id: fix-byte-order-marker
52+
types_or: [python, batch, markdown, toml, yaml, rust]
53+
# Validates TOML files.
54+
- id: check-toml
55+
# Validates YAML files.
56+
- id: check-yaml
57+
# Validates XML files.
58+
# Ensures that links to lines in files under version control point to a particular commit.
59+
- id: check-vcs-permalinks
60+
# Avoids using reserved Windows filenames.
61+
- id: check-illegal-windows-names
62+
63+
- repo: https://github.com/asottile/add-trailing-comma
64+
rev: v3.1.0
65+
hooks:
66+
# Ruff preserves indent/new-line formatting of function arguments, list items, and similar iterables,
67+
# if a trailing comma is added.
68+
# This adds a trailing comma to args/iterable items in case it was missed.
69+
- id: add-trailing-comma
70+
71+
- repo: https://github.com/astral-sh/ruff-pre-commit
72+
# Matches Ruff version in pyproject.
73+
rev: v0.8.1
74+
hooks:
75+
- id: ruff
76+
name: lint with ruff
77+
args: [ --fix ]
78+
- id: ruff-format
79+
name: format with ruff
80+
81+
- repo: https://github.com/RobertCraigie/pyright-python
82+
rev: v1.1.394
83+
hooks:
84+
- id: pyright
85+
alias: pyrightLocal
86+
name: Check types with pyright
87+
88+
- repo: https://github.com/RobertCraigie/pyright-python
89+
rev: v1.1.396
90+
hooks:
91+
- id: pyright
92+
alias: pyrightCI
93+
name: Check types with pyright
94+
# use nodejs version of pyright and install pyproject.toml for CI
95+
additional_dependencies: [".", "pyright[nodejs]"]
96+
stages: [manual] # Only run from CI manually

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ version = "0.22"
3131
features = ["extension-module", "abi3"]
3232

3333
[build-dependencies]
34-
zip = { version = "2.6", default-features = false, features = ["bzip2"] }
34+
zip = { version = "3.0", default-features = false, features = ["bzip2"] }
3535
mathcat = {version = "=0.6.9", features = ["include-zip"]} # for building, we want the zip files so we can include them separately
3636
# mathcat = { path = "../MathCAT/", features = ["include-zip"]} # for building, we want the zip files so we can include them separately
3737
# for testing MathCAT without having to publish a new version (change two occurrences)

0 commit comments

Comments
 (0)