quatham 0.2.0rc0__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 (38) hide show
  1. quatham-0.2.0rc0/.codecov.yml +32 -0
  2. quatham-0.2.0rc0/.github/workflows/docs.yml +64 -0
  3. quatham-0.2.0rc0/.github/workflows/release.yml +44 -0
  4. quatham-0.2.0rc0/.github/workflows/tests.yml +48 -0
  5. quatham-0.2.0rc0/.gitignore +306 -0
  6. quatham-0.2.0rc0/.gitlab-ci.yml +16 -0
  7. quatham-0.2.0rc0/AGENTS.md +123 -0
  8. quatham-0.2.0rc0/CONTRIBUTING.md +284 -0
  9. quatham-0.2.0rc0/HATCH_VCS_SETUP.md +282 -0
  10. quatham-0.2.0rc0/LICENSE +28 -0
  11. quatham-0.2.0rc0/PKG-INFO +274 -0
  12. quatham-0.2.0rc0/README.md +238 -0
  13. quatham-0.2.0rc0/SETUP_CHECKLIST.md +134 -0
  14. quatham-0.2.0rc0/docs/RELEASE_WORKFLOW.md +222 -0
  15. quatham-0.2.0rc0/docs/ZENSICAL_MIGRATION.md +164 -0
  16. quatham-0.2.0rc0/docs/css/version.css +16 -0
  17. quatham-0.2.0rc0/docs/getting-started/concepts.md +132 -0
  18. quatham-0.2.0rc0/docs/getting-started/installation.md +73 -0
  19. quatham-0.2.0rc0/docs/getting-started/quick-start.md +98 -0
  20. quatham-0.2.0rc0/docs/index.md +56 -0
  21. quatham-0.2.0rc0/docs/reference/quaternion.md +50 -0
  22. quatham-0.2.0rc0/docs/reference/utilities.md +73 -0
  23. quatham-0.2.0rc0/docs/reference/version.md +62 -0
  24. quatham-0.2.0rc0/docs/tutorials/arithmetic.md +214 -0
  25. quatham-0.2.0rc0/docs/tutorials/batch-operations.md +292 -0
  26. quatham-0.2.0rc0/docs/tutorials/conversions.md +236 -0
  27. quatham-0.2.0rc0/docs/tutorials/creating-quaternions.md +171 -0
  28. quatham-0.2.0rc0/docs_hooks.py +37 -0
  29. quatham-0.2.0rc0/mkdocs.yml +119 -0
  30. quatham-0.2.0rc0/pyproject.toml +90 -0
  31. quatham-0.2.0rc0/src/quatham/Quaternion.py +770 -0
  32. quatham-0.2.0rc0/src/quatham/__init__.py +50 -0
  33. quatham-0.2.0rc0/src/quatham/__version__.py +7 -0
  34. quatham-0.2.0rc0/src/quatham/utilities.py +769 -0
  35. quatham-0.2.0rc0/tests/test_algebra.py +215 -0
  36. quatham-0.2.0rc0/tests/test_conversions.py +255 -0
  37. quatham-0.2.0rc0/tests/test_utilities.py +91 -0
  38. quatham-0.2.0rc0/uv.lock +2320 -0
