sympy-reading 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.
@@ -0,0 +1,2 @@
1
+ [run]
2
+ branch = True
@@ -0,0 +1,22 @@
1
+ {
2
+ "$schema": "https://docs.renovatebot.com/renovate-schema.json",
3
+ "extends": [
4
+ "config:recommended",
5
+ ":dependencyDashboard",
6
+ "default:pinDigestsDisabled",
7
+ "local>kitsuyui/renovate-config:npm.json5#cdad3c71e34e5abadf909c996906011bbc2b5725",
8
+ "local>kitsuyui/renovate-config:python.json5#cdad3c71e34e5abadf909c996906011bbc2b5725",
9
+ "local>kitsuyui/renovate-config:cargo.json5#cdad3c71e34e5abadf909c996906011bbc2b5725",
10
+ "local>kitsuyui/renovate-config:gha.json5#cdad3c71e34e5abadf909c996906011bbc2b5725",
11
+ "local>kitsuyui/renovate-config:pin.json5#cdad3c71e34e5abadf909c996906011bbc2b5725",
12
+ "local>kitsuyui/renovate-config:lockfile.json5#cdad3c71e34e5abadf909c996906011bbc2b5725"
13
+ ],
14
+ "git-submodules": {
15
+ "enabled": true
16
+ },
17
+ "timezone": "Asia/Tokyo",
18
+ "schedule": [
19
+ "before 9am every weekday",
20
+ "every weekend"
21
+ ]
22
+ }
@@ -0,0 +1,14 @@
1
+ name: Update gitignore file
2
+
3
+ on:
4
+ schedule:
5
+ # daily at 00:00
6
+ - cron: '0 0 * * *'
7
+
8
+ permissions:
9
+ contents: write
10
+ pull-requests: write
11
+
12
+ jobs:
13
+ update-gitignore:
14
+ uses: kitsuyui/gh-actions-workflows/.github/workflows/gitignore-in.yml@3717c78af3a5e594b7a81b063276e15fac7e08fc
@@ -0,0 +1,10 @@
1
+ name: happy-commit
2
+ on:
3
+ - pull_request
4
+ permissions:
5
+ contents: read
6
+ pull-requests: write
7
+ issues: write
8
+ jobs:
9
+ happy:
10
+ uses: kitsuyui/gh-actions-workflows/.github/workflows/happy-commit.yml@3717c78af3a5e594b7a81b063276e15fac7e08fc
@@ -0,0 +1,62 @@
1
+ name: octocov
2
+ on:
3
+ pull_request:
4
+ push:
5
+ branches:
6
+ - main
7
+
8
+ concurrency:
9
+ group: ${{ github.workflow }}-${{ github.ref }}
10
+ cancel-in-progress: true
11
+
12
+ permissions:
13
+ contents: read
14
+ pull-requests: write
15
+ checks: write
16
+
17
+ jobs:
18
+ octocov:
19
+ runs-on: macos-latest
20
+ strategy:
21
+ fail-fast: false
22
+ matrix:
23
+ python: ["3.13"]
24
+ steps:
25
+ - name: Checkout
26
+ uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
27
+ with:
28
+ persist-credentials: false
29
+
30
+ - name: install shared libraries
31
+ run: |
32
+ brew install openblas
33
+ brew install lapack
34
+
35
+ - name: Set up Python
36
+ id: setup-python
37
+ uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6
38
+ with:
39
+ python-version: "${{ matrix.python }}"
40
+
41
+ - name: Set up uv
42
+ uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # v7
43
+ with:
44
+ enable-cache: true
45
+
46
+ - name: Install dependencies
47
+ run: |
48
+ uv python pin ${{ matrix.python }}
49
+ uv sync
50
+
51
+ - name: Test
52
+ run: uv run poe test
53
+
54
+ - name: Coverage
55
+ run: uv run poe coverage-xml
56
+
57
+ # See also: https://github.com/k1LoW/octocov-action
58
+ - name: Report coverage with octocov
59
+ uses: k1LoW/octocov-action@b3b6ee60482a667950f87553abf1df63217235d9 # v1
60
+ with:
61
+ github-token: ${{ secrets.GITHUB_TOKEN }}
62
+ config: .octocov.yml
@@ -0,0 +1,98 @@
1
+ name: Packaging
2
+
3
+ on:
4
+ pull_request:
5
+ types: [opened, synchronize, reopened]
6
+ release:
7
+ # "released" events are emitted either when directly be released or be edited from pre-released.
8
+ types: [prereleased, released]
9
+
10
+ concurrency:
11
+ group: ${{ github.workflow }}-${{ github.ref }}
12
+ cancel-in-progress: true
13
+
14
+ env:
15
+ python_version: 3.13
16
+
17
+ permissions:
18
+ contents: read
19
+
20
+ jobs:
21
+ build:
22
+ runs-on: ubuntu-latest
23
+ steps:
24
+ - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
25
+ with:
26
+ persist-credentials: false
27
+
28
+ - name: Enable caching
29
+ uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # v7
30
+ with:
31
+ enable-cache: true
32
+
33
+ - run: |
34
+ uv python pin ${{ env.python_version }}
35
+ uv sync
36
+
37
+ - name: Build
38
+ run: uv build
39
+
40
+ publish-test-pypi:
41
+ name: Publish distribution to Test PyPI
42
+ if: github.event_name == 'release' && github.event.release.prerelease
43
+ needs: build
44
+ runs-on: ubuntu-latest
45
+ environment: test-pypi
46
+ permissions:
47
+ contents: read
48
+ id-token: write
49
+ steps:
50
+ - uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd
51
+ with:
52
+ persist-credentials: false
53
+
54
+ - name: Enable caching
55
+ uses: astral-sh/setup-uv@d0cc045d04ccac9d8b7881df0226f9e82c39688e
56
+ with:
57
+ enable-cache: true
58
+
59
+ - run: |
60
+ uv python pin ${{ env.python_version }}
61
+ uv sync
62
+
63
+ - name: Build
64
+ run: uv build
65
+
66
+ - name: Publish distribution to Test PyPI
67
+ uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b
68
+ with:
69
+ repository-url: https://test.pypi.org/legacy/
70
+
71
+ publish-pypi:
72
+ name: Publish distribution to PyPI
73
+ if: github.event_name == 'release' && !github.event.release.prerelease
74
+ needs: build
75
+ runs-on: ubuntu-latest
76
+ environment: pypi
77
+ permissions:
78
+ contents: read
79
+ id-token: write
80
+ steps:
81
+ - uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd
82
+ with:
83
+ persist-credentials: false
84
+
85
+ - name: Enable caching
86
+ uses: astral-sh/setup-uv@d0cc045d04ccac9d8b7881df0226f9e82c39688e
87
+ with:
88
+ enable-cache: true
89
+
90
+ - run: |
91
+ uv python pin ${{ env.python_version }}
92
+ uv sync
93
+
94
+ - name: Build
95
+ run: uv build
96
+
97
+ - name: Publish distribution to PyPI
98
+ uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b
@@ -0,0 +1,62 @@
1
+ name: Test
2
+ on:
3
+ # pull-request events are not triggered when a PR is merged
4
+ # push events are not triggered when a PR created from a fork repository
5
+ # So we need both to run tests on every PR and after merging
6
+ pull_request:
7
+ push:
8
+ branches:
9
+ - main
10
+
11
+ concurrency:
12
+ group: ${{ github.workflow }}-${{ github.ref }}
13
+ cancel-in-progress: true
14
+
15
+ permissions:
16
+ contents: read
17
+
18
+ jobs:
19
+ actionlint:
20
+ uses: kitsuyui/gh-actions-workflows/.github/workflows/actionlint.yml@3717c78af3a5e594b7a81b063276e15fac7e08fc # main
21
+ test:
22
+ runs-on: ubuntu-latest
23
+ strategy:
24
+ fail-fast: false
25
+ matrix:
26
+ python: ["3.10", "3.11", "3.12", "3.13", "3.14"]
27
+
28
+ steps:
29
+ - name: Checkout
30
+ uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
31
+
32
+ - name: Set up Python
33
+ id: setup-python
34
+ uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6
35
+ with:
36
+ python-version: "${{ matrix.python }}"
37
+
38
+ - name: Set up uv
39
+ uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # v7
40
+ with:
41
+ enable-cache: true
42
+
43
+ - name: Install dependencies
44
+ run: uv sync
45
+
46
+ - name: Lint
47
+ run: uv run poe check
48
+
49
+ - name: Check Python version
50
+ run: |
51
+ actual_version=$(uv run python --version)
52
+ expected_version="Python ${{ matrix.python }}"
53
+ if [[ "$actual_version" != *"$expected_version"* ]]; then
54
+ echo "Expected $expected_version, but got $actual_version"
55
+ exit 1
56
+ fi
57
+
58
+ - name: Test
59
+ run: uv run poe test
60
+
61
+ - name: Coverage
62
+ run: uv run poe coverage-xml
@@ -0,0 +1,8 @@
1
+ name: Spellcheck
2
+ on:
3
+ - pull_request
4
+ permissions:
5
+ contents: read
6
+ jobs:
7
+ check:
8
+ uses: kitsuyui/gh-actions-workflows/.github/workflows/spellcheck.yml@3717c78af3a5e594b7a81b063276e15fac7e08fc # main
@@ -0,0 +1,249 @@
1
+ # DO NOT EDIT THIS FILE
2
+ # Generated by gitignore.in
3
+ # Edit .gitignore.in instead of this file
4
+ # Run `gitignore.in` to build .gitignore
5
+ # -----------------------------------------------------------------------------
6
+ # gibo dump Linux
7
+ ### Generated by gibo (https://github.com/simonwhitaker/gibo)
8
+ ### https://raw.github.com/github/gitignore/4488915eec0b3a45b5c63ead28f286819c0917de/Global/Linux.gitignore
9
+
10
+ *~
11
+
12
+ # temporary files which can be created if a process still has a handle open of a deleted file
13
+ .fuse_hidden*
14
+
15
+ # KDE directory preferences
16
+ .directory
17
+
18
+ # Linux trash folder which might appear on any partition or disk
19
+ .Trash-*
20
+
21
+ # .nfs files are created when an open file is removed but is still being accessed
22
+ .nfs*
23
+ # -----------------------------------------------------------------------------
24
+ # gibo dump Windows
25
+ ### Generated by gibo (https://github.com/simonwhitaker/gibo)
26
+ ### https://raw.github.com/github/gitignore/4488915eec0b3a45b5c63ead28f286819c0917de/Global/Windows.gitignore
27
+
28
+ # Windows thumbnail cache files
29
+ Thumbs.db
30
+ Thumbs.db:encryptable
31
+ ehthumbs.db
32
+ ehthumbs_vista.db
33
+
34
+ # Dump file
35
+ *.stackdump
36
+
37
+ # Folder config file
38
+ [Dd]esktop.ini
39
+
40
+ # Recycle Bin used on file shares
41
+ $RECYCLE.BIN/
42
+
43
+ # Windows Installer files
44
+ *.cab
45
+ *.msi
46
+ *.msix
47
+ *.msm
48
+ *.msp
49
+
50
+ # Windows shortcuts
51
+ *.lnk
52
+ # -----------------------------------------------------------------------------
53
+ # gibo dump macOS
54
+ ### Generated by gibo (https://github.com/simonwhitaker/gibo)
55
+ ### https://raw.github.com/github/gitignore/4488915eec0b3a45b5c63ead28f286819c0917de/Global/macOS.gitignore
56
+
57
+ # General
58
+ .DS_Store
59
+ .AppleDouble
60
+ .LSOverride
61
+
62
+ # Icon must end with two \r
63
+ Icon
64
+
65
+ # Thumbnails
66
+ ._*
67
+
68
+ # Files that might appear in the root of a volume
69
+ .DocumentRevisions-V100
70
+ .fseventsd
71
+ .Spotlight-V100
72
+ .TemporaryItems
73
+ .Trashes
74
+ .VolumeIcon.icns
75
+ .com.apple.timemachine.donotpresent
76
+
77
+ # Directories potentially created on remote AFP share
78
+ .AppleDB
79
+ .AppleDesktop
80
+ Network Trash Folder
81
+ Temporary Items
82
+ .apdisk
83
+ # -----------------------------------------------------------------------------
84
+ # gibo dump Python
85
+ ### Generated by gibo (https://github.com/simonwhitaker/gibo)
86
+ ### https://raw.github.com/github/gitignore/4488915eec0b3a45b5c63ead28f286819c0917de/Python.gitignore
87
+
88
+ # Byte-compiled / optimized / DLL files
89
+ __pycache__/
90
+ *.py[cod]
91
+ *$py.class
92
+
93
+ # C extensions
94
+ *.so
95
+
96
+ # Distribution / packaging
97
+ .Python
98
+ build/
99
+ develop-eggs/
100
+ dist/
101
+ downloads/
102
+ eggs/
103
+ .eggs/
104
+ lib/
105
+ lib64/
106
+ parts/
107
+ sdist/
108
+ var/
109
+ wheels/
110
+ share/python-wheels/
111
+ *.egg-info/
112
+ .installed.cfg
113
+ *.egg
114
+ MANIFEST
115
+
116
+ # PyInstaller
117
+ # Usually these files are written by a python script from a template
118
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
119
+ *.manifest
120
+ *.spec
121
+
122
+ # Installer logs
123
+ pip-log.txt
124
+ pip-delete-this-directory.txt
125
+
126
+ # Unit test / coverage reports
127
+ htmlcov/
128
+ .tox/
129
+ .nox/
130
+ .coverage
131
+ .coverage.*
132
+ .cache
133
+ nosetests.xml
134
+ coverage.xml
135
+ *.cover
136
+ *.py,cover
137
+ .hypothesis/
138
+ .pytest_cache/
139
+ cover/
140
+
141
+ # Translations
142
+ *.mo
143
+ *.pot
144
+
145
+ # Django stuff:
146
+ *.log
147
+ local_settings.py
148
+ db.sqlite3
149
+ db.sqlite3-journal
150
+
151
+ # Flask stuff:
152
+ instance/
153
+ .webassets-cache
154
+
155
+ # Scrapy stuff:
156
+ .scrapy
157
+
158
+ # Sphinx documentation
159
+ docs/_build/
160
+
161
+ # PyBuilder
162
+ .pybuilder/
163
+ target/
164
+
165
+ # Jupyter Notebook
166
+ .ipynb_checkpoints
167
+
168
+ # IPython
169
+ profile_default/
170
+ ipython_config.py
171
+
172
+ # pyenv
173
+ # For a library or package, you might want to ignore these files since the code is
174
+ # intended to run in multiple environments; otherwise, check them in:
175
+ # .python-version
176
+
177
+ # pipenv
178
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
179
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
180
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
181
+ # install all needed dependencies.
182
+ #Pipfile.lock
183
+
184
+ # poetry
185
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
186
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
187
+ # commonly ignored for libraries.
188
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
189
+ #poetry.lock
190
+
191
+ # pdm
192
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
193
+ #pdm.lock
194
+ # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
195
+ # in version control.
196
+ # https://pdm.fming.dev/#use-with-ide
197
+ .pdm.toml
198
+
199
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
200
+ __pypackages__/
201
+
202
+ # Celery stuff
203
+ celerybeat-schedule
204
+ celerybeat.pid
205
+
206
+ # SageMath parsed files
207
+ *.sage.py
208
+
209
+ # Environments
210
+ .env
211
+ .venv
212
+ env/
213
+ venv/
214
+ ENV/
215
+ env.bak/
216
+ venv.bak/
217
+
218
+ # Spyder project settings
219
+ .spyderproject
220
+ .spyproject
221
+
222
+ # Rope project settings
223
+ .ropeproject
224
+
225
+ # mkdocs documentation
226
+ /site
227
+
228
+ # mypy
229
+ .mypy_cache/
230
+ .dmypy.json
231
+ dmypy.json
232
+
233
+ # Pyre type checker
234
+ .pyre/
235
+
236
+ # pytype static type analyzer
237
+ .pytype/
238
+
239
+ # Cython debug symbols
240
+ cython_debug/
241
+
242
+ # PyCharm
243
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
244
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
245
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
246
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
247
+ #.idea/
248
+ # -----------------------------------------------------------------------------
249
+ sympy_reading/_version.py
@@ -0,0 +1,5 @@
1
+ gibo dump Linux
2
+ gibo dump Windows
3
+ gibo dump macOS
4
+ gibo dump Python
5
+ echo 'sympy_reading/_version.py'
@@ -0,0 +1,22 @@
1
+ # https://github.com/k1LoW/octocov?tab=readme-ov-file#configuration
2
+ coverage:
3
+ acceptable: 98%
4
+ paths:
5
+ - coverage.xml
6
+ codeToTestRatio:
7
+ code:
8
+ - "**/*.py"
9
+ test:
10
+ - "tests/**/*.py"
11
+ testExecutionTime:
12
+ if: true
13
+ diff:
14
+ datastores:
15
+ - artifact://${GITHUB_REPOSITORY}
16
+ comment:
17
+ if: is_pull_request
18
+ updatePrevious: true
19
+ report:
20
+ if: is_default_branch
21
+ datastores:
22
+ - artifact://${GITHUB_REPOSITORY}
@@ -0,0 +1,109 @@
1
+ Metadata-Version: 2.4
2
+ Name: sympy-reading
3
+ Version: 0.1.0
4
+ Summary: Sympy equation to human-readable string
5
+ Author-email: Yui KITSU <kitsuyui+github@kitsuyui.com>
6
+ Project-URL: Homepage, https://github.com/kitsuyui/sympy-reading
7
+ Classifier: Development Status :: 3 - Alpha
8
+ Classifier: License :: OSI Approved :: BSD License
9
+ Classifier: Programming Language :: Python :: 3.10
10
+ Classifier: Programming Language :: Python :: 3.11
11
+ Classifier: Programming Language :: Python :: 3.12
12
+ Classifier: Programming Language :: Python :: 3.13
13
+ Classifier: Programming Language :: Python :: 3.14
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: Topic :: Software Development :: Libraries
16
+ Requires-Python: >=3.10
17
+ Description-Content-Type: text/markdown
18
+ Requires-Dist: sympy>=1.12
19
+
20
+ # sympy-reading
21
+
22
+ ![Coverage](https://raw.githubusercontent.com/kitsuyui/octocov-central/main/badges/kitsuyui/sympy-reading/coverage.svg)
23
+
24
+ Convert a small subset of SymPy expressions into Japanese readings.
25
+
26
+ ## Installation
27
+
28
+ ```sh
29
+ pip install sympy-reading
30
+ ```
31
+
32
+ ## Usage
33
+
34
+ ```python
35
+ import sympy
36
+ from sympy_reading import to_reading
37
+
38
+ # Single integer
39
+ print(to_reading(sympy.Integer(3)))
40
+ # => さん
41
+
42
+ # Equation: wrap in sympy.evaluate(False) to preserve the unevaluated form
43
+ with sympy.evaluate(False):
44
+ eq = sympy.Eq(sympy.Add(11, 22), 33)
45
+ print(to_reading(eq))
46
+ # => じゅういち たす にじゅうに いこーる さんじゅうさん
47
+
48
+ # Multiplication
49
+ with sympy.evaluate(False):
50
+ eq = sympy.Eq(sympy.Mul(2, 3, 4), 24)
51
+ print(to_reading(eq))
52
+ # => に かける さん かける よん いこーる にじゅうよん
53
+ ```
54
+
55
+ > **Note:** Always wrap `Add` and `Mul` expressions in `sympy.evaluate(False)`
56
+ > (or pass `evaluate=False` to the constructor). Without it, SymPy evaluates
57
+ > the expression before `to_reading()` can inspect the operator, so the
58
+ > structure is lost.
59
+
60
+ ## Supported expression scope
61
+
62
+ This package currently supports a narrow, explicit subset:
63
+
64
+ - non-negative SymPy integer constants;
65
+ - `sympy.Add` and `sympy.Mul` expressions whose operands are recursively in
66
+ the supported subset;
67
+ - `sympy.Eq` equations whose left and right sides are recursively in the
68
+ supported subset.
69
+
70
+ `Add` is read as infix `たす`, `Mul` is read as infix `かける`, and `Eq` is
71
+ read as `いこーる`.
72
+
73
+ Unsupported expressions raise `NotImplementedError`, including symbols,
74
+ negative integers, rationals, floats, functions, powers, inequalities, and
75
+ operators other than `Add` and `Mul`.
76
+
77
+ ## Version Status
78
+
79
+ This package is currently classified as `Development Status :: 3 - Alpha`.
80
+ The API may change without notice.
81
+ A stable release will be tagged when the supported expression scope stabilizes and breaking changes become unlikely.
82
+
83
+ ## Development
84
+
85
+ This repository uses [lefthook](https://lefthook.dev/) to run the same checks as CI
86
+ locally, so problems surface before they reach CI.
87
+
88
+ ```sh
89
+ # Install dependencies
90
+ uv sync
91
+
92
+ # Install the Git hooks (once; requires lefthook on your PATH)
93
+ lefthook install
94
+ ```
95
+
96
+ Once installed, the hooks run automatically:
97
+
98
+ - **pre-commit**: `uv run poe check`
99
+ - **pre-push**: `uv run poe check` and `uv run poe test`
100
+
101
+ You can also run the checks manually:
102
+
103
+ ```sh
104
+ uv run poe check
105
+ uv run poe test
106
+ ```
107
+
108
+ CI still runs the full matrix (see `.github/workflows/`); the hooks only bring that
109
+ feedback earlier on your machine.