fitscube-rs 1.0.1__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 (36) hide show
  1. fitscube_rs-1.0.1/.cargo/config.toml +4 -0
  2. fitscube_rs-1.0.1/.github/workflows/cd.yml +146 -0
  3. fitscube_rs-1.0.1/.github/workflows/ci.yml +116 -0
  4. fitscube_rs-1.0.1/.gitignore +137 -0
  5. fitscube_rs-1.0.1/.pre-commit-config.yaml +62 -0
  6. fitscube_rs-1.0.1/.readthedocs.yaml +18 -0
  7. fitscube_rs-1.0.1/Cargo.lock +1782 -0
  8. fitscube_rs-1.0.1/Cargo.toml +71 -0
  9. fitscube_rs-1.0.1/LICENSE +29 -0
  10. fitscube_rs-1.0.1/NOTICE.md +29 -0
  11. fitscube_rs-1.0.1/PKG-INFO +130 -0
  12. fitscube_rs-1.0.1/README.md +105 -0
  13. fitscube_rs-1.0.1/docs/_static/.gitkeep +0 -0
  14. fitscube_rs-1.0.1/docs/algorithms.md +90 -0
  15. fitscube_rs-1.0.1/docs/cli.md +73 -0
  16. fitscube_rs-1.0.1/docs/conf.py +131 -0
  17. fitscube_rs-1.0.1/docs/index.md +26 -0
  18. fitscube_rs-1.0.1/docs/quickstart.md +114 -0
  19. fitscube_rs-1.0.1/examples/io_probe.rs +114 -0
  20. fitscube_rs-1.0.1/fitscube_rs/__init__.py +18 -0
  21. fitscube_rs-1.0.1/fitscube_rs/_fitscube_rs/__init__.pyi +61 -0
  22. fitscube_rs-1.0.1/pyproject.toml +104 -0
  23. fitscube_rs-1.0.1/scripts/benchmark.py +114 -0
  24. fitscube_rs-1.0.1/src/beams.rs +163 -0
  25. fitscube_rs-1.0.1/src/bounding_box.rs +215 -0
  26. fitscube_rs-1.0.1/src/combine.rs +504 -0
  27. fitscube_rs-1.0.1/src/error.rs +88 -0
  28. fitscube_rs-1.0.1/src/extract.rs +406 -0
  29. fitscube_rs-1.0.1/src/fits_io.rs +13 -0
  30. fitscube_rs-1.0.1/src/lib.rs +35 -0
  31. fitscube_rs-1.0.1/src/main.rs +175 -0
  32. fitscube_rs-1.0.1/src/python.rs +164 -0
  33. fitscube_rs-1.0.1/src/specs.rs +262 -0
  34. fitscube_rs-1.0.1/tests/combine_roundtrip.rs +161 -0
  35. fitscube_rs-1.0.1/tests/test_parity.py +282 -0
  36. fitscube_rs-1.0.1/uv.lock +2591 -0
