katcp-codec 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 (48) hide show
  1. katcp_codec-0.1.0/.ci/before_all_linux.sh +6 -0
  2. katcp_codec-0.1.0/.github/dependabot.yml +6 -0
  3. katcp_codec-0.1.0/.github/workflows/test.yml +193 -0
  4. katcp_codec-0.1.0/.gitignore +7 -0
  5. katcp_codec-0.1.0/.pre-commit-config.yaml +42 -0
  6. katcp_codec-0.1.0/.readthedocs.yml +30 -0
  7. katcp_codec-0.1.0/Cargo.lock +1068 -0
  8. katcp_codec-0.1.0/Cargo.toml +48 -0
  9. katcp_codec-0.1.0/PKG-INFO +26 -0
  10. katcp_codec-0.1.0/README.md +6 -0
  11. katcp_codec-0.1.0/benches/bench_format.rs +47 -0
  12. katcp_codec-0.1.0/benches/bench_parse.rs +49 -0
  13. katcp_codec-0.1.0/build.rs +355 -0
  14. katcp_codec-0.1.0/crates/fsm/Cargo.lock +316 -0
  15. katcp_codec-0.1.0/crates/fsm/Cargo.toml +26 -0
  16. katcp_codec-0.1.0/crates/fsm/src/lib.rs +98 -0
  17. katcp_codec-0.1.0/doc/.gitignore +3 -0
  18. katcp_codec-0.1.0/doc/Makefile +20 -0
  19. katcp_codec-0.1.0/doc/changelog.rst +15 -0
  20. katcp_codec-0.1.0/doc/conf.py +38 -0
  21. katcp_codec-0.1.0/doc/design.rst +121 -0
  22. katcp_codec-0.1.0/doc/index.rst +25 -0
  23. katcp_codec-0.1.0/doc/installation.rst +10 -0
  24. katcp_codec-0.1.0/doc/introduction.rst +11 -0
  25. katcp_codec-0.1.0/doc/katcp_codec.rst +10 -0
  26. katcp_codec-0.1.0/doc/modules.rst +7 -0
  27. katcp_codec-0.1.0/doc/usage.rst +37 -0
  28. katcp_codec-0.1.0/doc-requirements.txt +66 -0
  29. katcp_codec-0.1.0/pyproject.toml +88 -0
  30. katcp_codec-0.1.0/python/katcp_codec/__init__.py +151 -0
  31. katcp_codec-0.1.0/python/katcp_codec/_lib.pyi +48 -0
  32. katcp_codec-0.1.0/python/katcp_codec/py.typed +0 -0
  33. katcp_codec-0.1.0/python/katcp_codec.egg-info/PKG-INFO +26 -0
  34. katcp_codec-0.1.0/python/katcp_codec.egg-info/SOURCES.txt +46 -0
  35. katcp_codec-0.1.0/python/katcp_codec.egg-info/dependency_links.txt +1 -0
  36. katcp_codec-0.1.0/python/katcp_codec.egg-info/requires.txt +10 -0
  37. katcp_codec-0.1.0/python/katcp_codec.egg-info/top_level.txt +1 -0
  38. katcp_codec-0.1.0/python/tests/test_format.py +50 -0
  39. katcp_codec-0.1.0/python/tests/test_parse.py +77 -0
  40. katcp_codec-0.1.0/requirements.txt +52 -0
  41. katcp_codec-0.1.0/setup.cfg +4 -0
  42. katcp_codec-0.1.0/src/binding.rs +27 -0
  43. katcp_codec-0.1.0/src/format.rs +225 -0
  44. katcp_codec-0.1.0/src/lib.rs +24 -0
  45. katcp_codec-0.1.0/src/message.rs +195 -0
  46. katcp_codec-0.1.0/src/parse.rs +524 -0
  47. katcp_codec-0.1.0/src/tables.rs +33 -0
  48. katcp_codec-0.1.0/src/test.rs +65 -0