@@ -0,0 +1,32 @@
1
+ # Codecov Configuration
2
+ # See: https://docs.codecov.com/docs/codecov-yaml
3
+
4
+ codecov:
5
+ require_ci_to_pass: true
6
+ notify:
7
+ after_n_builds: 1 # Wait for all Python versions to complete
8
+
9
+ coverage:
10
+ status:
11
+ project:
12
+ default:
13
+ # Allow a small drop in coverage
14
+ threshold: 1%
15
+ target: auto # Auto-adjusts based on historical coverage
16
+ if_ci_failed: error
17
+
18
+ patch:
19
+ default:
20
+ # New code should be well-tested
21
+ target: 80%
22
+ threshold: 5%
23
+
24
+ comment:
25
+ layout: "header, diff, flags, components"
26
+ behavior: default
27
+ require_changes: false # Comment even if no changes (good for visibility)
28
+
29
+ ignore:
30
+ - "tests/**"
31
+ - "docs/**"
32
+ - "site/**"
@@ -0,0 +1,64 @@
1
+ name: Deploy Documentation
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+ paths:
8
+ - 'docs/**'
9
+ - 'src/quatham/**'
10
+ - 'mkdocs.yml'
11
+ - 'README.md'
12
+ workflow_dispatch:
13
+
14
+ permissions:
15
+ contents: read
16
+ pages: write
17
+ id-token: write
18
+
19
+ concurrency:
20
+ group: "pages"
21
+ cancel-in-progress: false
22
+
23
+ jobs:
24
+ build:
25
+ runs-on: ubuntu-latest
26
+ steps:
27
+ - name: Checkout repository
28
+ uses: actions/checkout@v4
29
+
30
+ - name: Set up Python
31
+ uses: actions/setup-python@v5
32
+ with:
33
+ python-version: '3.12'
34
+
35
+ - name: Install uv
36
+ uses: astral-sh/setup-uv@v5
37
+ with:
38
+ enable-cache: true
39
+
40
+ - name: Install dependencies
41
+ run: |
42
+ uv sync --group docs
43
+
44
+ - name: Build documentation
45
+ run: uv run zensical build
46
+
47
+ - name: Setup Pages
48
+ uses: actions/configure-pages@v5
49
+
50
+ - name: Upload artifact
51
+ uses: actions/upload-pages-artifact@v3
52
+ with:
53
+ path: './site'
54
+
55
+ deploy:
56
+ environment:
57
+ name: github-pages
58
+ url: ${{ steps.deployment.outputs.page_url }}
59
+ runs-on: ubuntu-latest
60
+ needs: build
61
+ steps:
62
+ - name: Deploy to GitHub Pages
63
+ id: deployment
64
+ uses: actions/deploy-pages@v4
@@ -0,0 +1,44 @@
1
+ name: Release to PyPI
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - '*' # Trigger on any tag
7
+
8
+ permissions:
9
+ contents: read
10
+ id-token: write # Required for trusted publishing to PyPI
11
+
12
+ jobs:
13
+ release:
14
+ runs-on: ubuntu-latest
15
+ environment:
16
+ name: pypi
17
+ url: https://pypi.org/project/quatham/
18
+
19
+ steps:
20
+ - name: Checkout repository
21
+ uses: actions/checkout@v4
22
+ with:
23
+ fetch-depth: 0 # Get all history for hatch-vcs
24
+
25
+ - name: Install uv
26
+ uses: astral-sh/setup-uv@v5
27
+ with:
28
+ enable-cache: true
29
+
30
+ - name: Set up Python
31
+ uses: actions/setup-python@v5
32
+ with:
33
+ python-version: '3.12'
34
+
35
+ - name: Install dependencies
36
+ run: uv sync --group dev
37
+
38
+ - name: Build package
39
+ run: uv build
40
+
41
+ - name: Publish to PyPI
42
+ uses: pypa/gh-action-pypi-publish@release/v1
43
+ with:
44
+ verbose: true
@@ -0,0 +1,48 @@
1
+ name: Tests
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+ pull_request:
8
+ branches:
9
+ - main
10
+ workflow_dispatch:
11
+
12
+ jobs:
13
+ test:
14
+ runs-on: ubuntu-latest
15
+ strategy:
16
+ matrix:
17
+ python-version: ['3.12', '3.13', '3.14']
18
+
19
+ steps:
20
+ - name: Checkout
21
+ uses: actions/checkout@v4
22
+ with:
23
+ fetch-depth: 2
24
+
25
+ - name: Set up Python
26
+ uses: actions/setup-python@v5
27
+ with:
28
+ python-version: ${{ matrix.python-version }}
29
+
30
+ - name: Install uv
31
+ uses: astral-sh/setup-uv@v5
32
+ with:
33
+ enable-cache: true
34
+
35
+ - name: Install dependencies
36
+ run: uv sync --group tests
37
+
38
+ - name: Test with pytest
39
+ run: |
40
+ uv run pytest --cov=src/quatham --cov-report=xml --junitxml=junit.xml -o junit_family=legacy
41
+
42
+ - name: Upload coverage and tests to Codecov
43
+ uses: codecov/codecov-action@v5
44
+ if: always()
45
+ with:
46
+ files: ./coverage.xml,./junit.xml
47
+ flags: python-${{ matrix.python-version }}
48
+ verbose: true
@@ -0,0 +1,306 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ pip-wheel-metadata/
24
+ share/python-wheels/
25
+ *.egg-info/
26
+ .installed.cfg
27
+ *.egg
28
+ MANIFEST
29
+
30
+ # PyInstaller
31
+ # Usually these files are written by a python script from a template
32
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
33
+ *.manifest
34
+ *.spec
35
+
36
+ # Installer logs
37
+ pip-log.txt
38
+ pip-delete-this-directory.txt
39
+
40
+ # Unit test / coverage reports
41
+ htmlcov/
42
+ .tox/
43
+ .nox/
44
+ .coverage
45
+ .coverage.*
46
+ .cache
47
+ nosetests.xml
48
+ coverage.xml
49
+ *.cover
50
+ *.py,cover
51
+ .hypothesis/
52
+ .pytest_cache/
53
+
54
+ # Translations
55
+ *.mo
56
+ *.pot
57
+
58
+ # Django stuff:
59
+ *.log
60
+ local_settings.py
61
+ db.sqlite3
62
+ db.sqlite3-journal
63
+
64
+ # Flask stuff:
65
+ instance/
66
+ .webassets-cache
67
+
68
+ # Scrapy stuff:
69
+ .scrapy
70
+
71
+ # Sphinx documentation
72
+ docs/_build/
73
+
74
+ # PyBuilder
75
+ target/
76
+
77
+ # Jupyter Notebook
78
+ .ipynb_checkpoints
79
+
80
+ # IPython
81
+ profile_default/
82
+ ipython_config.py
83
+
84
+ # pyenv
85
+ .python-version
86
+
87
+ # pipenv
88
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
89
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
90
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
91
+ # install all needed dependencies.
92
+ #Pipfile.lock
93
+
94
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow
95
+ __pypackages__/
96
+
97
+ # Celery stuff
98
+ celerybeat-schedule
99
+ celerybeat.pid
100
+
101
+ # SageMath parsed files
102
+ *.sage.py
103
+
104
+ # Environments
105
+ .env
106
+ .venv
107
+ env/
108
+ venv/
109
+ ENV/
110
+ env.bak/
111
+ venv.bak/
112
+
113
+ # Spyder project settings
114
+ .spyderproject
115
+ .spyproject
116
+
117
+ # Rope project settings
118
+ .ropeproject
119
+
120
+ # mkdocs documentation
121
+ /site
122
+ site/
123
+
124
+ # mypy
125
+ .mypy_cache/
126
+ .dmypy.json
127
+ dmypy.json
128
+
129
+ # Pyre type checker
130
+ .pyre/
131
+
132
+ ### Linux ###
133
+ *~
134
+
135
+ # temporary files which can be created if a process still has a handle open of a deleted file
136
+ .fuse_hidden*
137
+
138
+ # KDE directory preferences
139
+ .directory
140
+
141
+ # Linux trash folder which might appear on any partition or disk
142
+ .Trash-*
143
+
144
+ # .nfs files are created when an open file is removed but is still being accessed
145
+ .nfs*
146
+
147
+ ### PyCharm ###
148
+ # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
149
+ # Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
150
+
151
+ # Just ignore all pycharm files
152
+ .idea/**
153
+ .ai/**
154
+
155
+ # User-specific stuff
156
+ .idea/**/workspace.xml
157
+ .idea/**/tasks.xml
158
+ .idea/**/usage.statistics.xml
159
+ .idea/**/dictionaries
160
+ .idea/**/shelf
161
+
162
+ # Generated files
163
+ .idea/**/contentModel.xml
164
+
165
+ # Sensitive or high-churn files
166
+ .idea/**/dataSources/
167
+ .idea/**/dataSources.ids
168
+ .idea/**/dataSources.local.xml
169
+ .idea/**/sqlDataSources.xml
170
+ .idea/**/dynamic.xml
171
+ .idea/**/uiDesigner.xml
172
+ .idea/**/dbnavigator.xml
173
+
174
+ # Gradle
175
+ .idea/**/gradle.xml
176
+ .idea/**/libraries
177
+
178
+ # Gradle and Maven with auto-import
179
+ # When using Gradle or Maven with auto-import, you should exclude module files,
180
+ # since they will be recreated, and may cause churn. Uncomment if using
181
+ # auto-import.
182
+ # .idea/artifacts
183
+ # .idea/compiler.xml
184
+ # .idea/jarRepositories.xml
185
+ # .idea/modules.xml
186
+ # .idea/*.iml
187
+ # .idea/modules
188
+ # *.iml
189
+ # *.ipr
190
+
191
+ # CMake
192
+ cmake-build-*/
193
+
194
+ # Mongo Explorer plugin
195
+ .idea/**/mongoSettings.xml
196
+
197
+ # File-based project format
198
+ *.iws
199
+
200
+ # IntelliJ
201
+ out/
202
+
203
+ # mpeltonen/sbt-idea plugin
204
+ .idea_modules/
205
+
206
+ # JIRA plugin
207
+ atlassian-ide-plugin.xml
208
+
209
+ # Cursive Clojure plugin
210
+ .idea/replstate.xml
211
+
212
+ # Crashlytics plugin (for Android Studio and IntelliJ)
213
+ com_crashlytics_export_strings.xml
214
+ crashlytics.properties
215
+ crashlytics-build.properties
216
+ fabric.properties
217
+
218
+ # Editor-based Rest Client
219
+ .idea/httpRequests
220
+
221
+ # Android studio 3.1+ serialized cache file
222
+ .idea/caches/build_file_checksums.ser
223
+
224
+ ### PyCharm Patch ###
225
+ # Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721
226
+
227
+ # *.iml
228
+ modules.xml
229
+ .idea/misc.xml
230
+ # *.ipr
231
+
232
+ # Sonarlint plugin
233
+ # https://plugins.jetbrains.com/plugin/7973-sonarlint
234
+ .idea/**/sonarlint/
235
+
236
+ # SonarQube Plugin
237
+ # https://plugins.jetbrains.com/plugin/7238-sonarqube-community-plugin
238
+ .idea/**/sonarIssues.xml
239
+
240
+ # Markdown Navigator plugin
241
+ # https://plugins.jetbrains.com/plugin/7896-markdown-navigator-enhanced
242
+ .idea/**/markdown-navigator.xml
243
+ .idea/**/markdown-navigator-enh.xml
244
+ .idea/**/markdown-navigator/
245
+
246
+ # Cache file creation bug
247
+ # See https://youtrack.jetbrains.com/issue/JBR-2257
248
+ .idea/$CACHE_FILE$
249
+
250
+ # CodeStream plugin
251
+ # https://plugins.jetbrains.com/plugin/12206-codestream
252
+ .idea/codestream.xml
253
+
254
+ ### vscode ###
255
+ .vscode/*
256
+ !.vscode/settings.json
257
+ !.vscode/tasks.json
258
+ !.vscode/launch.json
259
+ !.vscode/extensions.json
260
+ *.code-workspace
261
+
262
+ ### Windows ###
263
+ # Windows thumbnail cache files
264
+ Thumbs.db
265
+ Thumbs.db:encryptable
266
+ ehthumbs.db
267
+ ehthumbs_vista.db
268
+
269
+ # Dump file
270
+ *.stackdump
271
+
272
+ # Folder config file
273
+ [Dd]esktop.ini
274
+
275
+ # Recycle Bin used on file shares
276
+ $RECYCLE.BIN/
277
+
278
+ # Windows Installer files
279
+ *.cab
280
+ *.msi
281
+ *.msix
282
+ *.msm
283
+ *.msp
284
+
285
+ # Windows shortcuts
286
+ *.lnk
287
+
288
+ # VTK files
289
+ *.vtk
290
+ *.vti
291
+ *.vtr
292
+ *.vts
293
+ *.vtp
294
+ *.vtu
295
+ *.vtm
296
+ *.vtkhdf
297
+
298
+ # Images
299
+ *.jpg
300
+ *.png
301
+
302
+ # D2C data
303
+ *.h5
304
+ *.hdf
305
+ *.hdf5
306
+ *.pkl
@@ -0,0 +1,16 @@
1
+ # You can override the included template(s) by including variable overrides
2
+ # SAST customization: https://docs.gitlab.com/user/application_security/sast/#available-cicd-variables
3
+ # Secret Detection customization: https://docs.gitlab.com/user/application_security/secret_detection/pipeline/configure/
4
+ # Dependency Scanning customization: https://docs.gitlab.com/user/application_security/dependency_scanning/#customizing-analyzer-behavior
5
+ # Container Scanning customization: https://docs.gitlab.com/user/application_security/container_scanning/#customizing-analyzer-behavior
6
+ # Note that environment variables can be set in several places
7
+ # See https://docs.gitlab.com/ci/variables/#cicd-variable-precedence
8
+ stages:
9
+ - test
10
+ - secret-detection
11
+ variables:
12
+ SECRET_DETECTION_ENABLED: 'true'
13
+ secret_detection:
14
+ stage: secret-detection
15
+ include:
16
+ - template: Security/Secret-Detection.gitlab-ci.yml
@@ -0,0 +1,123 @@
1
+ # AGENTS.md
2
+
3
+ ## Project Overview
4
+ - **Package**: `quatham` (import as `hammy`) — NumPy/Numba-accelerated quaternion mathematics for 3D rotations
5
+ - **Structure**: Single-package layout under `src/quatham/`
6
+ - **Python**: 3.12+
7
+ - **Package manager**: `uv` (lockfile: `uv.lock`)
8
+
9
+ ## Developer Commands
10
+
11
+ ```bash
12
+ # Install dependencies
13
+ uv sync
14
+
15
+ # Run all tests
16
+ uv run pytest
17
+
18
+ # Run tests with coverage
19
+ uv run pytest --cov=hammy
20
+
21
+ # Run a single test file
22
+ uv run pytest tests/test_algebra.py
23
+
24
+ # Run a specific test
25
+ uv run pytest tests/test_algebra.py::TestQuaternionAlgebra::test_identity_and_conjugate
26
+
27
+ # Lint with ruff
28
+ uv run ruff check src/ tests/
29
+
30
+ # Format with ruff
31
+ uv run ruff format src/ tests/
32
+ ```
33
+
34
+ ## Architecture Notes
35
+
36
+ ### Source Files
37
+ - `src/quatham/Quaternion.py` — Main `Quaternion` class with algebraic operations and conversions
38
+ - `src/quatham/utilities.py` — Low-level Numba-jitted math functions (`@njit(cache=True)`)
39
+ - `src/quatham/__init__.py` — Exports `Quaternion` class
40
+
41
+ ### Test Files
42
+ - `tests/test_algebra.py` — Quaternion algebra, normalization, arithmetic operations
43
+ - `tests/test_conversions.py` — Euler/Tait-Bryan angle conversions, rotation matrices, axis-angle
44
+
45
+ ### Key Conventions (critical for correctness)
46
+ - **Scalar-first**: Quaternions use `[w, x, y, z]` ordering throughout
47
+ - **Intrinsic rotations**: Default for `from_euler()`, `to_euler()`, `to_tait_bryan()`
48
+ - **Double-cover SO(3)**: `q` and `-q` represent identical spatial rotations
49
+ - **Batch support**: All operations handle single quaternions `(4,)` and arrays `(N, 4)`
50
+
51
+ ### Numba Functions
52
+ - Utilities use `@njit(cache=True)` — changes may require clearing `__pycache__` or `.ruff_cache/` to see effects during development
53
+
54
+
55
+ ## Lint/Format Rules (ruff)
56
+ Maintain PEP 8 compliance. Recommended tools:
57
+
58
+ - **Linting:** `ruff check dice.py`
59
+ - **Formatting:** `ruff format dice.py`
60
+ - Line length: 120
61
+ - Select: E, F, UP, B, SIM, I, D (pydocstyle numpy convention)
62
+ - Ignore: D103 (missing docstring in __init__)
63
+
64
+ ## Code Style Guidelines
65
+ ### General Principles
66
+ - **Simplicity:** Keep the logic straightforward. Avoid over-engineering for a single-file utility.
67
+ - **Readability:** Prioritize clear, descriptive names over brevity.
68
+
69
+ ### Naming Conventions
70
+ - **Functions:** Use `snake_case` (e.g., `generate_dice_faces_diagram`).
71
+ - **Variables:** Use `snake_case` (e.g., `roll_results`).
72
+ - **Constants:** Use `SCREAMING_SNAKE_CASE` (e.g., `DICE_ART`, `DIE_HEIGHT`).
73
+ - **Internal Helpers:** Prefix with a single underscore (e.g., `_get_dice_faces`).
74
+
75
+ ### Imports
76
+ - Place standard library imports at the top of the file.
77
+ - Keep them alphabetised within their group.
78
+ - Example:
79
+ ```python
80
+ import random
81
+ import sys
82
+ ```
83
+
84
+ ### Documentation Guidelines
85
+ - Use triple-quoted docstrings for all functions.
86
+ - The first line should be a concise summary.
87
+ - Follow with a more detailed explanation if the function's logic or parameters aren't trivial.
88
+ - Use NumPy style docstrings. Add details for extended summary, parameters, yields, returns and examples where appropriate.
89
+ - Example:
90
+ ```python
91
+ def roll_dice(num_dice):
92
+ """Return a list of random integers between 1 and 6.
93
+
94
+ Parameters
95
+ ----------
96
+ num_dice : int
97
+ Number of dice to be rolled.
98
+ """
99
+ # Implementation
100
+ ```
101
+
102
+ ### Language
103
+ - Use British English spelling throughout the codebase.
104
+ - Applies to: comments, docstrings, documentation, error messages, and variable names.
105
+ - Examples: `colour` not `color`, `analyse` not `analyze`, `behaviour` not `behavior`.
106
+
107
+ ## Git Workflow
108
+ - Do not commit, push, merge, or force-push without approval.
109
+ - Do not include unrelated formatting changes.
110
+ - Keep migrations and generated files in the same change as the code that requires them.
111
+ - Summarise user-visible behaviour and validation in the pull request.
112
+
113
+ ## Python Guidelines
114
+ - Follow PEP 8 style conventions
115
+ - Add type hints to all new and modified functions
116
+ - Prefer specific exception types over bare `except` clauses
117
+ - Use context managers for file I/O and database connections
118
+ - Write descriptive error messages that include the offending value
119
+ - Keep user comments when refactoring or modifying code. Reposition if necessary, but they were put there for a reason.
120
+
121
+ ## CI/CD
122
+ - GitLab CI (`.gitlab-ci.yml`): Runs pytest + secret detection
123
+ - No GitHub Actions configured