xtce-lib 0.1.0a1__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 (86) hide show
  1. xtce_lib-0.1.0a1/.github/workflows/ci.yml +62 -0
  2. xtce_lib-0.1.0a1/.gitignore +218 -0
  3. xtce_lib-0.1.0a1/.python-version +1 -0
  4. xtce_lib-0.1.0a1/.xsdata.xml +36 -0
  5. xtce_lib-0.1.0a1/LICENSE +21 -0
  6. xtce_lib-0.1.0a1/PKG-INFO +153 -0
  7. xtce_lib-0.1.0a1/README.md +141 -0
  8. xtce_lib-0.1.0a1/pyproject.toml +64 -0
  9. xtce_lib-0.1.0a1/scripts/generate_models.py +51 -0
  10. xtce_lib-0.1.0a1/scripts/generate_models_init.py +91 -0
  11. xtce_lib-0.1.0a1/src/xtce_lib/__init__.py +33 -0
  12. xtce_lib-0.1.0a1/src/xtce_lib/common/__init__.py +1 -0
  13. xtce_lib-0.1.0a1/src/xtce_lib/common/validation.py +71 -0
  14. xtce_lib-0.1.0a1/src/xtce_lib/common/xtce_database.py +286 -0
  15. xtce_lib-0.1.0a1/src/xtce_lib/common/xtce_file.py +207 -0
  16. xtce_lib-0.1.0a1/src/xtce_lib/common/xtce_path.py +344 -0
  17. xtce_lib-0.1.0a1/src/xtce_lib/common/xtce_registry.py +96 -0
  18. xtce_lib-0.1.0a1/src/xtce_lib/common/xtce_version.py +45 -0
  19. xtce_lib-0.1.0a1/src/xtce_lib/exceptions.py +44 -0
  20. xtce_lib-0.1.0a1/src/xtce_lib/generated/__init__.py +5 -0
  21. xtce_lib-0.1.0a1/src/xtce_lib/generated/xtce_1_0/__init__.py +249 -0
  22. xtce_lib-0.1.0a1/src/xtce_lib/generated/xtce_1_0/models.py +5637 -0
  23. xtce_lib-0.1.0a1/src/xtce_lib/generated/xtce_1_1/__init__.py +277 -0
  24. xtce_lib-0.1.0a1/src/xtce_lib/generated/xtce_1_1/models.py +6265 -0
  25. xtce_lib-0.1.0a1/src/xtce_lib/generated/xtce_1_2/__init__.py +633 -0
  26. xtce_lib-0.1.0a1/src/xtce_lib/generated/xtce_1_2/models.py +9964 -0
  27. xtce_lib-0.1.0a1/src/xtce_lib/generated/xtce_1_3/__init__.py +645 -0
  28. xtce_lib-0.1.0a1/src/xtce_lib/generated/xtce_1_3/models.py +10570 -0
  29. xtce_lib-0.1.0a1/src/xtce_lib/py.typed +0 -0
  30. xtce_lib-0.1.0a1/src/xtce_lib/xsd/dtc-05-01-05.xsd +2798 -0
  31. xtce_lib-0.1.0a1/src/xtce_lib/xsd/dtc-06-11-06.xsd +3229 -0
  32. xtce_lib-0.1.0a1/src/xtce_lib/xsd/dtc-18-02-04.xsd +5918 -0
  33. xtce_lib-0.1.0a1/src/xtce_lib/xsd/dtc-25-02-18.xsd +6363 -0
  34. xtce_lib-0.1.0a1/src/xtce_lib/xsd/xml.xsd +117 -0
  35. xtce_lib-0.1.0a1/src/xtce_lib/xtce/__init__.py +602 -0
  36. xtce_lib-0.1.0a1/src/xtce_lib/xtce/_base.py +400 -0
  37. xtce_lib-0.1.0a1/src/xtce_lib/xtce/_pattern.py +15 -0
  38. xtce_lib-0.1.0a1/src/xtce_lib/xtce/_type_aliases.py +8 -0
  39. xtce_lib-0.1.0a1/src/xtce_lib/xtce/_type_aliases_ext.py +69 -0
  40. xtce_lib-0.1.0a1/src/xtce_lib/xtce/_util.py +157 -0
  41. xtce_lib-0.1.0a1/src/xtce_lib/xtce/alarm.py +1710 -0
  42. xtce_lib-0.1.0a1/src/xtce_lib/xtce/algorithm.py +1276 -0
  43. xtce_lib-0.1.0a1/src/xtce_lib/xtce/argument.py +481 -0
  44. xtce_lib-0.1.0a1/src/xtce_lib/xtce/array.py +231 -0
  45. xtce_lib-0.1.0a1/src/xtce_lib/xtce/calibrator.py +1037 -0
  46. xtce_lib-0.1.0a1/src/xtce_lib/xtce/codec.py +2064 -0
  47. xtce_lib-0.1.0a1/src/xtce_lib/xtce/command.py +2188 -0
  48. xtce_lib-0.1.0a1/src/xtce_lib/xtce/common.py +459 -0
  49. xtce_lib-0.1.0a1/src/xtce_lib/xtce/condition.py +1497 -0
  50. xtce_lib-0.1.0a1/src/xtce_lib/xtce/container.py +2717 -0
  51. xtce_lib-0.1.0a1/src/xtce_lib/xtce/datatype.py +2695 -0
  52. xtce_lib-0.1.0a1/src/xtce_lib/xtce/enum.py +1065 -0
  53. xtce_lib-0.1.0a1/src/xtce_lib/xtce/parameter.py +1429 -0
  54. xtce_lib-0.1.0a1/src/xtce_lib/xtce/range.py +556 -0
  55. xtce_lib-0.1.0a1/src/xtce_lib/xtce/reference.py +725 -0
  56. xtce_lib-0.1.0a1/src/xtce_lib/xtce/space_system.py +652 -0
  57. xtce_lib-0.1.0a1/src/xtce_lib/xtce/stream.py +914 -0
  58. xtce_lib-0.1.0a1/src/xtce_lib/xtce/telemetry.py +554 -0
  59. xtce_lib-0.1.0a1/src/xtce_lib/xtce/time.py +424 -0
  60. xtce_lib-0.1.0a1/src/xtce_lib/xtce/trigger.py +410 -0
  61. xtce_lib-0.1.0a1/src/xtce_lib/xtce/verifier.py +807 -0
  62. xtce_lib-0.1.0a1/tests/test_models/test_alarm.py +699 -0
  63. xtce_lib-0.1.0a1/tests/test_models/test_algorithm.py +669 -0
  64. xtce_lib-0.1.0a1/tests/test_models/test_argument.py +398 -0
  65. xtce_lib-0.1.0a1/tests/test_models/test_array.py +251 -0
  66. xtce_lib-0.1.0a1/tests/test_models/test_calibrator.py +706 -0
  67. xtce_lib-0.1.0a1/tests/test_models/test_codec.py +1072 -0
  68. xtce_lib-0.1.0a1/tests/test_models/test_command.py +609 -0
  69. xtce_lib-0.1.0a1/tests/test_models/test_common.py +572 -0
  70. xtce_lib-0.1.0a1/tests/test_models/test_condition.py +1121 -0
  71. xtce_lib-0.1.0a1/tests/test_models/test_container.py +379 -0
  72. xtce_lib-0.1.0a1/tests/test_models/test_datatype.py +1239 -0
  73. xtce_lib-0.1.0a1/tests/test_models/test_enum.py +264 -0
  74. xtce_lib-0.1.0a1/tests/test_models/test_parameter.py +633 -0
  75. xtce_lib-0.1.0a1/tests/test_models/test_range.py +909 -0
  76. xtce_lib-0.1.0a1/tests/test_models/test_reference.py +1309 -0
  77. xtce_lib-0.1.0a1/tests/test_models/test_space_system.py +223 -0
  78. xtce_lib-0.1.0a1/tests/test_models/test_stream.py +346 -0
  79. xtce_lib-0.1.0a1/tests/test_models/test_telemetry.py +201 -0
  80. xtce_lib-0.1.0a1/tests/test_models/test_time.py +509 -0
  81. xtce_lib-0.1.0a1/tests/test_models/test_trigger.py +821 -0
  82. xtce_lib-0.1.0a1/tests/test_models/test_verifier.py +512 -0
  83. xtce_lib-0.1.0a1/tests/test_xtce_database.py +316 -0
  84. xtce_lib-0.1.0a1/tests/test_xtce_path.py +501 -0
  85. xtce_lib-0.1.0a1/tests/test_xtce_registry.py +199 -0
  86. xtce_lib-0.1.0a1/uv.lock +677 -0
