openepcis-client 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.
- openepcis_client-0.1.0/.github/workflows/ci.yml +86 -0
- openepcis_client-0.1.0/.github/workflows/publish.yml +44 -0
- openepcis_client-0.1.0/.gitignore +7 -0
- openepcis_client-0.1.0/CONTRIBUTING.md +30 -0
- openepcis_client-0.1.0/LICENSE +201 -0
- openepcis_client-0.1.0/LICENSES/Apache-2.0.txt +73 -0
- openepcis_client-0.1.0/NOTICE +9 -0
- openepcis_client-0.1.0/PKG-INFO +137 -0
- openepcis_client-0.1.0/README.md +105 -0
- openepcis_client-0.1.0/REUSE.toml +13 -0
- openepcis_client-0.1.0/examples/publish_product.py +67 -0
- openepcis_client-0.1.0/pyproject.toml +90 -0
- openepcis_client-0.1.0/src/openepcis_client/__init__.py +5 -0
- openepcis_client-0.1.0/src/openepcis_client/core/__init__.py +7 -0
- openepcis_client-0.1.0/src/openepcis_client/core/auth.py +335 -0
- openepcis_client-0.1.0/src/openepcis_client/core/client.py +255 -0
- openepcis_client-0.1.0/src/openepcis_client/core/config.py +30 -0
- openepcis_client-0.1.0/src/openepcis_client/core/errors.py +73 -0
- openepcis_client-0.1.0/src/openepcis_client/core/gs1.py +220 -0
- openepcis_client-0.1.0/src/openepcis_client/events/__init__.py +53 -0
- openepcis_client-0.1.0/src/openepcis_client/events/cbv.py +102 -0
- openepcis_client-0.1.0/src/openepcis_client/events/document.py +669 -0
- openepcis_client-0.1.0/src/openepcis_client/events/service.py +312 -0
- openepcis_client-0.1.0/src/openepcis_client/masterdata/__init__.py +20 -0
- openepcis_client-0.1.0/src/openepcis_client/masterdata/payload.py +91 -0
- openepcis_client-0.1.0/src/openepcis_client/masterdata/service.py +221 -0
- openepcis_client-0.1.0/src/openepcis_client/masterdata/vocabulary.json +188 -0
- openepcis_client-0.1.0/src/openepcis_client/masterdata/vocabulary.py +172 -0
- openepcis_client-0.1.0/src/openepcis_client/py.typed +0 -0
- openepcis_client-0.1.0/src/openepcis_client/registry/__init__.py +7 -0
- openepcis_client-0.1.0/src/openepcis_client/registry/service.py +233 -0
- openepcis_client-0.1.0/tests/__init__.py +2 -0
- openepcis_client-0.1.0/tests/conftest.py +76 -0
- openepcis_client-0.1.0/tests/test_auth.py +185 -0
- openepcis_client-0.1.0/tests/test_client.py +151 -0
- openepcis_client-0.1.0/tests/test_events.py +691 -0
- openepcis_client-0.1.0/tests/test_gs1.py +282 -0
- openepcis_client-0.1.0/tests/test_masterdata.py +171 -0
- openepcis_client-0.1.0/tests/test_payload.py +72 -0
- openepcis_client-0.1.0/tests/test_registry.py +168 -0
- openepcis_client-0.1.0/tests/test_vocabulary.py +85 -0
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
# SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
# SPDX-FileCopyrightText: 2026 benelog GmbH & Co. KG
|
|
3
|
+
#
|
|
4
|
+
# The quality gates: format, lint, types, tests on the floor and current
|
|
5
|
+
# interpreters, dependency licences, REUSE compliance.
|
|
6
|
+
|
|
7
|
+
name: ci
|
|
8
|
+
|
|
9
|
+
on:
|
|
10
|
+
push:
|
|
11
|
+
branches: [main]
|
|
12
|
+
pull_request:
|
|
13
|
+
|
|
14
|
+
permissions:
|
|
15
|
+
contents: read
|
|
16
|
+
|
|
17
|
+
jobs:
|
|
18
|
+
format:
|
|
19
|
+
runs-on: ubuntu-latest
|
|
20
|
+
steps:
|
|
21
|
+
- uses: actions/checkout@v4
|
|
22
|
+
- uses: actions/setup-python@v5
|
|
23
|
+
with:
|
|
24
|
+
python-version: "3.12"
|
|
25
|
+
- run: pip install --quiet "ruff==0.16.2"
|
|
26
|
+
- run: ruff format --check --diff .
|
|
27
|
+
|
|
28
|
+
lint:
|
|
29
|
+
runs-on: ubuntu-latest
|
|
30
|
+
steps:
|
|
31
|
+
- uses: actions/checkout@v4
|
|
32
|
+
- uses: actions/setup-python@v5
|
|
33
|
+
with:
|
|
34
|
+
python-version: "3.12"
|
|
35
|
+
- run: pip install --quiet "ruff==0.16.2"
|
|
36
|
+
- run: ruff check .
|
|
37
|
+
|
|
38
|
+
typecheck:
|
|
39
|
+
runs-on: ubuntu-latest
|
|
40
|
+
steps:
|
|
41
|
+
- uses: actions/checkout@v4
|
|
42
|
+
- uses: actions/setup-python@v5
|
|
43
|
+
with:
|
|
44
|
+
python-version: "3.12"
|
|
45
|
+
- run: pip install --quiet -e ".[dev]"
|
|
46
|
+
- run: mypy
|
|
47
|
+
|
|
48
|
+
# 3.10 is the oldest interpreter both host frameworks share (see
|
|
49
|
+
# pyproject.toml); it catches syntax that only works on newer Pythons before
|
|
50
|
+
# a host does.
|
|
51
|
+
test:
|
|
52
|
+
runs-on: ubuntu-latest
|
|
53
|
+
strategy:
|
|
54
|
+
fail-fast: false
|
|
55
|
+
matrix:
|
|
56
|
+
python-version: ["3.10", "3.12", "3.13"]
|
|
57
|
+
steps:
|
|
58
|
+
- uses: actions/checkout@v4
|
|
59
|
+
- uses: actions/setup-python@v5
|
|
60
|
+
with:
|
|
61
|
+
python-version: ${{ matrix.python-version }}
|
|
62
|
+
- run: pip install --quiet -e ".[dev]"
|
|
63
|
+
- run: pytest -q
|
|
64
|
+
|
|
65
|
+
# The library is Apache-2.0; a strong-copyleft dependency would make it
|
|
66
|
+
# effectively copyleft regardless of the header. Fail loudly instead.
|
|
67
|
+
# MPL-2.0 is deliberately NOT on the fail list: it is file-level copyleft,
|
|
68
|
+
# compatible with Apache-2.0 combination, and certifi (a transitive
|
|
69
|
+
# dependency of requests) carries it. Everything else stays permissive.
|
|
70
|
+
licences:
|
|
71
|
+
runs-on: ubuntu-latest
|
|
72
|
+
steps:
|
|
73
|
+
- uses: actions/checkout@v4
|
|
74
|
+
- uses: actions/setup-python@v5
|
|
75
|
+
with:
|
|
76
|
+
python-version: "3.12"
|
|
77
|
+
- run: pip install --quiet -e . pip-licenses
|
|
78
|
+
- run: >
|
|
79
|
+
pip-licenses --packages requests urllib3 idna certifi charset-normalizer
|
|
80
|
+
--fail-on "GPL;GPLv2;GPLv3;LGPL;LGPLv2;LGPLv3;AGPL;AGPLv3"
|
|
81
|
+
|
|
82
|
+
reuse:
|
|
83
|
+
runs-on: ubuntu-latest
|
|
84
|
+
steps:
|
|
85
|
+
- uses: actions/checkout@v4
|
|
86
|
+
- uses: fsfe/reuse-action@v5
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
# SPDX-FileCopyrightText: 2026 benelog GmbH & Co. KG
|
|
3
|
+
#
|
|
4
|
+
# Publishes a release to PyPI. No API token anywhere: PyPI trusts this
|
|
5
|
+
# repository's workflow directly (trusted publishing, OIDC), scoped to the
|
|
6
|
+
# `pypi` environment. The build and the upload are separate jobs so the
|
|
7
|
+
# artefact that reaches PyPI is the one that was built, not one built again.
|
|
8
|
+
|
|
9
|
+
name: publish
|
|
10
|
+
|
|
11
|
+
on:
|
|
12
|
+
release:
|
|
13
|
+
types: [published]
|
|
14
|
+
|
|
15
|
+
permissions:
|
|
16
|
+
contents: read
|
|
17
|
+
|
|
18
|
+
jobs:
|
|
19
|
+
build:
|
|
20
|
+
runs-on: ubuntu-latest
|
|
21
|
+
steps:
|
|
22
|
+
- uses: actions/checkout@v4
|
|
23
|
+
- uses: actions/setup-python@v5
|
|
24
|
+
with:
|
|
25
|
+
python-version: "3.12"
|
|
26
|
+
- run: pip install --quiet build
|
|
27
|
+
- run: python -m build
|
|
28
|
+
- uses: actions/upload-artifact@v4
|
|
29
|
+
with:
|
|
30
|
+
name: dist
|
|
31
|
+
path: dist/
|
|
32
|
+
|
|
33
|
+
publish:
|
|
34
|
+
needs: build
|
|
35
|
+
runs-on: ubuntu-latest
|
|
36
|
+
environment: pypi
|
|
37
|
+
permissions:
|
|
38
|
+
id-token: write
|
|
39
|
+
steps:
|
|
40
|
+
- uses: actions/download-artifact@v4
|
|
41
|
+
with:
|
|
42
|
+
name: dist
|
|
43
|
+
path: dist/
|
|
44
|
+
- uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
<!-- SPDX-License-Identifier: Apache-2.0 -->
|
|
2
|
+
<!-- SPDX-FileCopyrightText: 2026 benelog GmbH & Co. KG -->
|
|
3
|
+
|
|
4
|
+
# Contributing
|
|
5
|
+
|
|
6
|
+
## Licence and sign-off
|
|
7
|
+
|
|
8
|
+
This library is Apache-2.0. Contributions are accepted under the
|
|
9
|
+
[Developer Certificate of Origin](https://developercertificate.org/): sign off
|
|
10
|
+
every commit with `git commit -s`. There is no CLA.
|
|
11
|
+
|
|
12
|
+
Two rules keep the licence honest:
|
|
13
|
+
|
|
14
|
+
1. Every dependency must carry a permissive licence. CI fails the build when a
|
|
15
|
+
copyleft licence appears in the dependency tree. Justify every dependency you
|
|
16
|
+
add, in the commit message.
|
|
17
|
+
2. Do not copy code from copyleft sources. In particular, OCA Odoo modules are
|
|
18
|
+
AGPL-3; GS1 parsing must not be lifted from them. Reimplement from the GS1
|
|
19
|
+
General Specifications instead, and say so in the file header.
|
|
20
|
+
|
|
21
|
+
## Style
|
|
22
|
+
|
|
23
|
+
- English for all code, comments, commits and documentation.
|
|
24
|
+
- Conventional Commits.
|
|
25
|
+
- `ruff format` (pinned version, see `pyproject.toml`), `ruff check`,
|
|
26
|
+
`mypy --strict`, `reuse lint` all pass before a pull request.
|
|
27
|
+
- Every public function that implements a GS1 rule cites the relevant section of
|
|
28
|
+
the GS1 General Specifications.
|
|
29
|
+
- Errors carry structured data, never finished sentences meant for end users.
|
|
30
|
+
Host adapters phrase and translate.
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
|
|
10
|
+
|
|
11
|
+
"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
|
|
12
|
+
|
|
13
|
+
"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
|
|
14
|
+
|
|
15
|
+
"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
|
|
16
|
+
|
|
17
|
+
"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
|
|
18
|
+
|
|
19
|
+
"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
|
|
20
|
+
|
|
21
|
+
"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
|
|
22
|
+
|
|
23
|
+
"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
|
|
24
|
+
|
|
25
|
+
"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
|
|
26
|
+
|
|
27
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
|
|
28
|
+
|
|
29
|
+
2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
|
|
30
|
+
|
|
31
|
+
3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
|
|
32
|
+
|
|
33
|
+
4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
|
|
34
|
+
|
|
35
|
+
(a) You must give any other recipients of the Work or Derivative Works a copy of this License; and
|
|
36
|
+
|
|
37
|
+
(b) You must cause any modified files to carry prominent notices stating that You changed the files; and
|
|
38
|
+
|
|
39
|
+
(c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
|
|
40
|
+
|
|
41
|
+
(d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License.
|
|
42
|
+
|
|
43
|
+
You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
|
|
44
|
+
|
|
45
|
+
5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
|
|
46
|
+
|
|
47
|
+
6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
|
|
48
|
+
|
|
49
|
+
7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
|
|
50
|
+
|
|
51
|
+
8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
|
|
52
|
+
|
|
53
|
+
9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
|
|
54
|
+
|
|
55
|
+
END OF TERMS AND CONDITIONS
|
|
56
|
+
|
|
57
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
58
|
+
|
|
59
|
+
To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives.
|
|
60
|
+
|
|
61
|
+
Copyright [yyyy] [name of copyright owner]
|
|
62
|
+
|
|
63
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
64
|
+
you may not use this file except in compliance with the License.
|
|
65
|
+
You may obtain a copy of the License at
|
|
66
|
+
|
|
67
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
68
|
+
|
|
69
|
+
Unless required by applicable law or agreed to in writing, software
|
|
70
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
71
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
72
|
+
See the License for the specific language governing permissions and
|
|
73
|
+
limitations under the License.
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
openepcis-client-python
|
|
2
|
+
Copyright 2026 benelog GmbH & Co. KG
|
|
3
|
+
|
|
4
|
+
This product includes software developed by benelog GmbH & Co. KG.
|
|
5
|
+
|
|
6
|
+
The GS1 identifier arithmetic in openepcis_client/core/gs1.py implements the
|
|
7
|
+
check digit and key format rules published in the GS1 General Specifications.
|
|
8
|
+
It is a clean-room implementation written by benelog from the specification
|
|
9
|
+
text; it shares no code with any other implementation.
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: openepcis-client
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: OpenEPCIS platform client: core transport and auth, master data publication, GS1 key registry
|
|
5
|
+
Project-URL: Source, https://github.com/openepcis/openepcis-client-python
|
|
6
|
+
Project-URL: Issues, https://github.com/openepcis/openepcis-client-python/issues
|
|
7
|
+
Project-URL: Changelog, https://github.com/openepcis/openepcis-client-python/releases
|
|
8
|
+
Author: benelog GmbH & Co. KG
|
|
9
|
+
License-Expression: Apache-2.0
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
License-File: NOTICE
|
|
12
|
+
Classifier: Development Status :: 3 - Alpha
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Operating System :: OS Independent
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
17
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
18
|
+
Classifier: Typing :: Typed
|
|
19
|
+
Requires-Python: >=3.10
|
|
20
|
+
Requires-Dist: requests>=2.28
|
|
21
|
+
Provides-Extra: dev
|
|
22
|
+
Requires-Dist: epcis-event-hash-generator==1.9.3; extra == 'dev'
|
|
23
|
+
Requires-Dist: mypy>=1.14; extra == 'dev'
|
|
24
|
+
Requires-Dist: pip-licenses>=5; extra == 'dev'
|
|
25
|
+
Requires-Dist: pytest>=8; extra == 'dev'
|
|
26
|
+
Requires-Dist: reuse>=5; extra == 'dev'
|
|
27
|
+
Requires-Dist: ruff==0.16.2; extra == 'dev'
|
|
28
|
+
Requires-Dist: types-requests; extra == 'dev'
|
|
29
|
+
Provides-Extra: hash
|
|
30
|
+
Requires-Dist: epcis-event-hash-generator==1.9.3; extra == 'hash'
|
|
31
|
+
Description-Content-Type: text/markdown
|
|
32
|
+
|
|
33
|
+
<!-- SPDX-License-Identifier: Apache-2.0 -->
|
|
34
|
+
<!-- SPDX-FileCopyrightText: 2026 benelog GmbH & Co. KG -->
|
|
35
|
+
|
|
36
|
+
# openepcis-client-python
|
|
37
|
+
|
|
38
|
+
Client library for the OpenEPCIS platform. It carries the parts of a
|
|
39
|
+
connector that are the same in every host system: transport and authentication,
|
|
40
|
+
GS1 identifier arithmetic, master data publication, and the GS1 key registry.
|
|
41
|
+
Host adapters (the Odoo addon, the ERPNext app) stay thin and framework
|
|
42
|
+
specific; this library holds no host dependency.
|
|
43
|
+
|
|
44
|
+
| | |
|
|
45
|
+
|---|---|
|
|
46
|
+
| Licence | Apache-2.0 |
|
|
47
|
+
| Python | 3.10 or newer |
|
|
48
|
+
| Dependencies | `requests` only |
|
|
49
|
+
| Consumers | `openepcis-odoo` (Odoo 18/19), which vendors this package |
|
|
50
|
+
| Source | https://github.com/openepcis/openepcis-client-python |
|
|
51
|
+
|
|
52
|
+
## Modules
|
|
53
|
+
|
|
54
|
+
```
|
|
55
|
+
openepcis_client/
|
|
56
|
+
core/ Identifiers, Digital Link URIs, transport, auth, errors
|
|
57
|
+
masterdata/ Product and organization records, upsert, bulk, GPC
|
|
58
|
+
registry/ GTIN/GLN allocation, credential deposit, Verified by GS1
|
|
59
|
+
events/ EPCIS 2.0 visibility events: building them, capturing them
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
`masterdata/` and `events/` address two different services. Master data goes to
|
|
63
|
+
the catalog behind the Digital Link resolver; events go to an EPCIS repository,
|
|
64
|
+
on its own host and behind its own permission — capture needs the `capture`
|
|
65
|
+
role, and a credential that publishes products perfectly well is refused there.
|
|
66
|
+
Build a second `Client` for it rather than reusing the resolver's.
|
|
67
|
+
|
|
68
|
+
The resolver endpoints this library depends on are recorded in the Odoo
|
|
69
|
+
repository as `doc/api-contract.json` — paths, verbs and status codes only —
|
|
70
|
+
and its `tools/check-contract.py` compares that file against a running
|
|
71
|
+
deployment.
|
|
72
|
+
|
|
73
|
+
## Installation
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
pip install openepcis-client
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
Releases are cut from tags on GitHub and published to PyPI from there; to
|
|
80
|
+
track an unreleased commit, install from the repository instead:
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
pip install "openepcis-client @ git+https://github.com/openepcis/openepcis-client-python@main"
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
The `hash` extra adds the canonical CBV event hash used as the `eventID` of
|
|
87
|
+
every event this library builds; see `pyproject.toml` for why it is an extra
|
|
88
|
+
and what it pulls in. The Odoo addon does not install the package at all: it
|
|
89
|
+
carries a verbatim copy under `openepcis_connector/vendor/`, so it stays
|
|
90
|
+
installable on any Odoo without a Python package beyond what Odoo ships.
|
|
91
|
+
|
|
92
|
+
## Usage
|
|
93
|
+
|
|
94
|
+
One configured URL; the Keycloak realm and token endpoint are discovered from
|
|
95
|
+
it (RFC 9728). Authentication uses an OIDC offline token, which the host's
|
|
96
|
+
`TokenStore` persists — including the rotated replacement Keycloak may answer
|
|
97
|
+
with on every exchange.
|
|
98
|
+
|
|
99
|
+
```python
|
|
100
|
+
from openepcis_client.core.auth import InMemoryTokenStore, OfflineTokenAuth
|
|
101
|
+
from openepcis_client.core.client import Client
|
|
102
|
+
from openepcis_client.core.config import ClientConfig
|
|
103
|
+
from openepcis_client.masterdata import Masterdata
|
|
104
|
+
from openepcis_client.registry import Registry
|
|
105
|
+
|
|
106
|
+
config = ClientConfig(base_url="https://id.epcis.cloud")
|
|
107
|
+
auth = OfflineTokenAuth(config, InMemoryTokenStore(offline_token), client_id="my-connector")
|
|
108
|
+
client = Client(config, auth)
|
|
109
|
+
|
|
110
|
+
gtin = Registry(client).draw_key("01")
|
|
111
|
+
Masterdata(client).upsert_product(gtin, {"productName": {"en": "Chair"}})
|
|
112
|
+
Registry(client).confirm_key("01", gtin)
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
A complete round trip, including release on failure and a Verified-by-GS1
|
|
116
|
+
check, is in `examples/publish_product.py`.
|
|
117
|
+
|
|
118
|
+
## Status
|
|
119
|
+
|
|
120
|
+
All four modules are in use by the Odoo addon and covered by the test suite.
|
|
121
|
+
The vocabulary manifest the master data payloads are checked against is pinned
|
|
122
|
+
in `masterdata/vocabulary.json`. The version is 0.x: the API is still allowed
|
|
123
|
+
to move between minor versions, and a consumer should pin a release rather
|
|
124
|
+
than track `main`.
|
|
125
|
+
|
|
126
|
+
## Development
|
|
127
|
+
|
|
128
|
+
```bash
|
|
129
|
+
pip install -e ".[dev]"
|
|
130
|
+
pytest
|
|
131
|
+
mypy
|
|
132
|
+
ruff format --check . && ruff check .
|
|
133
|
+
reuse lint
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
Contributions are accepted under the Developer Certificate of Origin: sign off
|
|
137
|
+
your commits with `git commit -s`. There is no CLA.
|