rumorph 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. rumorph-0.1.0/.github/ISSUE_TEMPLATE/bug_report.yml +34 -0
  2. rumorph-0.1.0/.github/ISSUE_TEMPLATE/config.yml +5 -0
  3. rumorph-0.1.0/.github/ISSUE_TEMPLATE/feature_request.yml +22 -0
  4. rumorph-0.1.0/.github/PULL_REQUEST_TEMPLATE.md +7 -0
  5. rumorph-0.1.0/.github/dependabot.yml +35 -0
  6. rumorph-0.1.0/.github/workflows/ci.yml +121 -0
  7. rumorph-0.1.0/.github/workflows/docs.yml +40 -0
  8. rumorph-0.1.0/.github/workflows/publish.yml +296 -0
  9. rumorph-0.1.0/.gitignore +33 -0
  10. rumorph-0.1.0/.pre-commit-config.yaml +71 -0
  11. rumorph-0.1.0/.python-version +1 -0
  12. rumorph-0.1.0/CITATION.cff +24 -0
  13. rumorph-0.1.0/CODE_OF_CONDUCT.md +34 -0
  14. rumorph-0.1.0/CONTRIBUTING.md +58 -0
  15. rumorph-0.1.0/Cargo.lock +214 -0
  16. rumorph-0.1.0/Cargo.toml +15 -0
  17. rumorph-0.1.0/LICENSE-DICTIONARY.txt +12 -0
  18. rumorph-0.1.0/LICENSE.txt +17 -0
  19. rumorph-0.1.0/Makefile +108 -0
  20. rumorph-0.1.0/PKG-INFO +362 -0
  21. rumorph-0.1.0/README.en.md +330 -0
  22. rumorph-0.1.0/README.md +330 -0
  23. rumorph-0.1.0/crates/rumorph/Cargo.toml +12 -0
  24. rumorph-0.1.0/crates/rumorph/src/builder.rs +454 -0
  25. rumorph-0.1.0/crates/rumorph/src/dictionary/guess.rs +232 -0
  26. rumorph-0.1.0/crates/rumorph/src/dictionary/parts.rs +546 -0
  27. rumorph-0.1.0/crates/rumorph/src/dictionary/rules.rs +709 -0
  28. rumorph-0.1.0/crates/rumorph/src/dictionary.rs +2418 -0
  29. rumorph-0.1.0/crates/rumorph/src/error.rs +37 -0
  30. rumorph-0.1.0/crates/rumorph/src/format.rs +381 -0
  31. rumorph-0.1.0/crates/rumorph/src/lib.rs +11 -0
  32. rumorph-0.1.0/crates/rumorph-build/Cargo.toml +14 -0
  33. rumorph-0.1.0/crates/rumorph-build/src/lexemes.rs +159 -0
  34. rumorph-0.1.0/crates/rumorph-build/src/main.rs +705 -0
  35. rumorph-0.1.0/crates/rumorph-build/src/ud.rs +1420 -0
  36. rumorph-0.1.0/crates/rumorph-py/Cargo.toml +18 -0
  37. rumorph-0.1.0/crates/rumorph-py/src/lib.rs +1140 -0
  38. rumorph-0.1.0/docs/analysis.en.md +113 -0
  39. rumorph-0.1.0/docs/analysis.md +113 -0
  40. rumorph-0.1.0/docs/analyzer.en.md +211 -0
  41. rumorph-0.1.0/docs/analyzer.md +211 -0
  42. rumorph-0.1.0/docs/authors.en.md +11 -0
  43. rumorph-0.1.0/docs/authors.md +11 -0
  44. rumorph-0.1.0/docs/css/extra.css +33 -0
  45. rumorph-0.1.0/docs/exceptions.en.md +36 -0
  46. rumorph-0.1.0/docs/exceptions.md +36 -0
  47. rumorph-0.1.0/docs/img/rumorph.png +0 -0
  48. rumorph-0.1.0/docs/img/rumorph.svg +18 -0
  49. rumorph-0.1.0/docs/index.en.md +104 -0
  50. rumorph-0.1.0/docs/index.md +104 -0
  51. rumorph-0.1.0/docs/inflection.en.md +137 -0
  52. rumorph-0.1.0/docs/inflection.md +137 -0
  53. rumorph-0.1.0/docs/installation.en.md +28 -0
  54. rumorph-0.1.0/docs/installation.md +28 -0
  55. rumorph-0.1.0/docs/migration.en.md +128 -0
  56. rumorph-0.1.0/docs/migration.md +128 -0
  57. rumorph-0.1.0/docs/performance.en.md +33 -0
  58. rumorph-0.1.0/docs/performance.md +33 -0
  59. rumorph-0.1.0/mkdocs.yml +104 -0
  60. rumorph-0.1.0/pyproject.toml +158 -0
  61. rumorph-0.1.0/python/rumorph/__init__.py +14 -0
  62. rumorph-0.1.0/python/rumorph/_rumorph.pyi +40 -0
  63. rumorph-0.1.0/python/rumorph/data/ru.dict +0 -0
  64. rumorph-0.1.0/python/rumorph/py.typed +0 -0
  65. rumorph-0.1.0/scripts/export_pymorphy.py +69 -0
  66. rumorph-0.1.0/scripts/smoke.py +29 -0
  67. rumorph-0.1.0/tests/test_analyzer.py +503 -0
  68. rumorph-0.1.0/tests/test_docs.py +96 -0
  69. rumorph-0.1.0/tests/test_guess.py +146 -0
  70. rumorph-0.1.0/tests/test_inflection.py +504 -0
  71. rumorph-0.1.0/tests/test_package.py +77 -0
  72. rumorph-0.1.0/tests/test_parts.py +214 -0
  73. rumorph-0.1.0/tests/test_pymorphy.py +133 -0
  74. rumorph-0.1.0/tests/test_rules.py +228 -0
  75. rumorph-0.1.0/uv.lock +1393 -0