@@ -0,0 +1,4 @@
1
+ # Allow Python symbols to be resolved at runtime (required for pyo3 extension modules
2
+ # and for the stub_gen binary, which uses pyo3 type info without calling Python).
3
+ [target.aarch64-apple-darwin]
4
+ rustflags = ["-C", "link-arg=-undefined", "-C", "link-arg=dynamic_lookup"]
@@ -0,0 +1,146 @@
1
+ name: CD
2
+
3
+ on:
4
+ workflow_dispatch:
5
+ pull_request:
6
+ push:
7
+ branches:
8
+ - main
9
+ release:
10
+ types:
11
+ - published
12
+
13
+ concurrency:
14
+ group: ${{ github.workflow }}-${{ github.ref }}
15
+ cancel-in-progress: true
16
+
17
+ env:
18
+ FORCE_COLOR: 3
19
+
20
+ jobs:
21
+ sdist:
22
+ name: Build sdist
23
+ runs-on: ubuntu-latest
24
+ steps:
25
+ - uses: actions/checkout@v6
26
+
27
+ - name: Install cargo-edit
28
+ if: github.event_name == 'release'
29
+ uses: taiki-e/install-action@v2
30
+ with:
31
+ tool: cargo-edit
32
+
33
+ - name: Pin version from release tag
34
+ if: github.event_name == 'release'
35
+ shell: bash
36
+ env:
37
+ RELEASE_TAG: ${{ github.event.release.tag_name }}
38
+ run: cargo set-version "${RELEASE_TAG#v}"
39
+
40
+ - name: Build sdist
41
+ uses: PyO3/maturin-action@v1
42
+ with:
43
+ command: sdist
44
+ args: --out dist
45
+
46
+ - uses: actions/upload-artifact@v4
47
+ with:
48
+ name: dist-sdist
49
+ path: dist/*.tar.gz
50
+
51
+ wheels:
52
+ name: Wheels (${{ matrix.platform }}, ${{ matrix.target }})
53
+ runs-on: ${{ matrix.runner }}
54
+ strategy:
55
+ fail-fast: false
56
+ matrix:
57
+ include:
58
+ - { platform: linux, runner: ubuntu-latest, target: x86_64 }
59
+ - { platform: linux, runner: ubuntu-latest, target: aarch64 }
60
+ - { platform: macos, runner: macos-14, target: aarch64 }
61
+ # No Windows wheel: cfitsio can't be built from source under MSVC.
62
+ # Windows users can build from the sdist or use conda/WSL.
63
+ steps:
64
+ - uses: actions/checkout@v6
65
+
66
+ - name: Install cargo-edit
67
+ if: github.event_name == 'release'
68
+ uses: taiki-e/install-action@v2
69
+ with:
70
+ tool: cargo-edit
71
+
72
+ - name: Pin version from release tag
73
+ if: github.event_name == 'release'
74
+ shell: bash
75
+ env:
76
+ RELEASE_TAG: ${{ github.event.release.tag_name }}
77
+ run: cargo set-version "${RELEASE_TAG#v}"
78
+
79
+ # cfitsio is compiled from source via the crate's `fitsio-src` feature,
80
+ # so the only build requirement is a C compiler, which every runner (and
81
+ # the manylinux container) already provides.
82
+ - name: Build wheels
83
+ uses: PyO3/maturin-action@v1
84
+ with:
85
+ target: ${{ matrix.target }}
86
+ # `auto` selects an appropriate manylinux image; maturin-action's
87
+ # cross images carry the aarch64 C toolchain needed to build cfitsio.
88
+ manylinux: auto
89
+ # `abi3` builds one stable-ABI wheel per platform (Python >=3.10) and
90
+ # lets maturin build without a (target) interpreter, needed for aarch64.
91
+ args: --release --out dist --features abi3
92
+
93
+ - uses: actions/upload-artifact@v4
94
+ with:
95
+ name: dist-${{ matrix.platform }}-${{ matrix.target }}
96
+ path: dist/*.whl
97
+
98
+ publish-pypi:
99
+ name: Publish to PyPI
100
+ needs: [sdist, wheels]
101
+ runs-on: ubuntu-latest
102
+ environment: pypi
103
+ permissions:
104
+ id-token: write # trusted publishing
105
+ attestations: write
106
+ contents: read
107
+ if: github.event_name == 'release' && github.event.action == 'published'
108
+ steps:
109
+ - uses: actions/download-artifact@v4
110
+ with:
111
+ pattern: dist-*
112
+ path: dist
113
+ merge-multiple: true
114
+
115
+ - name: Generate artifact attestations
116
+ uses: actions/attest-build-provenance@v4
117
+ with:
118
+ subject-path: "dist/*"
119
+
120
+ - uses: pypa/gh-action-pypi-publish@release/v1
121
+
122
+ publish-crates:
123
+ name: Publish to crates.io
124
+ needs: [sdist, wheels]
125
+ runs-on: ubuntu-latest
126
+ if: github.event_name == 'release' && github.event.action == 'published'
127
+ steps:
128
+ - uses: actions/checkout@v6
129
+
130
+ - name: Install Rust toolchain
131
+ uses: dtolnay/rust-toolchain@stable
132
+
133
+ - name: Install cargo-edit
134
+ uses: taiki-e/install-action@v2
135
+ with:
136
+ tool: cargo-edit
137
+
138
+ - name: Pin version from release tag
139
+ shell: bash
140
+ env:
141
+ RELEASE_TAG: ${{ github.event.release.tag_name }}
142
+ run: cargo set-version "${RELEASE_TAG#v}"
143
+
144
+ # --allow-dirty: `cargo set-version` leaves the manifest modified vs HEAD.
145
+ - name: Publish crate
146
+ run: cargo publish --allow-dirty --token ${{ secrets.CARGO_REGISTRY_TOKEN }}
@@ -0,0 +1,116 @@
1
+ name: CI
2
+
3
+ on:
4
+ workflow_dispatch:
5
+ pull_request:
6
+ push:
7
+ branches:
8
+ - main
9
+
10
+ concurrency:
11
+ group: ${{ github.workflow }}-${{ github.ref }}
12
+ cancel-in-progress: true
13
+
14
+ env:
15
+ # Many color libraries just need this variable to be set to any value.
16
+ FORCE_COLOR: 3
17
+ CARGO_TERM_COLOR: always
18
+
19
+ jobs:
20
+ lint:
21
+ name: Lint & format
22
+ runs-on: ubuntu-latest
23
+ steps:
24
+ - uses: actions/checkout@v6
25
+
26
+ - name: Install Rust toolchain
27
+ uses: dtolnay/rust-toolchain@stable
28
+ with:
29
+ components: rustfmt, clippy
30
+
31
+ - uses: Swatinem/rust-cache@v2
32
+
33
+ - uses: astral-sh/setup-uv@v7
34
+
35
+ # ty type-checks against installed deps (numpy, astropy, ...), so build
36
+ # the extension and populate .venv first; ty auto-discovers ./.venv.
37
+ - name: Build extension and install deps
38
+ run: uv sync --extra test --extra dev
39
+
40
+ # Single source of truth: the same hooks developers run locally
41
+ # (.pre-commit-config.yaml) — ruff, ty, cargo fmt, clippy. prek exits
42
+ # nonzero if any autofix hook had to change a file, so this fails CI
43
+ # exactly like the `--check` variants did.
44
+ - name: prek (lint, format, type check)
45
+ run: uvx prek run --all-files --show-diff-on-failure
46
+
47
+ docs:
48
+ name: Docs build
49
+ runs-on: ubuntu-latest
50
+ needs: [lint]
51
+ steps:
52
+ - uses: actions/checkout@v6
53
+
54
+ # Rust is needed twice: maturin builds the extension during `uv sync`,
55
+ # and sphinxcontrib-programoutput runs `cargo run -- --help` to embed
56
+ # the CLI help text.
57
+ - name: Install Rust toolchain
58
+ uses: dtolnay/rust-toolchain@stable
59
+
60
+ - uses: Swatinem/rust-cache@v2
61
+
62
+ - uses: astral-sh/setup-uv@v7
63
+
64
+ - name: Build extension and install docs dependencies
65
+ run: uv sync --group docs
66
+
67
+ # -W makes warnings fatal. The quickstart notebook is re-executed and
68
+ # the CLI help regenerated on every build, so stale or broken examples
69
+ # fail here.
70
+ - name: Build docs
71
+ run: uv run --no-sync sphinx-build -W -b html docs docs/_build/html
72
+
73
+ rust-test:
74
+ name: Rust tests
75
+ runs-on: ubuntu-latest
76
+ needs: [lint]
77
+ steps:
78
+ - uses: actions/checkout@v6
79
+
80
+ - name: Install Rust toolchain
81
+ uses: dtolnay/rust-toolchain@stable
82
+
83
+ - uses: Swatinem/rust-cache@v2
84
+
85
+ - name: Run Rust tests
86
+ # The integration tests exercise the pure-Rust API; no Python features.
87
+ run: cargo test
88
+
89
+ python-test:
90
+ name: Python ${{ matrix.python-version }}
91
+ runs-on: ubuntu-latest
92
+ needs: [lint]
93
+ strategy:
94
+ fail-fast: false
95
+ matrix:
96
+ python-version: ["3.10", "3.12", "3.13", "3.14"]
97
+ steps:
98
+ - uses: actions/checkout@v6
99
+
100
+ - name: Install Rust toolchain
101
+ uses: dtolnay/rust-toolchain@stable
102
+
103
+ - uses: Swatinem/rust-cache@v2
104
+
105
+ - uses: astral-sh/setup-uv@v7
106
+ with:
107
+ python-version: ${{ matrix.python-version }}
108
+
109
+ # Builds the maturin extension module and installs the `test` extra
110
+ # (pytest, radio-beam, astropy). cfitsio is compiled from source via the
111
+ # crate's `fitsio-src` feature, so no system library is needed.
112
+ - name: Build extension and install test dependencies
113
+ run: uv sync --extra test
114
+
115
+ - name: Run pytest
116
+ run: uv run --no-sync pytest -ra --durations=20
@@ -0,0 +1,137 @@
1
+ # Generated by Cargo
2
+ # will have compiled files and executables
3
+ debug
4
+ target
5
+
6
+ # These are backup files generated by rustfmt
7
+ **/*.rs.bk
8
+
9
+ # MSVC Windows builds of rustc generate these, which store debugging information
10
+ *.pdb
11
+
12
+ # Generated by cargo mutants
13
+ # Contains mutation testing data
14
+ **/mutants.out*/
15
+
16
+ # rustc will dump stack traces when hitting an internal compiler error to PWD
17
+ rustc-ice-*.txt
18
+
19
+ # RustRover
20
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
21
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
22
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
23
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
24
+ #.idea/
25
+
26
+ # Byte-compiled / optimized / DLL files
27
+ __pycache__/
28
+ *.py[codz]
29
+ *$py.class
30
+
31
+ # C extensions
32
+ *.so
33
+
34
+ # Distribution / packaging
35
+ .Python
36
+ build/
37
+ develop-eggs/
38
+ dist/
39
+ downloads/
40
+ eggs/
41
+ .eggs/
42
+ lib/
43
+ lib64/
44
+ parts/
45
+ sdist/
46
+ var/
47
+ wheels/
48
+ share/python-wheels/
49
+ *.egg-info/
50
+ .installed.cfg
51
+ *.egg
52
+ MANIFEST
53
+
54
+ # PyInstaller
55
+ # Usually these files are written by a python script from a template
56
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
57
+ *.manifest
58
+ *.spec
59
+
60
+ # Installer logs
61
+ pip-log.txt
62
+ pip-delete-this-directory.txt
63
+
64
+ # Unit test / coverage reports
65
+ htmlcov/
66
+ .tox/
67
+ .nox/
68
+ .coverage
69
+ .coverage.*
70
+ .cache
71
+ nosetests.xml
72
+ coverage.xml
73
+ *.cover
74
+ *.py.cover
75
+ *.lcov
76
+ .hypothesis/
77
+ .pytest_cache/
78
+ cover/
79
+
80
+ # Translations
81
+ *.mo
82
+ *.pot
83
+
84
+ # Sphinx documentation
85
+ docs/_build/
86
+
87
+ # Jupyter Notebook
88
+ .ipynb_checkpoints
89
+
90
+ # IPython
91
+ profile_default/
92
+ ipython_config.py
93
+
94
+ # pdm
95
+ .pdm-python
96
+ .pdm-build/
97
+
98
+ # pixi
99
+ .pixi/*
100
+ !.pixi/config.toml
101
+
102
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
103
+ __pypackages__/
104
+
105
+ # Environments
106
+ .env
107
+ .envrc
108
+ .venv
109
+ env/
110
+ venv/
111
+ ENV/
112
+ env.bak/
113
+ venv.bak/
114
+
115
+ # mypy
116
+ .mypy_cache/
117
+ .dmypy.json
118
+ dmypy.json
119
+
120
+ # Pyre type checker
121
+ .pyre/
122
+
123
+ # pytype static type analyzer
124
+ .pytype/
125
+
126
+ # Cython debug symbols
127
+ cython_debug/
128
+
129
+ # Ruff stuff:
130
+ .ruff_cache/
131
+
132
+ # PyPI configuration file
133
+ .pypirc
134
+
135
+ # Benchmark outputs
136
+ scripts/bench_out/
137
+ bench_out/
@@ -0,0 +1,62 @@
1
+ # Mirrors the CI "Lint & format" job (.github/workflows/ci.yml).
2
+ # Run with prek (a fast, drop-in pre-commit reimplementation):
3
+ # uvx prek install # install the git hook
4
+ # uvx prek run --all-files
5
+ # `uv sync --extra dev` installs prek + ty into the project venv.
6
+
7
+ # Generated by pyo3-stub-gen; never hand-edit (regenerated by the build).
8
+ exclude: '^fitscube_rs/_fitscube_rs/__init__\.pyi$'
9
+
10
+ # pre-commit.ci has no Rust toolchain, and ty needs the project venv (numpy,
11
+ # astropy) which the bot doesn't build. Skip those there; the GitHub Actions
12
+ # lint job runs the full suite (cargo present + `uv sync`), so coverage holds.
13
+ ci:
14
+ skip: [cargo-fmt, cargo-clippy, ty]
15
+
16
+ repos:
17
+ # Generic hygiene
18
+ - repo: https://github.com/pre-commit/pre-commit-hooks
19
+ rev: v6.0.0
20
+ hooks:
21
+ - id: trailing-whitespace
22
+ - id: end-of-file-fixer
23
+ - id: check-yaml
24
+ - id: check-toml
25
+ - id: check-merge-conflict
26
+ - id: check-added-large-files
27
+
28
+ # Python: ruff lint + format (same tool/config as CI's `uvx ruff`)
29
+ - repo: https://github.com/astral-sh/ruff-pre-commit
30
+ rev: v0.14.2
31
+ hooks:
32
+ - id: ruff-check
33
+ args: [--fix]
34
+ - id: ruff-format
35
+
36
+ # Python type checking with ty (config in [tool.ty] of pyproject.toml).
37
+ - repo: local
38
+ hooks:
39
+ - id: ty
40
+ name: ty check
41
+ entry: uvx ty check
42
+ language: system
43
+ types_or: [python, pyi]
44
+ pass_filenames: false
45
+
46
+ # Rust: run the installed toolchain (no version pinning by the hook manager).
47
+ - repo: local
48
+ hooks:
49
+ - id: cargo-fmt
50
+ name: cargo fmt
51
+ entry: cargo fmt --all --
52
+ language: system
53
+ types: [rust]
54
+ pass_filenames: false
55
+
56
+ - id: cargo-clippy
57
+ # Not --all-features: `abi3` and `stubgen` are mutually exclusive.
58
+ name: cargo clippy
59
+ entry: cargo clippy --all-targets --features stubgen -- -D warnings
60
+ language: system
61
+ types: [rust]
62
+ pass_filenames: false
@@ -0,0 +1,18 @@
1
+ # Read the Docs configuration file
2
+ # See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
3
+ version: 2
4
+
5
+ build:
6
+ os: ubuntu-24.04
7
+ tools:
8
+ python: "3.13"
9
+ # maturin compiles the extension during `uv sync`, and
10
+ # sphinxcontrib-programoutput runs `cargo run -- --help` at build time.
11
+ # edition 2024 needs Rust >= 1.85.
12
+ rust: "latest"
13
+ commands:
14
+ - asdf plugin add uv
15
+ - asdf install uv latest
16
+ - asdf global uv latest
17
+ - uv sync --group docs
18
+ - uv run --no-sync python -m sphinx -T -W -b html -d docs/_build/doctrees -D language=en docs $READTHEDOCS_OUTPUT/html