@@ -0,0 +1,62 @@
1
+ name: CI/CD
2
+
3
+ on:
4
+ push:
5
+ branches: ["main"]
6
+ tags: ["v*"]
7
+ pull_request:
8
+ branches: ["main"]
9
+
10
+ jobs:
11
+ test:
12
+ name: Test on ${{ matrix.os }} / Python ${{ matrix.python-version }}
13
+ runs-on: ${{ matrix.os }}
14
+ strategy:
15
+ fail-fast: false
16
+ matrix:
17
+ os: [ubuntu-latest, macos-latest, windows-latest]
18
+ python-version: ["3.11", "3.12", "3.13"]
19
+
20
+ steps:
21
+ - uses: actions/checkout@v4
22
+
23
+ - name: Install uv
24
+ uses: astral-sh/setup-uv@v3
25
+ with:
26
+ enable-cache: true
27
+
28
+ - name: Set up Python ${{ matrix.python-version }}
29
+ run: uv python install ${{ matrix.python-version }}
30
+
31
+ - name: Install the project
32
+ run: uv sync --all-extras --dev
33
+
34
+ - name: Run tests
35
+ run: uv run pytest
36
+
37
+ publish:
38
+ name: Build and Publish to PyPI
39
+ needs: test
40
+ # Only run this if the tests pass and the push is a tag starting with 'v'
41
+ if: startsWith(github.ref, 'refs/tags/v')
42
+ runs-on: ubuntu-latest
43
+
44
+ # Required for PyPI trusted publishing
45
+ environment:
46
+ name: pypi
47
+ url: https://pypi.org/p/xtce-lib
48
+ permissions:
49
+ id-token: write
50
+ contents: read
51
+
52
+ steps:
53
+ - uses: actions/checkout@v4
54
+
55
+ - name: Install uv
56
+ uses: astral-sh/setup-uv@v3
57
+
58
+ - name: Build package
59
+ run: uv build
60
+
61
+ - name: Publish to PyPI
62
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,218 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[codz]
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
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ # Usually these files are written by a python script from a template
31
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
32
+ *.manifest
33
+ *.spec
34
+
35
+ # Installer logs
36
+ pip-log.txt
37
+ pip-delete-this-directory.txt
38
+
39
+ # Unit test / coverage reports
40
+ htmlcov/
41
+ .tox/
42
+ .nox/
43
+ .coverage
44
+ .coverage.*
45
+ .cache
46
+ nosetests.xml
47
+ coverage.xml
48
+ *.cover
49
+ *.py.cover
50
+ .hypothesis/
51
+ .pytest_cache/
52
+ cover/
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
+ .pybuilder/
76
+ target/
77
+
78
+ # Jupyter Notebook
79
+ .ipynb_checkpoints
80
+
81
+ # IPython
82
+ profile_default/
83
+ ipython_config.py
84
+
85
+ # pyenv
86
+ # For a library or package, you might want to ignore these files since the code is
87
+ # intended to run in multiple environments; otherwise, check them in:
88
+ # .python-version
89
+
90
+ # pipenv
91
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
93
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
94
+ # install all needed dependencies.
95
+ # Pipfile.lock
96
+
97
+ # UV
98
+ # Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
99
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
100
+ # commonly ignored for libraries.
101
+ # uv.lock
102
+
103
+ # poetry
104
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
105
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
106
+ # commonly ignored for libraries.
107
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
108
+ # poetry.lock
109
+ # poetry.toml
110
+
111
+ # pdm
112
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
113
+ # pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
114
+ # https://pdm-project.org/en/latest/usage/project/#working-with-version-control
115
+ # pdm.lock
116
+ # pdm.toml
117
+ .pdm-python
118
+ .pdm-build/
119
+
120
+ # pixi
121
+ # Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
122
+ # pixi.lock
123
+ # Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
124
+ # in the .venv directory. It is recommended not to include this directory in version control.
125
+ .pixi
126
+
127
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
128
+ __pypackages__/
129
+
130
+ # Celery stuff
131
+ celerybeat-schedule
132
+ celerybeat.pid
133
+
134
+ # Redis
135
+ *.rdb
136
+ *.aof
137
+ *.pid
138
+
139
+ # RabbitMQ
140
+ mnesia/
141
+ rabbitmq/
142
+ rabbitmq-data/
143
+
144
+ # ActiveMQ
145
+ activemq-data/
146
+
147
+ # SageMath parsed files
148
+ *.sage.py
149
+
150
+ # Environments
151
+ .env
152
+ .envrc
153
+ .venv
154
+ env/
155
+ venv/
156
+ ENV/
157
+ env.bak/
158
+ venv.bak/
159
+
160
+ # Spyder project settings
161
+ .spyderproject
162
+ .spyproject
163
+
164
+ # Rope project settings
165
+ .ropeproject
166
+
167
+ # mkdocs documentation
168
+ /site
169
+
170
+ # mypy
171
+ .mypy_cache/
172
+ .dmypy.json
173
+ dmypy.json
174
+
175
+ # Pyre type checker
176
+ .pyre/
177
+
178
+ # pytype static type analyzer
179
+ .pytype/
180
+
181
+ # Cython debug symbols
182
+ cython_debug/
183
+
184
+ # PyCharm
185
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
186
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
187
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
188
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
189
+ # .idea/
190
+
191
+ # Abstra
192
+ # Abstra is an AI-powered process automation framework.
193
+ # Ignore directories containing user credentials, local state, and settings.
194
+ # Learn more at https://abstra.io/docs
195
+ .abstra/
196
+
197
+ # Visual Studio Code
198
+ # Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
199
+ # that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
200
+ # and can be added to the global gitignore or merged into this file. However, if you prefer,
201
+ # you could uncomment the following to ignore the entire vscode folder
202
+ .vscode/
203
+ # Temporary file for partial code execution
204
+ tempCodeRunnerFile.py
205
+
206
+ # Ruff stuff:
207
+ .ruff_cache/
208
+
209
+ # PyPI configuration file
210
+ .pypirc
211
+
212
+ # Marimo
213
+ marimo/_static/
214
+ marimo/_lsp/
215
+ __marimo__/
216
+
217
+ # Streamlit
218
+ .streamlit/secrets.toml
@@ -0,0 +1 @@
1
+ 3.11
@@ -0,0 +1,36 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <Config xmlns="http://pypi.org/project/xsdata" version="26.2">
3
+ <Output maxLineLength="88" genericCollections="false">
4
+ <Package>generated</Package>
5
+ <Format repr="true" eq="true" order="false" unsafeHash="false" frozen="false" slots="false" kwOnly="true">dataclasses</Format>
6
+ <Structure>single-package</Structure>
7
+ <DocstringStyle>Google</DocstringStyle>
8
+ <RelativeImports>false</RelativeImports>
9
+ <CompoundFields defaultName="choice" useSubstitutionGroups="false" forceDefaultName="true" maxNameParts="3">true</CompoundFields>
10
+ <WrapperFields>false</WrapperFields>
11
+ <UnnestClasses>false</UnnestClasses>
12
+ <IgnorePatterns>false</IgnorePatterns>
13
+ <IncludeHeader>false</IncludeHeader>
14
+ </Output>
15
+ <Conventions>
16
+ <ClassName case="pascalCase" safePrefix="type"/>
17
+ <FieldName case="snakeCase" safePrefix="value"/>
18
+ <ConstantName case="screamingSnakeCase" safePrefix="value"/>
19
+ <ModuleName case="snakeCase" safePrefix="mod"/>
20
+ <PackageName case="snakeCase" safePrefix="pkg"/>
21
+ </Conventions>
22
+ <Substitutions>
23
+ <Substitution type="package" search="http://www.w3.org/2001/XMLSchema" replace="xs"/>
24
+ <Substitution type="package" search="http://www.w3.org/XML/1998/namespace" replace="xml"/>
25
+ <Substitution type="package" search="http://www.w3.org/2001/XMLSchema-instance" replace="xsi"/>
26
+ <Substitution type="package" search="http://www.w3.org/1998/Math/MathML" replace="mathml3"/>
27
+ <Substitution type="package" search="http://www.w3.org/1999/xlink" replace="xlink"/>
28
+ <Substitution type="package" search="http://www.w3.org/1999/xhtml" replace="xhtml"/>
29
+ <Substitution type="package" search="http://schemas.xmlsoap.org/wsdl/soap/" replace="soap"/>
30
+ <Substitution type="package" search="http://schemas.xmlsoap.org/wsdl/soap12/" replace="soap12"/>
31
+ <Substitution type="package" search="http://schemas.xmlsoap.org/soap/envelope/" replace="soapenv"/>
32
+ <Substitution type="package" search="http://schemas.xmlsoap.org/soap/encoding/" replace="soapenc"/>
33
+ <Substitution type="class" search="(.*)Class$" replace="\1Type"/>
34
+ </Substitutions>
35
+ <Extensions/>
36
+ </Config>
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Nathan Miersen
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,153 @@
1
+ Metadata-Version: 2.5
2
+ Name: xtce-lib
3
+ Version: 0.1.0a1
4
+ Summary: Python tools for working with XTCE databases
5
+ Author-email: Nathan Miersen <nrmiersen@gmail.com>
6
+ License-File: LICENSE
7
+ Requires-Python: >=3.11
8
+ Requires-Dist: lxml>=6.1.0
9
+ Requires-Dist: pydantic>=2.13.4
10
+ Requires-Dist: xsdata>=26.2
11
+ Description-Content-Type: text/markdown
12
+
13
+ # xtce-lib
14
+
15
+ [![Python](https://img.shields.io/badge/python-3.11%2B-blue.svg)](https://www.python.org/downloads/)
16
+ [![License: MIT](https://img.shields.io/badge/license-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
17
+ [![Development Status](https://img.shields.io/badge/status-alpha-orange.svg)](https://img.shields.io/badge/status-alpha-orange.svg)
18
+ [![Code Style](https://img.shields.io/badge/code%20style-ruff-000000.svg)](https://github.com/astral-sh/ruff)
19
+ [![Package Manager](https://img.shields.io/badge/package%20manager-uv-blueviolet.svg)](https://docs.astral.sh/uv/)
20
+
21
+ `xtce-lib` provides Python tools for working with XTCE databases.
22
+
23
+ It focuses on three pieces of functionality:
24
+
25
+ - A unified, Pythonic XTCE model that flattens version-specific XML structure into a cleaner API.
26
+ - XTCE file parsing and schema validation for XTCE 1.1, 1.2, and 1.3 documents.
27
+ - XTCE path and registry helpers for resolving references inside a database.
28
+
29
+ **Alpha software:** the API is not stable yet and may change in future releases.
30
+
31
+ ## Supported Versions
32
+
33
+ `xtce-lib` currently supports XTCE versions [`1.1`](https://www.omg.org/spec/XTCE/1.1/), [`1.2`](https://www.omg.org/spec/XTCE/1.2/), and [`1.3`](https://www.omg.org/spec/XTCE/1.3/).
34
+
35
+ ## Installation
36
+
37
+ From PyPI:
38
+ ```bash
39
+ pip install xtce-lib
40
+ ```
41
+
42
+ ## Quick Start
43
+
44
+ ### Create an XTCE database
45
+
46
+ ```python
47
+ from xtce_lib import XtceDatabase, xtce
48
+
49
+ db = XtceDatabase(name="CONKSAT1")
50
+
51
+ db.command_metadata = xtce.CommandMetadata(
52
+ argument_types=[
53
+ xtce.IntegerArgument(
54
+ name="uint32",
55
+ encoding_type=xtce.IntegerDataEncoding(
56
+ encoding=xtce.IntegerEncoding.UNSIGNED,
57
+ size_in_bits=32,
58
+ ),
59
+ signed=False,
60
+ ),
61
+ xtce.FloatArgument(
62
+ name="float32",
63
+ encoding_type=xtce.FloatDataEncoding(
64
+ encoding=xtce.FloatEncoding.IEEE754,
65
+ size_in_bits=32,
66
+ ),
67
+ ),
68
+ ],
69
+ )
70
+ ```
71
+
72
+ The database model removes XML-only intermediate nodes, so you can work with the model directly:
73
+
74
+ ```python
75
+ for argument in db.command_metadata.argument_types:
76
+ print(argument.name)
77
+ ```
78
+
79
+ After creating the database, writing to an XTCE document is as simple as:
80
+ ```python
81
+ from pathlib import Path
82
+ from xtce_lib import XtceFile, XtceVersion
83
+
84
+ db.to_file(Path("CONKSAT1_XTCE.xml"), XtceVersion.V1_2)
85
+ ```
86
+
87
+ ### Parse an XTCE file
88
+
89
+ ```python
90
+ from pathlib import Path
91
+ from xtce_lib import XtceDatabase, XtceFile
92
+
93
+ xtce_file = XtceFile(Path("CONKSAT1-XTCE.xml"))
94
+ db: XtceDatabase = xtce_file.database
95
+ ```
96
+
97
+ `XtceFile` can validate the XTCE against the XML schema and parse the XML into the unified `XtceDatabase` model.
98
+
99
+ ### Work with object paths
100
+
101
+ ```python
102
+ >>> from xtce_lib import XtcePath
103
+ >>> path = XtcePath("/CONKSAT1/BUS[2].BatteryVoltage")
104
+ >>> root_path = XtcePath("/CONKSAT1")
105
+ >>> path.relative_to(root_path)
106
+ XtcePath('BUS[2].BatteryVoltage')
107
+ >>> path.contains_array
108
+ True
109
+ >>> path.contains_aggregate
110
+ True
111
+ ```
112
+
113
+ `XtcePath` is a pathlib-like helper for XTCE hierarchies, including support for array and aggregate objects.
114
+
115
+ ## Development Roadmap
116
+ - [x] Write a class to represent XTCE object paths (`XtcePath`)
117
+ - [x] Generate Python representations of the XML schemas with `xsdata`
118
+ - [x] Write a class to represent an XTCE file (`XtceFile`)
119
+ - [x] Write a class to represent the unified XTCE model (`XtceDatabase`)
120
+ - [x] Scaffold the structure of the unified XTCE model
121
+ - [ ] Implement all base subclasses in the unified model, including translation methods
122
+ - [x] Algorithm models
123
+ - [x] Array models
124
+ - [x] Calibrator models
125
+ - [x] Common models
126
+ - [x] Condition models
127
+ - [x] Range models
128
+ - [x] Reference models
129
+ - [x] Stream models
130
+ - [x] Time models
131
+ - [x] Trigger models
132
+ - [x] Verifier models
133
+ - [x] Alarm models
134
+ - [x] Codec models
135
+ - [x] Datatype models
136
+ - [x] Argument models
137
+ - [x] Container models
138
+ - [x] Command models
139
+ - [x] Parameter models
140
+ - [ ] Telemetry models
141
+ - [ ] Space system
142
+ - [ ] Enum models
143
+ - [x] Refactor translation methods for inherited classes
144
+ - [ ] Implement unified model serialization and deserialization
145
+ - [ ] Release alpha
146
+ - [ ] Implement full model semantic validation
147
+ - [ ] Write end-to-end tests for generating and parsing XTCE files
148
+ - [ ] Write documentation
149
+ - [ ] Add examples to all applicable model Fields
150
+ - [ ] Automate API documentation generation
151
+
152
+ ## Disclaimer
153
+ This project is an independent open-source implementation and is not affiliated with, endorsed by, or sponsored by the Object Management Group (OMG). XTCE is a specification developed by OMG. All trademarks are the property of their respective owners.
@@ -0,0 +1,141 @@
1
+ # xtce-lib
2
+
3
+ [![Python](https://img.shields.io/badge/python-3.11%2B-blue.svg)](https://www.python.org/downloads/)
4
+ [![License: MIT](https://img.shields.io/badge/license-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
+ [![Development Status](https://img.shields.io/badge/status-alpha-orange.svg)](https://img.shields.io/badge/status-alpha-orange.svg)
6
+ [![Code Style](https://img.shields.io/badge/code%20style-ruff-000000.svg)](https://github.com/astral-sh/ruff)
7
+ [![Package Manager](https://img.shields.io/badge/package%20manager-uv-blueviolet.svg)](https://docs.astral.sh/uv/)
8
+
9
+ `xtce-lib` provides Python tools for working with XTCE databases.
10
+
11
+ It focuses on three pieces of functionality:
12
+
13
+ - A unified, Pythonic XTCE model that flattens version-specific XML structure into a cleaner API.
14
+ - XTCE file parsing and schema validation for XTCE 1.1, 1.2, and 1.3 documents.
15
+ - XTCE path and registry helpers for resolving references inside a database.
16
+
17
+ **Alpha software:** the API is not stable yet and may change in future releases.
18
+
19
+ ## Supported Versions
20
+
21
+ `xtce-lib` currently supports XTCE versions [`1.1`](https://www.omg.org/spec/XTCE/1.1/), [`1.2`](https://www.omg.org/spec/XTCE/1.2/), and [`1.3`](https://www.omg.org/spec/XTCE/1.3/).
22
+
23
+ ## Installation
24
+
25
+ From PyPI:
26
+ ```bash
27
+ pip install xtce-lib
28
+ ```
29
+
30
+ ## Quick Start
31
+
32
+ ### Create an XTCE database
33
+
34
+ ```python
35
+ from xtce_lib import XtceDatabase, xtce
36
+
37
+ db = XtceDatabase(name="CONKSAT1")
38
+
39
+ db.command_metadata = xtce.CommandMetadata(
40
+ argument_types=[
41
+ xtce.IntegerArgument(
42
+ name="uint32",
43
+ encoding_type=xtce.IntegerDataEncoding(
44
+ encoding=xtce.IntegerEncoding.UNSIGNED,
45
+ size_in_bits=32,
46
+ ),
47
+ signed=False,
48
+ ),
49
+ xtce.FloatArgument(
50
+ name="float32",
51
+ encoding_type=xtce.FloatDataEncoding(
52
+ encoding=xtce.FloatEncoding.IEEE754,
53
+ size_in_bits=32,
54
+ ),
55
+ ),
56
+ ],
57
+ )
58
+ ```
59
+
60
+ The database model removes XML-only intermediate nodes, so you can work with the model directly:
61
+
62
+ ```python
63
+ for argument in db.command_metadata.argument_types:
64
+ print(argument.name)
65
+ ```
66
+
67
+ After creating the database, writing to an XTCE document is as simple as:
68
+ ```python
69
+ from pathlib import Path
70
+ from xtce_lib import XtceFile, XtceVersion
71
+
72
+ db.to_file(Path("CONKSAT1_XTCE.xml"), XtceVersion.V1_2)
73
+ ```
74
+
75
+ ### Parse an XTCE file
76
+
77
+ ```python
78
+ from pathlib import Path
79
+ from xtce_lib import XtceDatabase, XtceFile
80
+
81
+ xtce_file = XtceFile(Path("CONKSAT1-XTCE.xml"))
82
+ db: XtceDatabase = xtce_file.database
83
+ ```
84
+
85
+ `XtceFile` can validate the XTCE against the XML schema and parse the XML into the unified `XtceDatabase` model.
86
+
87
+ ### Work with object paths
88
+
89
+ ```python
90
+ >>> from xtce_lib import XtcePath
91
+ >>> path = XtcePath("/CONKSAT1/BUS[2].BatteryVoltage")
92
+ >>> root_path = XtcePath("/CONKSAT1")
93
+ >>> path.relative_to(root_path)
94
+ XtcePath('BUS[2].BatteryVoltage')
95
+ >>> path.contains_array
96
+ True
97
+ >>> path.contains_aggregate
98
+ True
99
+ ```
100
+
101
+ `XtcePath` is a pathlib-like helper for XTCE hierarchies, including support for array and aggregate objects.
102
+
103
+ ## Development Roadmap
104
+ - [x] Write a class to represent XTCE object paths (`XtcePath`)
105
+ - [x] Generate Python representations of the XML schemas with `xsdata`
106
+ - [x] Write a class to represent an XTCE file (`XtceFile`)
107
+ - [x] Write a class to represent the unified XTCE model (`XtceDatabase`)
108
+ - [x] Scaffold the structure of the unified XTCE model
109
+ - [ ] Implement all base subclasses in the unified model, including translation methods
110
+ - [x] Algorithm models
111
+ - [x] Array models
112
+ - [x] Calibrator models
113
+ - [x] Common models
114
+ - [x] Condition models
115
+ - [x] Range models
116
+ - [x] Reference models
117
+ - [x] Stream models
118
+ - [x] Time models
119
+ - [x] Trigger models
120
+ - [x] Verifier models
121
+ - [x] Alarm models
122
+ - [x] Codec models
123
+ - [x] Datatype models
124
+ - [x] Argument models
125
+ - [x] Container models
126
+ - [x] Command models
127
+ - [x] Parameter models
128
+ - [ ] Telemetry models
129
+ - [ ] Space system
130
+ - [ ] Enum models
131
+ - [x] Refactor translation methods for inherited classes
132
+ - [ ] Implement unified model serialization and deserialization
133
+ - [ ] Release alpha
134
+ - [ ] Implement full model semantic validation
135
+ - [ ] Write end-to-end tests for generating and parsing XTCE files
136
+ - [ ] Write documentation
137
+ - [ ] Add examples to all applicable model Fields
138
+ - [ ] Automate API documentation generation
139
+
140
+ ## Disclaimer
141
+ This project is an independent open-source implementation and is not affiliated with, endorsed by, or sponsored by the Object Management Group (OMG). XTCE is a specification developed by OMG. All trademarks are the property of their respective owners.
@@ -0,0 +1,64 @@
1
+ [build-system]
2
+ requires = ["hatchling"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "xtce-lib"
7
+ version = "0.1.0a1"
8
+ description = "Python tools for working with XTCE databases"
9
+ readme = "README.md"
10
+ authors = [{ name = "Nathan Miersen", email = "nrmiersen@gmail.com" }]
11
+ requires-python = ">=3.11"
12
+ dependencies = ["lxml>=6.1.0", "pydantic>=2.13.4", "xsdata>=26.2"]
13
+
14
+ [dependency-groups]
15
+ dev = [
16
+ "docformatter>=1.7.8",
17
+ "lxml-stubs>=0.5.1",
18
+ "pytest>=9.0.3",
19
+ "types-lxml>=2026.2.16",
20
+ "xsdata[cli]>=26.2",
21
+ ]
22
+
23
+ [tool.docformatter]
24
+ wrap-summaries = 88
25
+ wrap-descriptions = 88
26
+ close-quotes-on-newline = true
27
+ blank = true
28
+ exclude = ["generated", "xsd"]
29
+
30
+ [tool.pyright]
31
+ typeCheckingMode = "strict"
32
+ reportMatchNotExhaustive = "error"
33
+ reportPrivateUsage = false
34
+ reportUnknownVariableType = false
35
+ reportUnnecessaryIsInstance = false
36
+ reportIncompatibleMethodOverride = false
37
+ exclude = [
38
+ "**/.*",
39
+ ".venv",
40
+ "**/node_modules/**",
41
+ "**/__pycache__",
42
+ "**/generated/**",
43
+ "**/xsd/**",
44
+ ]
45
+
46
+ [tool.ruff]
47
+ line-length = 88
48
+ exclude = ["**generated/**"]
49
+ [tool.ruff.lint]
50
+ select = [
51
+ "D", # pydocstyle
52
+ "I", # isort
53
+ "F", # pyflakes
54
+ ]
55
+ ignore = [
56
+ "D203", # Conflicts with D211
57
+ "D205",
58
+ "D213", # Conflicts with D212
59
+ ]
60
+ extend-select = ["D413"]
61
+ [tool.ruff.lint.isort]
62
+ known-first-party = ["xtce_lib"]
63
+ [tool.ruff.lint.pydocstyle]
64
+ convention = "google"