pixelmap-multiview-python 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 (29) hide show
  1. pixelmap_multiview_python-0.1.0/.github/workflows/ci.yml +73 -0
  2. pixelmap_multiview_python-0.1.0/.github/workflows/release.yml +128 -0
  3. pixelmap_multiview_python-0.1.0/.gitignore +9 -0
  4. pixelmap_multiview_python-0.1.0/CHANGELOG.md +23 -0
  5. pixelmap_multiview_python-0.1.0/Cargo.lock +499 -0
  6. pixelmap_multiview_python-0.1.0/Cargo.toml +31 -0
  7. pixelmap_multiview_python-0.1.0/LICENSE +21 -0
  8. pixelmap_multiview_python-0.1.0/PKG-INFO +186 -0
  9. pixelmap_multiview_python-0.1.0/README.md +157 -0
  10. pixelmap_multiview_python-0.1.0/pyproject.toml +55 -0
  11. pixelmap_multiview_python-0.1.0/python/pixelmap_multiview/__init__.py +353 -0
  12. pixelmap_multiview_python-0.1.0/python/pixelmap_multiview/_errors.py +63 -0
  13. pixelmap_multiview_python-0.1.0/python/pixelmap_multiview/_events.py +164 -0
  14. pixelmap_multiview_python-0.1.0/python/pixelmap_multiview/_io.py +80 -0
  15. pixelmap_multiview_python-0.1.0/python/pixelmap_multiview/_model.py +273 -0
  16. pixelmap_multiview_python-0.1.0/python/pixelmap_multiview/_pixelmap_multiview.pyi +86 -0
  17. pixelmap_multiview_python-0.1.0/python/pixelmap_multiview/py.typed +0 -0
  18. pixelmap_multiview_python-0.1.0/src/convert.rs +121 -0
  19. pixelmap_multiview_python-0.1.0/src/errors.rs +159 -0
  20. pixelmap_multiview_python-0.1.0/src/events.rs +100 -0
  21. pixelmap_multiview_python-0.1.0/src/job.rs +150 -0
  22. pixelmap_multiview_python-0.1.0/src/lib.rs +200 -0
  23. pixelmap_multiview_python-0.1.0/src/model.rs +190 -0
  24. pixelmap_multiview_python-0.1.0/tests/conftest.py +46 -0
  25. pixelmap_multiview_python-0.1.0/tests/test_events.py +69 -0
  26. pixelmap_multiview_python-0.1.0/tests/test_export.py +74 -0
  27. pixelmap_multiview_python-0.1.0/tests/test_inputs.py +84 -0
  28. pixelmap_multiview_python-0.1.0/tests/test_job.py +56 -0
  29. pixelmap_multiview_python-0.1.0/tests/test_run.py +90 -0