@@ -0,0 +1,34 @@
1
+ name: Ошибка
2
+ description: Неверный разбор, исключение или падение
3
+ labels: ["bug"]
4
+ body:
5
+ - type: textarea
6
+ id: description
7
+ attributes:
8
+ label: Что происходит
9
+ description: Что вы ожидали и что получили
10
+ validations:
11
+ required: true
12
+ - type: textarea
13
+ id: reproduce
14
+ attributes:
15
+ label: Как воспроизвести
16
+ description: Словоформы или минимальный код, на которых проявляется ошибка, и полный traceback, если он есть
17
+ render: python
18
+ validations:
19
+ required: true
20
+ - type: input
21
+ id: version
22
+ attributes:
23
+ label: Версия ruMorph
24
+ description: "`python -c \"import rumorph; print(rumorph.__version__)\"`"
25
+ placeholder: "0.1.0"
26
+ validations:
27
+ required: true
28
+ - type: input
29
+ id: environment
30
+ attributes:
31
+ label: Python и ОС
32
+ placeholder: "Python 3.12, Ubuntu 24.04"
33
+ validations:
34
+ required: true
@@ -0,0 +1,5 @@
1
+ blank_issues_enabled: true
2
+ contact_links:
3
+ - name: Документация
4
+ url: https://sergeyshk.github.io/ruMorph/
5
+ about: Установка и использование анализатора
@@ -0,0 +1,22 @@
1
+ name: Предложение
2
+ description: Новая возможность анализатора или API
3
+ labels: ["enhancement"]
4
+ body:
5
+ - type: textarea
6
+ id: problem
7
+ attributes:
8
+ label: Какую задачу это решает
9
+ description: Что вы хотите сделать с текстами и почему текущих возможностей не хватает
10
+ validations:
11
+ required: true
12
+ - type: textarea
13
+ id: proposal
14
+ attributes:
15
+ label: Предлагаемое решение
16
+ description: Как это могло бы выглядеть - функция, параметр и пример результата
17
+ - type: checkboxes
18
+ id: contribution
19
+ attributes:
20
+ label: Участие
21
+ options:
22
+ - label: Готов(а) сделать пул-реквест
@@ -0,0 +1,7 @@
1
+ ## Что сделано
2
+
3
+ <!-- Что изменилось и почему. Если меняются Python API, разборы или формат словаря - скажите об этом явно: это попадет в заметки релиза. Если пул-реквест закрывает issue: Closes #123 -->
4
+
5
+ ## Проверка
6
+
7
+ <!-- Чем проверено: тесты (что именно они проверяют), `make lint`, `make test-cov`, `make docs-build`, если менялась документация. Напоминание: документация двуязычная - `docs/*.md` + `docs/*.en.md` -->
@@ -0,0 +1,35 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: "uv"
4
+ directory: "/"
5
+ schedule:
6
+ interval: "monthly"
7
+ open-pull-requests-limit: 5
8
+ groups:
9
+ # Словарь pymorphy3-dicts-ru меняет разборы и точность: его обновление - отдельным PR
10
+ # с перезамером
11
+ dictionary:
12
+ patterns: ["pymorphy3*"]
13
+ python-dependencies:
14
+ patterns: ["*"]
15
+ exclude-patterns: ["pymorphy3*"]
16
+ update-types: ["minor", "patch"]
17
+
18
+ - package-ecosystem: "cargo"
19
+ directory: "/"
20
+ schedule:
21
+ interval: "monthly"
22
+ open-pull-requests-limit: 5
23
+ labels: ["dependencies"]
24
+ groups:
25
+ rust-dependencies:
26
+ patterns: ["*"]
27
+ update-types: ["minor", "patch"]
28
+
29
+ - package-ecosystem: "github-actions"
30
+ directory: "/"
31
+ schedule:
32
+ interval: "monthly"
33
+ groups:
34
+ github-actions:
35
+ patterns: ["*"]
@@ -0,0 +1,121 @@
1
+ name: build
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - master
7
+ pull_request:
8
+
9
+ permissions:
10
+ contents: read
11
+
12
+ concurrency:
13
+ group: ${{ github.workflow }}-${{ github.ref }}
14
+ cancel-in-progress: true
15
+
16
+ jobs:
17
+ lint:
18
+ runs-on: ubuntu-latest
19
+ timeout-minutes: 30
20
+ steps:
21
+ - name: Checkout
22
+ uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
23
+ - name: Setup uv
24
+ uses: astral-sh/setup-uv@1c37ad07a6a961277cf70c0d37d6f313000f5884 # v10.3.0
25
+ with:
26
+ enable-cache: true
27
+ - name: Setup Rust
28
+ uses: dtolnay/rust-toolchain@683b588c487a69d01f6c6ddf40f036ff682cc2c8 # master
29
+ with:
30
+ toolchain: stable
31
+ components: rustfmt, clippy
32
+ - name: Cache Rust
33
+ uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3
34
+ - name: Install dependencies
35
+ run: uv sync --locked --no-default-groups --group lint --no-install-project
36
+ - name: Ruff
37
+ run: |
38
+ uv run --no-sync ruff check python scripts tests
39
+ uv run --no-sync ruff format python scripts tests --check
40
+ - name: Ruff format of the Python in Markdown
41
+ run: git ls-files -z '*.md' | xargs -0 uv run --no-sync ruff format --check
42
+ - name: Mypy
43
+ run: uv run --no-sync mypy
44
+ - name: Rustfmt
45
+ run: cargo fmt --all --check
46
+ - name: Clippy
47
+ run: cargo clippy --workspace --all-targets --locked -- -D warnings
48
+
49
+ test:
50
+ name: test (${{ matrix.python-version }}${{ matrix.os != 'ubuntu-latest' && format(', {0}', matrix.os) || '' }})
51
+ runs-on: ${{ matrix.os }}
52
+ timeout-minutes: 30
53
+ strategy:
54
+ fail-fast: false
55
+ matrix:
56
+ os: [ubuntu-latest]
57
+ python-version: ["3.11", "3.12", "3.13", "3.14"]
58
+ include:
59
+ - os: ubuntu-latest
60
+ python-version: "3.14t"
61
+ - os: windows-latest
62
+ python-version: "3.12"
63
+ - os: macos-latest
64
+ python-version: "3.12"
65
+ steps:
66
+ - name: Checkout
67
+ uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
68
+ - name: Setup uv
69
+ uses: astral-sh/setup-uv@1c37ad07a6a961277cf70c0d37d6f313000f5884 # v10.3.0
70
+ with:
71
+ enable-cache: true
72
+ python-version: ${{ matrix.python-version }}
73
+ - name: Setup Rust
74
+ uses: dtolnay/rust-toolchain@683b588c487a69d01f6c6ddf40f036ff682cc2c8 # master
75
+ with:
76
+ toolchain: stable
77
+ - name: Cache Rust
78
+ uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3
79
+ - name: Install dependencies
80
+ run: uv sync --locked --no-default-groups --group test
81
+ - name: Build dictionary
82
+ shell: bash
83
+ run: |
84
+ uv run --no-sync python scripts/export_pymorphy.py build/opencorpora
85
+ cargo run --release --locked -p rumorph-build -- build/opencorpora python/rumorph/data/ru.dict
86
+ uv run --no-sync python -c "import hashlib; print(hashlib.sha256(open('python/rumorph/data/ru.dict', 'rb').read()).hexdigest())"
87
+ - name: Run tests
88
+ run: uv run --no-sync pytest --cov rumorph
89
+ - name: Run Rust tests
90
+ run: cargo test -p rumorph -p rumorph-build --locked
91
+
92
+ msrv:
93
+ runs-on: ubuntu-latest
94
+ timeout-minutes: 30
95
+ steps:
96
+ - name: Checkout
97
+ uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
98
+ - name: Setup Rust
99
+ uses: dtolnay/rust-toolchain@683b588c487a69d01f6c6ddf40f036ff682cc2c8 # master
100
+ with:
101
+ toolchain: "1.88"
102
+ - name: Cache Rust
103
+ uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3
104
+ - name: Check
105
+ run: cargo check --workspace --all-targets --locked
106
+
107
+ docs:
108
+ runs-on: ubuntu-latest
109
+ timeout-minutes: 30
110
+ steps:
111
+ - name: Checkout
112
+ uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
113
+ - name: Setup uv
114
+ uses: astral-sh/setup-uv@1c37ad07a6a961277cf70c0d37d6f313000f5884 # v10.3.0
115
+ with:
116
+ enable-cache: true
117
+ python-version: "3.13"
118
+ - name: Install dependencies
119
+ run: uv sync --locked --only-group docs
120
+ - name: Build docs
121
+ run: uv run --no-sync mkdocs build --strict
@@ -0,0 +1,40 @@
1
+ name: docs
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - master
7
+ paths:
8
+ - "docs/**"
9
+ - "mkdocs.yml"
10
+ - ".github/workflows/docs.yml"
11
+ workflow_dispatch:
12
+
13
+ concurrency:
14
+ group: docs
15
+ cancel-in-progress: false
16
+
17
+ jobs:
18
+ deploy:
19
+ runs-on: ubuntu-latest
20
+ timeout-minutes: 30
21
+ permissions:
22
+ contents: write
23
+ steps:
24
+ - name: Checkout
25
+ uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
26
+ with:
27
+ fetch-depth: 0
28
+ - name: Setup uv
29
+ uses: astral-sh/setup-uv@1c37ad07a6a961277cf70c0d37d6f313000f5884 # v10.3.0
30
+ with:
31
+ enable-cache: true
32
+ python-version: "3.13"
33
+ - name: Install dependencies
34
+ run: uv sync --locked --only-group docs
35
+ - name: Configure git
36
+ run: |
37
+ git config user.name "github-actions[bot]"
38
+ git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
39
+ - name: Deploy
40
+ run: uv run --no-sync mkdocs gh-deploy --force --strict
@@ -0,0 +1,296 @@
1
+ name: publish
2
+
3
+ # Тег: словарь, колеса и исходники собираются один раз, проверяются на всех платформах
4
+ # и публикуются на TestPyPI; версия без .devN затем публикуется на PyPI - те же файлы.
5
+ # PR с изменением публикации или сборки - та же цепочка без публикации
6
+
7
+ on:
8
+ push:
9
+ tags:
10
+ - "*"
11
+ pull_request:
12
+ paths:
13
+ - ".github/workflows/publish.yml"
14
+ - "scripts/smoke.py"
15
+ - "pyproject.toml"
16
+ - "Cargo.toml"
17
+ - "Cargo.lock"
18
+ - "crates/*/Cargo.toml"
19
+
20
+ permissions:
21
+ contents: read
22
+
23
+ concurrency:
24
+ group: ${{ github.workflow }}-${{ github.ref }}
25
+ cancel-in-progress: ${{ github.event_name == 'pull_request' }}
26
+
27
+ jobs:
28
+ check:
29
+ runs-on: ubuntu-latest
30
+ timeout-minutes: 30
31
+ steps:
32
+ - name: Checkout
33
+ uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
34
+ - name: Setup uv
35
+ uses: astral-sh/setup-uv@1c37ad07a6a961277cf70c0d37d6f313000f5884 # v10.3.0
36
+ with:
37
+ version: "0.13.4"
38
+ enable-cache: false
39
+ - name: Check version matches tag
40
+ if: github.event_name == 'push'
41
+ run: |
42
+ version="$(uv version --short)"
43
+ if [ "$version" != "$GITHUB_REF_NAME" ]; then
44
+ echo "Version in pyproject.toml ($version) does not match the tag ($GITHUB_REF_NAME)"
45
+ exit 1
46
+ fi
47
+
48
+ dictionary:
49
+ needs: check
50
+ runs-on: ubuntu-latest
51
+ timeout-minutes: 30
52
+ steps:
53
+ - name: Checkout
54
+ uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
55
+ - name: Setup uv
56
+ uses: astral-sh/setup-uv@1c37ad07a6a961277cf70c0d37d6f313000f5884 # v10.3.0
57
+ with:
58
+ version: "0.13.4"
59
+ enable-cache: false
60
+ python-version: "3.13"
61
+ - name: Setup Rust
62
+ uses: dtolnay/rust-toolchain@683b588c487a69d01f6c6ddf40f036ff682cc2c8 # master
63
+ with:
64
+ toolchain: stable
65
+ - name: Install dependencies
66
+ run: uv sync --locked --no-default-groups --group dictionary --no-install-project
67
+ - name: Build dictionary
68
+ run: |
69
+ uv run --no-sync python scripts/export_pymorphy.py build/opencorpora
70
+ cargo run --release --locked -p rumorph-build -- build/opencorpora python/rumorph/data/ru.dict
71
+ sha256sum python/rumorph/data/ru.dict
72
+ - name: Upload dictionary
73
+ uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
74
+ with:
75
+ name: dictionary
76
+ path: python/rumorph/data/ru.dict
77
+ if-no-files-found: error
78
+
79
+ wheels:
80
+ name: wheels (${{ matrix.os }}, ${{ matrix.target }})
81
+ needs: dictionary
82
+ runs-on: ${{ matrix.os }}
83
+ timeout-minutes: 30
84
+ strategy:
85
+ fail-fast: false
86
+ matrix:
87
+ include:
88
+ - os: ubuntu-latest
89
+ target: x86_64
90
+ - os: ubuntu-latest
91
+ target: aarch64
92
+ # Оба колеса macOS - в одном задании: раннеров arm64 часто не хватает
93
+ - os: macos-latest
94
+ target: x86_64 aarch64
95
+ - os: windows-latest
96
+ target: x64
97
+ steps:
98
+ - name: Checkout
99
+ uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
100
+ - name: Download dictionary
101
+ uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
102
+ with:
103
+ name: dictionary
104
+ path: python/rumorph/data
105
+ - name: Build wheel
106
+ if: runner.os != 'macOS'
107
+ uses: PyO3/maturin-action@e83996d129638aa358a18fbd1dfb82f0b0fb5d3b # v1.51.0
108
+ with:
109
+ maturin-version: v1.15.0
110
+ target: ${{ matrix.target }}
111
+ args: --release --locked --compatibility pypi --out dist
112
+ manylinux: auto
113
+ - name: Build wheel (macOS x86_64)
114
+ if: runner.os == 'macOS'
115
+ uses: PyO3/maturin-action@e83996d129638aa358a18fbd1dfb82f0b0fb5d3b # v1.51.0
116
+ with:
117
+ maturin-version: v1.15.0
118
+ target: x86_64
119
+ args: --release --locked --compatibility pypi --out dist
120
+ - name: Build wheel (macOS aarch64)
121
+ if: runner.os == 'macOS'
122
+ uses: PyO3/maturin-action@e83996d129638aa358a18fbd1dfb82f0b0fb5d3b # v1.51.0
123
+ with:
124
+ maturin-version: v1.15.0
125
+ target: aarch64
126
+ args: --release --locked --compatibility pypi --out dist
127
+ - name: Upload wheel
128
+ uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
129
+ with:
130
+ name: wheels-${{ matrix.os }}-${{ matrix.target }}
131
+ path: dist
132
+ if-no-files-found: error
133
+
134
+ sdist:
135
+ needs: dictionary
136
+ runs-on: ubuntu-latest
137
+ timeout-minutes: 30
138
+ steps:
139
+ - name: Checkout
140
+ uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
141
+ - name: Download dictionary
142
+ uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
143
+ with:
144
+ name: dictionary
145
+ path: python/rumorph/data
146
+ - name: Build sdist
147
+ uses: PyO3/maturin-action@e83996d129638aa358a18fbd1dfb82f0b0fb5d3b # v1.51.0
148
+ with:
149
+ maturin-version: v1.15.0
150
+ command: sdist
151
+ args: --out dist
152
+ - name: Upload sdist
153
+ uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
154
+ with:
155
+ name: sdist
156
+ path: dist
157
+ if-no-files-found: error
158
+
159
+ smoke:
160
+ name: smoke (${{ matrix.os }}, ${{ matrix.python-version }})
161
+ needs: wheels
162
+ runs-on: ${{ matrix.os }}
163
+ timeout-minutes: 30
164
+ strategy:
165
+ fail-fast: false
166
+ matrix:
167
+ os: [ubuntu-latest, ubuntu-24.04-arm, macos-latest, macos-15-intel, windows-latest]
168
+ python-version: ["3.11", "3.14"]
169
+ steps:
170
+ - name: Checkout
171
+ uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
172
+ - name: Download wheels
173
+ uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
174
+ with:
175
+ pattern: wheels-*
176
+ path: dist
177
+ merge-multiple: true
178
+ - name: Setup uv
179
+ uses: astral-sh/setup-uv@1c37ad07a6a961277cf70c0d37d6f313000f5884 # v10.3.0
180
+ with:
181
+ version: "0.13.4"
182
+ enable-cache: false
183
+ python-version: ${{ matrix.python-version }}
184
+ - name: Smoke test
185
+ run: >-
186
+ uv run --isolated --no-project --no-index --no-build --find-links dist --with rumorph
187
+ python scripts/smoke.py ${{ github.event_name == 'push' && github.ref_name || '' }}
188
+ shell: bash
189
+
190
+ smoke-sdist:
191
+ needs: sdist
192
+ runs-on: ubuntu-latest
193
+ timeout-minutes: 30
194
+ steps:
195
+ - name: Checkout
196
+ uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
197
+ - name: Download sdist
198
+ uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
199
+ with:
200
+ name: sdist
201
+ path: dist
202
+ - name: Setup uv
203
+ uses: astral-sh/setup-uv@1c37ad07a6a961277cf70c0d37d6f313000f5884 # v10.3.0
204
+ with:
205
+ version: "0.13.4"
206
+ enable-cache: false
207
+ python-version: "3.13"
208
+ - name: Setup Rust
209
+ uses: dtolnay/rust-toolchain@683b588c487a69d01f6c6ddf40f036ff682cc2c8 # master
210
+ with:
211
+ toolchain: stable
212
+ # Так собирают из исходников conda-forge и дистрибутивы: с Cargo.lock из архива
213
+ - name: Build wheel from sdist
214
+ run: |
215
+ mkdir build
216
+ tar xzf dist/*.tar.gz -C build
217
+ cd build/*/
218
+ uvx maturin@1.15.0 build --release --locked --out ../../wheel
219
+ - name: Smoke test
220
+ run: >-
221
+ uv run --isolated --no-project --no-index --no-build --find-links wheel --with rumorph
222
+ python scripts/smoke.py ${{ github.event_name == 'push' && github.ref_name || '' }}
223
+
224
+ # Проверка - отдельно от заданий с правом публикации
225
+ check-distribution:
226
+ needs: [smoke, smoke-sdist]
227
+ runs-on: ubuntu-latest
228
+ timeout-minutes: 30
229
+ steps:
230
+ - name: Download distribution
231
+ uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
232
+ with:
233
+ pattern: "{wheels-*,sdist}"
234
+ path: dist
235
+ merge-multiple: true
236
+ - name: Setup uv
237
+ uses: astral-sh/setup-uv@1c37ad07a6a961277cf70c0d37d6f313000f5884 # v10.3.0
238
+ with:
239
+ version: "0.13.4"
240
+ enable-cache: false
241
+ python-version: "3.13"
242
+ - name: Check distribution
243
+ run: |
244
+ uvx twine@7.0.0 check --strict dist/*
245
+ for file in dist/*.whl; do unzip -l "$file" rumorph/data/ru.dict > /dev/null || { echo "No dictionary in $file"; exit 1; }; done
246
+ tar tzf dist/*.tar.gz | grep -q '/python/rumorph/data/ru.dict$' || { echo "No dictionary in the sdist"; exit 1; }
247
+ ls -l dist
248
+ sha256sum dist/*
249
+
250
+ testpypi:
251
+ if: github.event_name == 'push'
252
+ needs: check-distribution
253
+ runs-on: ubuntu-latest
254
+ timeout-minutes: 30
255
+ permissions:
256
+ id-token: write
257
+ steps:
258
+ - name: Download distribution
259
+ uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
260
+ with:
261
+ pattern: "{wheels-*,sdist}"
262
+ path: dist
263
+ merge-multiple: true
264
+ - name: Setup uv
265
+ uses: astral-sh/setup-uv@1c37ad07a6a961277cf70c0d37d6f313000f5884 # v10.3.0
266
+ with:
267
+ version: "0.13.4"
268
+ enable-cache: false
269
+ - name: Publish distribution
270
+ run: uv publish --publish-url https://test.pypi.org/legacy/ --trusted-publishing always dist/*
271
+
272
+ pypi:
273
+ # Версии 0.1.0.devN - только на TestPyPI
274
+ if: github.event_name == 'push' && !contains(github.ref_name, '.dev')
275
+ needs: testpypi
276
+ runs-on: ubuntu-latest
277
+ timeout-minutes: 30
278
+ environment:
279
+ name: pypi
280
+ url: https://pypi.org/project/rumorph/${{ github.ref_name }}/
281
+ permissions:
282
+ id-token: write
283
+ steps:
284
+ - name: Download distribution
285
+ uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
286
+ with:
287
+ pattern: "{wheels-*,sdist}"
288
+ path: dist
289
+ merge-multiple: true
290
+ - name: Setup uv
291
+ uses: astral-sh/setup-uv@1c37ad07a6a961277cf70c0d37d6f313000f5884 # v10.3.0
292
+ with:
293
+ version: "0.13.4"
294
+ enable-cache: false
295
+ - name: Publish distribution
296
+ run: uv publish --trusted-publishing always dist/*
@@ -0,0 +1,33 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *.egg-info/
5
+ dist/
6
+ build/
7
+
8
+ # Rust и модуль расширения
9
+ target/
10
+ python/rumorph/*.so
11
+ python/rumorph/*.pyd
12
+ python/rumorph/data/*.dict
13
+
14
+ # Окружения
15
+ .venv/
16
+ venv/
17
+ .env
18
+
19
+ # Инструменты
20
+ .coverage
21
+ coverage.xml
22
+ .mypy_cache
23
+ .pytest_cache
24
+ .ruff_cache
25
+ *.log
26
+
27
+ # Документация
28
+ site/
29
+
30
+ # Редакторы и ОС
31
+ .vscode
32
+ .idea
33
+ .DS_Store
@@ -0,0 +1,71 @@
1
+ default_install_hook_types: [pre-commit, pre-push]
2
+
3
+ repos:
4
+ - repo: https://github.com/pre-commit/pre-commit-hooks
5
+ rev: v6.0.0
6
+ hooks:
7
+ - id: trailing-whitespace
8
+ - id: end-of-file-fixer
9
+ - id: check-yaml
10
+ exclude: ^mkdocs\.yml$
11
+ - id: check-toml
12
+ - id: check-added-large-files
13
+ - id: check-merge-conflict
14
+
15
+ - repo: https://github.com/astral-sh/uv-pre-commit
16
+ rev: 0.12.12
17
+ hooks:
18
+ - id: uv-lock
19
+
20
+ - repo: local
21
+ hooks:
22
+ - id: ruff-check
23
+ name: ruff check
24
+ language: system
25
+ entry: uv run ruff check --force-exclude --fix
26
+ types_or: [python, pyi]
27
+ require_serial: true
28
+
29
+ - id: ruff-format
30
+ name: ruff format
31
+ language: system
32
+ entry: uv run ruff format --force-exclude
33
+ types_or: [python, pyi, markdown]
34
+ require_serial: true
35
+
36
+ - id: mypy
37
+ name: mypy
38
+ language: system
39
+ entry: uv run mypy
40
+ types_or: [python, pyi]
41
+ pass_filenames: false
42
+
43
+ - id: cargo-fmt
44
+ name: cargo fmt
45
+ language: system
46
+ entry: cargo fmt --all
47
+ types: [rust]
48
+ pass_filenames: false
49
+
50
+ - id: clippy
51
+ name: cargo clippy
52
+ language: system
53
+ entry: cargo clippy --workspace --all-targets -- -D warnings
54
+ types: [rust]
55
+ pass_filenames: false
56
+
57
+ - id: pytest
58
+ name: pytest
59
+ stages: [pre-push]
60
+ language: system
61
+ entry: uv run pytest --cov rumorph
62
+ pass_filenames: false
63
+ always_run: true
64
+
65
+ - id: cargo-test
66
+ name: cargo test
67
+ stages: [pre-push]
68
+ language: system
69
+ entry: cargo test -p rumorph -p rumorph-build
70
+ pass_filenames: false
71
+ always_run: true
@@ -0,0 +1 @@
1
+ 3.11