@@ -0,0 +1,6 @@
1
+ #!/bin/bash
2
+
3
+ set -e -u
4
+
5
+ # Install Rust
6
+ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --default-toolchain=${RUST_VERSION:-stable} --profile=minimal -y
@@ -0,0 +1,6 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: "github-actions"
4
+ directory: "/"
5
+ schedule:
6
+ interval: "weekly"
@@ -0,0 +1,193 @@
1
+ name: Unit tests
2
+ on: [push, pull_request]
3
+ concurrency:
4
+ group: test-${{ github.ref }}
5
+ cancel-in-progress: true
6
+ env:
7
+ RUST_VERSION: '1.76.0'
8
+ MIN_PYTHON_VERSION: '3.8'
9
+ MAX_PYTHON_VERSION: '3.12'
10
+ jobs:
11
+ pre-commit:
12
+ runs-on: ubuntu-22.04
13
+ steps:
14
+ - uses: actions/checkout@v4
15
+ - uses: actions/setup-python@v5
16
+ with:
17
+ python-version: ${{ env.MIN_PYTHON_VERSION }}
18
+ cache: 'pip'
19
+ - uses: dtolnay/rust-toolchain@v1
20
+ with:
21
+ toolchain: ${{ env.RUST_VERSION }}
22
+ components: rustfmt, clippy
23
+ - uses: Swatinem/rust-cache@v2
24
+ - name: Install pre-commit
25
+ run: pip install -c requirements.txt pre-commit
26
+ - name: Run pre-commit checks
27
+ run: pre-commit run --all-files
28
+
29
+ docs:
30
+ runs-on: ubuntu-22.04
31
+ steps:
32
+ - uses: actions/checkout@v4
33
+ - uses: actions/setup-python@v5
34
+ with:
35
+ python-version: ${{ env.MIN_PYTHON_VERSION }}
36
+ cache: 'pip'
37
+ - uses: dtolnay/rust-toolchain@v1
38
+ with:
39
+ toolchain: ${{ env.RUST_VERSION }}
40
+ - uses: Swatinem/rust-cache@v2
41
+ - name: Build Rust docs
42
+ # Document private items to validate their doc formatting.
43
+ run: RUSTDOCFLAGS="-D warnings" cargo doc --no-deps --document-private-items --locked
44
+ - name: Install Python doc dependencies
45
+ run: pip install -r doc-requirements.txt
46
+ - name: Install Python package
47
+ run: pip install .
48
+ - name: Build Python docs
49
+ run: SPHINX_OPTS="-W --keep-going" make -C doc html
50
+
51
+ rust-tests:
52
+ runs-on: ubuntu-22.04
53
+ steps:
54
+ - uses: actions/checkout@v4
55
+ - uses: actions/setup-python@v5
56
+ with:
57
+ python-version: ${{ env.MAX_PYTHON_VERSION }}
58
+ - uses: dtolnay/rust-toolchain@v1
59
+ with:
60
+ toolchain: ${{ env.RUST_VERSION }}
61
+ - uses: Swatinem/rust-cache@v2
62
+ - name: Run Rust tests
63
+ run: RUSTFLAGS="-D warnings" cargo test --locked
64
+ - name: Run Rust benchmarks
65
+ run: cargo bench --locked
66
+
67
+ python-tests:
68
+ strategy:
69
+ fail-fast: false
70
+ matrix:
71
+ python: ['3.8', '3.9', '3.10', '3.11', '3.12']
72
+ runs-on: ubuntu-22.04
73
+ steps:
74
+ - uses: actions/checkout@v4
75
+ - uses: actions/setup-python@v5
76
+ with:
77
+ python-version: ${{ matrix.python }}
78
+ cache: 'pip'
79
+ - uses: dtolnay/rust-toolchain@v1
80
+ with:
81
+ toolchain: ${{ env.RUST_VERSION }}
82
+ - uses: Swatinem/rust-cache@v2
83
+ - name: Install dependencies
84
+ run: pip install -r requirements.txt
85
+ - name: Install package
86
+ run: pip install .
87
+ - name: Run Python tests
88
+ run: pytest -v -ra
89
+
90
+ linux-wheels:
91
+ needs: [pre-commit, python-tests, rust-tests]
92
+ strategy:
93
+ fail-fast: false
94
+ matrix:
95
+ arch: [x86_64, aarch64]
96
+ python: [cp38] # Using limited ABI, so newer versions are not required
97
+ runs-on: ubuntu-22.04
98
+ steps:
99
+ - uses: actions/checkout@v4
100
+ with:
101
+ fetch-depth: 0
102
+ - uses: docker/setup-qemu-action@v3
103
+ with:
104
+ platforms: arm64
105
+ if: matrix.arch != 'x86_64'
106
+ - uses: dtolnay/rust-toolchain@v1
107
+ with:
108
+ toolchain: ${{ env.RUST_VERSION }}
109
+ - uses: Swatinem/rust-cache@v2
110
+ - uses: pypa/cibuildwheel@v2.17.0
111
+ env:
112
+ CIBW_ARCHS: ${{ matrix.arch }}
113
+ CIBW_BUILD: ${{ matrix.python }}-manylinux*
114
+ - uses: actions/upload-artifact@v4
115
+ with:
116
+ name: wheel_linux-${{ matrix.arch }}-${{ matrix.python }}
117
+ path: ./wheelhouse/*.whl
118
+
119
+ macos-wheels:
120
+ needs: [pre-commit, python-tests, rust-tests]
121
+ strategy:
122
+ fail-fast: false
123
+ matrix:
124
+ arch: [x86_64, arm64]
125
+ python: [cp38] # Using limited ABI, so newer versions are not required
126
+ runs-on: macos-14
127
+ steps:
128
+ - uses: actions/checkout@v4
129
+ with:
130
+ fetch-depth: 0
131
+ - uses: dtolnay/rust-toolchain@v1
132
+ with:
133
+ toolchain: ${{ env.RUST_VERSION }}
134
+ - uses: Swatinem/rust-cache@v2
135
+ - name: Install x86_64 Rust compiler
136
+ run: rustup target add x86_64-apple-darwin
137
+ if: matrix.arch == 'x86_64'
138
+ - uses: actions/setup-python@v5
139
+ with:
140
+ python-version: ${{ env.MAX_PYTHON_VERSION }}
141
+ cache: 'pip'
142
+ - name: Install pipx
143
+ run: pip install pipx
144
+ - uses: pypa/cibuildwheel@v2.17.0
145
+ env:
146
+ CIBW_ARCHS: ${{ matrix.arch }}
147
+ CIBW_BUILD: ${{ matrix.python }}-macos*
148
+ - uses: actions/upload-artifact@v4
149
+ with:
150
+ name: wheel_macos-${{ matrix.arch }}-${{ matrix.python }}
151
+ path: ./wheelhouse/*.whl
152
+
153
+ sdist:
154
+ runs-on: ubuntu-22.04
155
+ steps:
156
+ - uses: actions/checkout@v4
157
+ with:
158
+ fetch-depth: 0
159
+ - uses: actions/setup-python@v5
160
+ with:
161
+ python-version: ${{ env.MIN_PYTHON_VERSION }}
162
+ cache: 'pip'
163
+ - name: install build tool
164
+ run: pip install -c requirements.txt build
165
+ - name: build sdist
166
+ run: python -m build --sdist .
167
+ - uses: actions/upload-artifact@v4
168
+ with:
169
+ name: sdist
170
+ path: ./dist/*.tar.gz
171
+
172
+ combine-wheels:
173
+ needs: [linux-wheels, macos-wheels, sdist]
174
+ runs-on: ubuntu-22.04
175
+ steps:
176
+ - name: Create paths
177
+ run: mkdir -p dist wheelhouse
178
+ - uses: actions/download-artifact@v4
179
+ with:
180
+ pattern: wheel_*
181
+ path: wheelhouse/
182
+ merge-multiple: true
183
+ - uses: actions/download-artifact@v4
184
+ with:
185
+ name: sdist
186
+ path: dist/
187
+ merge-multiple: true
188
+ - uses: actions/upload-artifact@v4
189
+ with:
190
+ name: release
191
+ path: |
192
+ dist/
193
+ wheelhouse/
@@ -0,0 +1,7 @@
1
+ /build
2
+ /target
3
+ /dist
4
+ /wheelhouse
5
+ *.egg-info
6
+ _lib.*.so
7
+ _lib.*.dylib
@@ -0,0 +1,42 @@
1
+ repos:
2
+ - repo: https://github.com/doublify/pre-commit-rust
3
+ rev: v1.0
4
+ hooks:
5
+ - id: fmt
6
+ - id: clippy
7
+ - repo: https://github.com/psf/black
8
+ rev: 24.3.0
9
+ hooks:
10
+ - id: black
11
+ - repo: https://github.com/pycqa/isort
12
+ rev: 5.13.2
13
+ hooks:
14
+ - id: isort
15
+ args: ["--filter-files"]
16
+ - repo: https://github.com/astral-sh/ruff-pre-commit
17
+ rev: v0.3.3
18
+ hooks:
19
+ - id: ruff
20
+ - repo: https://github.com/pre-commit/mirrors-mypy
21
+ rev: v1.9.0
22
+ hooks:
23
+ - id: mypy
24
+ # Passing filenames to mypy can do odd things.
25
+ # pyproject.toml determines the set of files that will actually be checked.
26
+ pass_filenames: false
27
+ # The pre-commit hook passes some options, but we set options in pyproject.toml.
28
+ args: []
29
+ additional_dependencies:
30
+ - pytest==8.1.1
31
+ - repo: https://github.com/jazzband/pip-tools
32
+ rev: 7.4.1
33
+ hooks:
34
+ - id: pip-compile
35
+ language_version: python3.8
36
+ args: ["--output-file=requirements.txt", "--extra=dev", "--strip-extras", "pyproject.toml"]
37
+ files: '^(pyproject\.toml|requirements\.txt)$'
38
+ - id: pip-compile
39
+ name: pip-compile doc-requirements
40
+ language_version: python3.8
41
+ args: ["--output-file=doc-requirements.txt", "--extra=doc", "--strip-extras", "pyproject.toml"]
42
+ files: '^(pyproject\.toml|doc-requirements\.txt)$'
@@ -0,0 +1,30 @@
1
+ ################################################################################
2
+ # Copyright (c) 2024, National Research Foundation (SARAO)
3
+ #
4
+ # Licensed under the BSD 3-Clause License (the "License"); you may not use
5
+ # this file except in compliance with the License. You may obtain a copy
6
+ # of the License at
7
+ #
8
+ # https://opensource.org/licenses/BSD-3-Clause
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ ################################################################################
16
+
17
+ version: 2
18
+ build:
19
+ os: ubuntu-22.04
20
+ apt_packages:
21
+ - pdf2svg # For sphinxcontrib-tikz
22
+ tools:
23
+ python: "3.12"
24
+ rust: "1.75"
25
+
26
+ python:
27
+ install:
28
+ - requirements: doc-requirements.txt
29
+ - method: pip
30
+ path: .