@@ -0,0 +1,73 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [master]
6
+ pull_request:
7
+ workflow_dispatch:
8
+
9
+ permissions:
10
+ contents: read
11
+
12
+ env:
13
+ CARGO_TERM_COLOR: always
14
+
15
+ jobs:
16
+ test:
17
+ name: test (python ${{ matrix.python-version }})
18
+ runs-on: ubuntu-latest
19
+ strategy:
20
+ fail-fast: false
21
+ matrix:
22
+ # The wheels are abi3, so one build serves every version. Testing the oldest and
23
+ # the newest is what checks that claim; the ones in between add nothing.
24
+ python-version: ["3.9", "3.13"]
25
+ steps:
26
+ - uses: actions/checkout@v4
27
+ - uses: actions/setup-python@v5
28
+ with:
29
+ python-version: ${{ matrix.python-version }}
30
+ - uses: dtolnay/rust-toolchain@stable
31
+ - uses: Swatinem/rust-cache@v2
32
+ - run: pip install pytest numpy pillow
33
+ # `pip install .` rather than `maturin develop`: a runner has no virtualenv for
34
+ # develop to install into, and this is the path a user actually takes. pip fetches
35
+ # maturin itself from the build-system requires, and the backend compiles in release
36
+ # mode — which matters, because the tests run whole reconstructions and a debug
37
+ # build takes many minutes rather than twenty seconds.
38
+ - run: pip install .
39
+ - run: pytest -v
40
+
41
+ lint:
42
+ name: fmt + clippy + ruff
43
+ runs-on: ubuntu-latest
44
+ steps:
45
+ - uses: actions/checkout@v4
46
+ - uses: actions/setup-python@v5
47
+ with:
48
+ python-version: "3.12"
49
+ - uses: dtolnay/rust-toolchain@stable
50
+ with:
51
+ components: rustfmt, clippy
52
+ - uses: Swatinem/rust-cache@v2
53
+ - run: cargo fmt --all --check
54
+ - run: cargo clippy --all-targets -- -D warnings
55
+ - run: pip install ruff
56
+ - run: ruff check .
57
+ - run: ruff format --check .
58
+
59
+ # A tagged release publishes the sdist too, so it has to be installable from source on
60
+ # a machine with nothing but a Rust toolchain.
61
+ sdist:
62
+ name: build and install sdist
63
+ runs-on: ubuntu-latest
64
+ steps:
65
+ - uses: actions/checkout@v4
66
+ - uses: actions/setup-python@v5
67
+ with:
68
+ python-version: "3.12"
69
+ - uses: dtolnay/rust-toolchain@stable
70
+ - run: pip install maturin
71
+ - run: maturin sdist --out dist
72
+ - run: pip install --no-binary pixelmap-multiview-python dist/*.tar.gz
73
+ - run: python -c "import pixelmap_multiview as m; print(m.__version__, m.MIN_VIEWS)"
@@ -0,0 +1,128 @@
1
+ name: Release
2
+
3
+ on:
4
+ push:
5
+ tags: ["v*"]
6
+ workflow_dispatch:
7
+
8
+ permissions:
9
+ contents: read
10
+
11
+ jobs:
12
+ # PyPI does not allow a version to be replaced, so a tag that disagrees with the
13
+ # manifest would publish under the wrong number with no way to take it back.
14
+ check-version:
15
+ name: tag matches Cargo.toml
16
+ runs-on: ubuntu-latest
17
+ steps:
18
+ - uses: actions/checkout@v4
19
+ - name: Compare
20
+ if: startsWith(github.ref, 'refs/tags/')
21
+ run: |
22
+ manifest=$(grep -m1 '^version = ' Cargo.toml | cut -d'"' -f2)
23
+ tag="${GITHUB_REF_NAME#v}"
24
+ if [ "$manifest" != "$tag" ]; then
25
+ echo "tag $GITHUB_REF_NAME does not match Cargo.toml version $manifest" >&2
26
+ exit 1
27
+ fi
28
+ echo "publishing version $manifest"
29
+
30
+ wheels:
31
+ needs: check-version
32
+ name: wheels (${{ matrix.platform.runner }} ${{ matrix.platform.target }}${{ matrix.platform.manylinux == 'musllinux_1_2' && ' musl' || '' }})
33
+ runs-on: ${{ matrix.platform.runner }}
34
+ strategy:
35
+ fail-fast: false
36
+ matrix:
37
+ platform:
38
+ - runner: ubuntu-22.04
39
+ target: x86_64
40
+ manylinux: auto
41
+ - runner: ubuntu-22.04
42
+ target: aarch64
43
+ manylinux: auto
44
+ - runner: ubuntu-22.04
45
+ target: x86_64
46
+ manylinux: musllinux_1_2
47
+ # The labels `maturin generate-ci` emits. macos-13 was retired and a job asking
48
+ # for a label that no longer exists queues forever rather than failing, so this
49
+ # is worth re-checking against the runner-images README when a release stalls.
50
+ - runner: macos-latest
51
+ target: aarch64
52
+ - runner: macos-15-intel
53
+ target: x86_64
54
+ - runner: windows-latest
55
+ target: x64
56
+ steps:
57
+ - uses: actions/checkout@v4
58
+ - uses: actions/setup-python@v5
59
+ with:
60
+ python-version: "3.12"
61
+ - name: Build wheel
62
+ uses: PyO3/maturin-action@v1
63
+ with:
64
+ target: ${{ matrix.platform.target }}
65
+ # One abi3 wheel per platform covers CPython 3.9 and up.
66
+ args: --release --out dist
67
+ manylinux: ${{ matrix.platform.manylinux }}
68
+ sccache: "true"
69
+ - uses: actions/upload-artifact@v4
70
+ with:
71
+ name: wheels-${{ matrix.platform.runner }}-${{ matrix.platform.target }}-${{ matrix.platform.manylinux || 'native' }}
72
+ path: dist
73
+
74
+ sdist:
75
+ name: sdist
76
+ runs-on: ubuntu-latest
77
+ steps:
78
+ - uses: actions/checkout@v4
79
+ - uses: PyO3/maturin-action@v1
80
+ with:
81
+ command: sdist
82
+ args: --out dist
83
+ - uses: actions/upload-artifact@v4
84
+ with:
85
+ name: wheels-sdist
86
+ path: dist
87
+
88
+ # Smoke-test the artefacts before they go anywhere permanent: PyPI does not allow a
89
+ # version to be replaced, so a broken wheel there is a bumped version, not a fix.
90
+ verify:
91
+ name: install and import each wheel
92
+ needs: [wheels, sdist]
93
+ runs-on: ubuntu-latest
94
+ steps:
95
+ - uses: actions/setup-python@v5
96
+ with:
97
+ python-version: "3.12"
98
+ - uses: actions/download-artifact@v4
99
+ with:
100
+ pattern: wheels-*
101
+ merge-multiple: true
102
+ path: dist
103
+ - run: ls -la dist
104
+ - run: pip install numpy && pip install dist/*manylinux*x86_64.whl
105
+ - run: python -c "import pixelmap_multiview as m; p=m._pixelmap_multiview._synthetic_orbit('corner',4,36.0,640,480); print(m.reconstruct(p))"
106
+
107
+ publish:
108
+ name: publish to PyPI
109
+ needs: verify
110
+ # Only a tag publishes. This is what makes `workflow_dispatch` a dry run: it builds
111
+ # every wheel and the sdist, verifies one installs, and stops. Without it, anyone
112
+ # clicking "Run workflow" would upload to PyPI, where a version cannot be replaced.
113
+ if: startsWith(github.ref, 'refs/tags/')
114
+ runs-on: ubuntu-latest
115
+ environment:
116
+ name: pypi
117
+ url: https://pypi.org/p/pixelmap-multiview-python
118
+ permissions:
119
+ # Trusted Publishing: PyPI verifies this workflow's OIDC identity, so there is no
120
+ # API token to store or rotate. Register the publisher on PyPI before the first tag.
121
+ id-token: write
122
+ steps:
123
+ - uses: actions/download-artifact@v4
124
+ with:
125
+ pattern: wheels-*
126
+ merge-multiple: true
127
+ path: dist
128
+ - uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,9 @@
1
+ /target
2
+ /dist
3
+ /.venv
4
+ __pycache__/
5
+ *.so
6
+ *.pyc
7
+ .pytest_cache/
8
+ .ruff_cache/
9
+ /.idea
@@ -0,0 +1,23 @@
1
+ # Changelog
2
+
3
+ All notable changes to this package are documented here. The format follows
4
+ [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and the package follows
5
+ [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
+
7
+ ## 0.1.0 - 2026-09-26
8
+
9
+ First release, built against `pixelmap_multiview` 0.1.0.
10
+
11
+ ### Added
12
+
13
+ - `reconstruct`, which goes from photos to a textured mesh in one call, with typed
14
+ progress events through `on_event`. An exception raised there, or Ctrl-C, stops the run.
15
+ - `Job`, which runs a reconstruction on a background thread that can be iterated, polled
16
+ and cancelled.
17
+ - `Model`, which holds the mesh, vertex colours, texture atlas, intrinsics, a pose per
18
+ photo and a report on every pair as NumPy arrays and dataclasses. `Model.save` writes
19
+ OBJ with MTL and PNG, X3D, or PLY.
20
+ - `load_photos`, which reads photos with Pillow, turns them upright, scales them, and
21
+ reads the 35 mm-equivalent focal length from EXIF.
22
+ - `InvalidInputError`, `ReconstructionError` and `CancelledError`, which carry the failing
23
+ stage, a stable `reason` and the failure's details as attributes.