morphir-python 0.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.
- morphir_python-0.0.1/.gitignore +75 -0
- morphir_python-0.0.1/LICENSE +201 -0
- morphir_python-0.0.1/PKG-INFO +269 -0
- morphir_python-0.0.1/README.md +246 -0
- morphir_python-0.0.1/packages/morphir/LICENSE +201 -0
- morphir_python-0.0.1/packages/morphir/README.md +387 -0
- morphir_python-0.0.1/packages/morphir/pyproject.toml +36 -0
- morphir_python-0.0.1/packages/morphir/src/morphir/__init__.py +14 -0
- morphir_python-0.0.1/packages/morphir/src/morphir/ir/__init__.py +110 -0
- morphir_python-0.0.1/packages/morphir/src/morphir/ir/access_controlled.py +15 -0
- morphir_python-0.0.1/packages/morphir/src/morphir/ir/decorations.py +19 -0
- morphir_python-0.0.1/packages/morphir/src/morphir/ir/diagnostics.py +105 -0
- morphir_python-0.0.1/packages/morphir/src/morphir/ir/distribution.py +21 -0
- morphir_python-0.0.1/packages/morphir/src/morphir/ir/document.py +37 -0
- morphir_python-0.0.1/packages/morphir/src/morphir/ir/documented.py +11 -0
- morphir_python-0.0.1/packages/morphir/src/morphir/ir/format_version.py +483 -0
- morphir_python-0.0.1/packages/morphir/src/morphir/ir/fqname.py +9 -0
- morphir_python-0.0.1/packages/morphir/src/morphir/ir/json.py +11 -0
- morphir_python-0.0.1/packages/morphir/src/morphir/ir/literal.py +25 -0
- morphir_python-0.0.1/packages/morphir/src/morphir/ir/meta.py +11 -0
- morphir_python-0.0.1/packages/morphir/src/morphir/ir/migrate.py +1267 -0
- morphir_python-0.0.1/packages/morphir/src/morphir/ir/module.py +17 -0
- morphir_python-0.0.1/packages/morphir/src/morphir/ir/name.py +27 -0
- morphir_python-0.0.1/packages/morphir/src/morphir/ir/package.py +15 -0
- morphir_python-0.0.1/packages/morphir/src/morphir/ir/path.py +25 -0
- morphir_python-0.0.1/packages/morphir/src/morphir/ir/qname.py +9 -0
- morphir_python-0.0.1/packages/morphir/src/morphir/ir/ref.py +17 -0
- morphir_python-0.0.1/packages/morphir/src/morphir/ir/type.py +37 -0
- morphir_python-0.0.1/packages/morphir/src/morphir/ir/type_constraints.py +33 -0
- morphir_python-0.0.1/packages/morphir/src/morphir/ir/type_def.py +19 -0
- morphir_python-0.0.1/packages/morphir/src/morphir/ir/type_spec.py +25 -0
- morphir_python-0.0.1/packages/morphir/src/morphir/ir/v3/__init__.py +64 -0
- morphir_python-0.0.1/packages/morphir/src/morphir/ir/v3/_legacy_value.py +201 -0
- morphir_python-0.0.1/packages/morphir/src/morphir/ir/v3/access_controlled.py +31 -0
- morphir_python-0.0.1/packages/morphir/src/morphir/ir/v3/codec.py +1275 -0
- morphir_python-0.0.1/packages/morphir/src/morphir/ir/v3/codec_v1.py +491 -0
- morphir_python-0.0.1/packages/morphir/src/morphir/ir/v3/codec_v2.py +187 -0
- morphir_python-0.0.1/packages/morphir/src/morphir/ir/v3/distribution.py +42 -0
- morphir_python-0.0.1/packages/morphir/src/morphir/ir/v3/documented.py +13 -0
- morphir_python-0.0.1/packages/morphir/src/morphir/ir/v3/fqname.py +30 -0
- morphir_python-0.0.1/packages/morphir/src/morphir/ir/v3/literal.py +46 -0
- morphir_python-0.0.1/packages/morphir/src/morphir/ir/v3/module.py +32 -0
- morphir_python-0.0.1/packages/morphir/src/morphir/ir/v3/name.py +42 -0
- morphir_python-0.0.1/packages/morphir/src/morphir/ir/v3/package.py +23 -0
- morphir_python-0.0.1/packages/morphir/src/morphir/ir/v3/path.py +29 -0
- morphir_python-0.0.1/packages/morphir/src/morphir/ir/v3/qname.py +16 -0
- morphir_python-0.0.1/packages/morphir/src/morphir/ir/v3/type.py +126 -0
- morphir_python-0.0.1/packages/morphir/src/morphir/ir/v3/value.py +235 -0
- morphir_python-0.0.1/packages/morphir/src/morphir/ir/v4/__init__.py +160 -0
- morphir_python-0.0.1/packages/morphir/src/morphir/ir/v4/access_controlled.py +17 -0
- morphir_python-0.0.1/packages/morphir/src/morphir/ir/v4/annotation.py +75 -0
- morphir_python-0.0.1/packages/morphir/src/morphir/ir/v4/codec.py +2161 -0
- morphir_python-0.0.1/packages/morphir/src/morphir/ir/v4/decorations.py +88 -0
- morphir_python-0.0.1/packages/morphir/src/morphir/ir/v4/distribution.py +56 -0
- morphir_python-0.0.1/packages/morphir/src/morphir/ir/v4/document.py +69 -0
- morphir_python-0.0.1/packages/morphir/src/morphir/ir/v4/documented.py +10 -0
- morphir_python-0.0.1/packages/morphir/src/morphir/ir/v4/fqname.py +69 -0
- morphir_python-0.0.1/packages/morphir/src/morphir/ir/v4/incompleteness.py +78 -0
- morphir_python-0.0.1/packages/morphir/src/morphir/ir/v4/json.py +103 -0
- morphir_python-0.0.1/packages/morphir/src/morphir/ir/v4/literal.py +51 -0
- morphir_python-0.0.1/packages/morphir/src/morphir/ir/v4/meta.py +27 -0
- morphir_python-0.0.1/packages/morphir/src/morphir/ir/v4/module.py +30 -0
- morphir_python-0.0.1/packages/morphir/src/morphir/ir/v4/name.py +69 -0
- morphir_python-0.0.1/packages/morphir/src/morphir/ir/v4/package.py +19 -0
- morphir_python-0.0.1/packages/morphir/src/morphir/ir/v4/path.py +50 -0
- morphir_python-0.0.1/packages/morphir/src/morphir/ir/v4/qname.py +34 -0
- morphir_python-0.0.1/packages/morphir/src/morphir/ir/v4/ref.py +35 -0
- morphir_python-0.0.1/packages/morphir/src/morphir/ir/v4/type.py +140 -0
- morphir_python-0.0.1/packages/morphir/src/morphir/ir/v4/type_constraints.py +91 -0
- morphir_python-0.0.1/packages/morphir/src/morphir/ir/v4/type_def.py +38 -0
- morphir_python-0.0.1/packages/morphir/src/morphir/ir/v4/type_spec.py +64 -0
- morphir_python-0.0.1/packages/morphir/src/morphir/ir/v4/value.py +480 -0
- morphir_python-0.0.1/packages/morphir/src/morphir/ir/value.py +81 -0
- morphir_python-0.0.1/packages/morphir/src/morphir/py.typed +0 -0
- morphir_python-0.0.1/packages/morphir/src/morphir/sdk/__init__.py +110 -0
- morphir_python-0.0.1/packages/morphir/src/morphir/sdk/_compare.py +187 -0
- morphir_python-0.0.1/packages/morphir/src/morphir/sdk/aggregate.py +421 -0
- morphir_python-0.0.1/packages/morphir/src/morphir/sdk/basics.py +504 -0
- morphir_python-0.0.1/packages/morphir/src/morphir/sdk/char.py +110 -0
- morphir_python-0.0.1/packages/morphir/src/morphir/sdk/decimal.py +311 -0
- morphir_python-0.0.1/packages/morphir/src/morphir/sdk/dict.py +336 -0
- morphir_python-0.0.1/packages/morphir/src/morphir/sdk/instant.py +118 -0
- morphir_python-0.0.1/packages/morphir/src/morphir/sdk/int.py +86 -0
- morphir_python-0.0.1/packages/morphir/src/morphir/sdk/key.py +522 -0
- morphir_python-0.0.1/packages/morphir/src/morphir/sdk/list.py +356 -0
- morphir_python-0.0.1/packages/morphir/src/morphir/sdk/local_date.py +436 -0
- morphir_python-0.0.1/packages/morphir/src/morphir/sdk/local_time.py +267 -0
- morphir_python-0.0.1/packages/morphir/src/morphir/sdk/maybe.py +135 -0
- morphir_python-0.0.1/packages/morphir/src/morphir/sdk/number.py +237 -0
- morphir_python-0.0.1/packages/morphir/src/morphir/sdk/regex.py +287 -0
- morphir_python-0.0.1/packages/morphir/src/morphir/sdk/result.py +162 -0
- morphir_python-0.0.1/packages/morphir/src/morphir/sdk/result_list.py +169 -0
- morphir_python-0.0.1/packages/morphir/src/morphir/sdk/rule.py +103 -0
- morphir_python-0.0.1/packages/morphir/src/morphir/sdk/set.py +214 -0
- morphir_python-0.0.1/packages/morphir/src/morphir/sdk/stateful_app.py +49 -0
- morphir_python-0.0.1/packages/morphir/src/morphir/sdk/string.py +427 -0
- morphir_python-0.0.1/packages/morphir/src/morphir/sdk/tuple.py +43 -0
- morphir_python-0.0.1/packages/morphir/src/morphir/sdk/uuid.py +209 -0
- morphir_python-0.0.1/packages/morphir-tools/LICENSE +201 -0
- morphir_python-0.0.1/packages/morphir-tools/README.md +69 -0
- morphir_python-0.0.1/packages/morphir-tools/src/morphir_tools/__init__.py +13 -0
- morphir_python-0.0.1/packages/morphir-tools/src/morphir_tools/cli.py +223 -0
- morphir_python-0.0.1/packages/morphir-tools/src/morphir_tools/py.typed +0 -0
- morphir_python-0.0.1/pyproject.toml +177 -0
- morphir_python-0.0.1/uv.lock +527 -0
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# Python
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
*.so
|
|
6
|
+
.Python
|
|
7
|
+
build/
|
|
8
|
+
develop-eggs/
|
|
9
|
+
dist/
|
|
10
|
+
downloads/
|
|
11
|
+
eggs/
|
|
12
|
+
.eggs/
|
|
13
|
+
lib/
|
|
14
|
+
lib64/
|
|
15
|
+
parts/
|
|
16
|
+
sdist/
|
|
17
|
+
var/
|
|
18
|
+
wheels/
|
|
19
|
+
*.egg-info/
|
|
20
|
+
.installed.cfg
|
|
21
|
+
*.egg
|
|
22
|
+
|
|
23
|
+
# Virtual environments
|
|
24
|
+
.venv/
|
|
25
|
+
venv/
|
|
26
|
+
ENV/
|
|
27
|
+
env/
|
|
28
|
+
|
|
29
|
+
# IDE
|
|
30
|
+
.idea/
|
|
31
|
+
.vscode/
|
|
32
|
+
*.swp
|
|
33
|
+
*.swo
|
|
34
|
+
*~
|
|
35
|
+
|
|
36
|
+
# Type checkers
|
|
37
|
+
.mypy_cache/
|
|
38
|
+
.pyright/
|
|
39
|
+
.ruff_cache/
|
|
40
|
+
|
|
41
|
+
# Testing
|
|
42
|
+
.pytest_cache/
|
|
43
|
+
.coverage
|
|
44
|
+
htmlcov/
|
|
45
|
+
coverage.xml
|
|
46
|
+
*.cover
|
|
47
|
+
.hypothesis/
|
|
48
|
+
|
|
49
|
+
# Build artifacts
|
|
50
|
+
*.manifest
|
|
51
|
+
*.spec
|
|
52
|
+
|
|
53
|
+
# Environments
|
|
54
|
+
.env
|
|
55
|
+
.env.local
|
|
56
|
+
.env.*.local
|
|
57
|
+
|
|
58
|
+
# Misc
|
|
59
|
+
.DS_Store
|
|
60
|
+
*.log
|
|
61
|
+
npm-debug.log*
|
|
62
|
+
yarn-debug.log*
|
|
63
|
+
yarn-error.log*
|
|
64
|
+
|
|
65
|
+
# mise
|
|
66
|
+
.mise.local.toml
|
|
67
|
+
|
|
68
|
+
# Local agent working copies (specs/plans rendered from beads)
|
|
69
|
+
.dev/
|
|
70
|
+
|
|
71
|
+
# Beads runtime lock at repo root (bd creates this; do not commit)
|
|
72
|
+
.beads.gate.lock
|
|
73
|
+
|
|
74
|
+
# behave writes the pretty formatter to this file when its output is piped
|
|
75
|
+
pretty.output
|
|
@@ -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,269 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: morphir-python
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: Morphir domain modeling library, SDK runtime, and CLI for Python
|
|
5
|
+
Project-URL: Homepage, https://github.com/finos/morphir-python
|
|
6
|
+
Project-URL: Documentation, https://morphir.finos.org
|
|
7
|
+
Project-URL: Repository, https://github.com/finos/morphir-python
|
|
8
|
+
Project-URL: Issues, https://github.com/finos/morphir-python/issues
|
|
9
|
+
Author-email: FINOS <morphir@finos.org>
|
|
10
|
+
License-Expression: Apache-2.0
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Keywords: cli,domain-modeling,functional,ir,morphir
|
|
13
|
+
Classifier: Development Status :: 3 - Alpha
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: Operating System :: OS Independent
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
18
|
+
Classifier: Typing :: Typed
|
|
19
|
+
Requires-Python: >=3.14
|
|
20
|
+
Requires-Dist: pygments>=2.20.0
|
|
21
|
+
Requires-Dist: typer>=0.15
|
|
22
|
+
Description-Content-Type: text/markdown
|
|
23
|
+
|
|
24
|
+
[](https://community.finos.org/docs/governance/Software-Projects/stages/incubating)
|
|
25
|
+
[](https://github.com/finos/morphir-python/actions/workflows/ci.yml)
|
|
26
|
+
|
|
27
|
+
# Morphir Python
|
|
28
|
+
|
|
29
|
+
Python port of [Morphir](https://morphir.finos.org) - a library of tools for building and working with functional domain models.
|
|
30
|
+
|
|
31
|
+
Morphir enables you to write business logic once and use it across multiple platforms, languages, and runtimes. It provides a strongly-typed intermediate representation (IR) that captures the semantics of your domain model.
|
|
32
|
+
|
|
33
|
+
## Installation
|
|
34
|
+
|
|
35
|
+
Install the library, Morphir SDK runtime, and CLI together:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
pip install morphir-python
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Or with uv:
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
uv add morphir-python
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
| PyPI distribution | Python imports | Command |
|
|
48
|
+
|-------------------|----------------|---------|
|
|
49
|
+
| [`morphir-python`](https://pypi.org/project/morphir-python/) | `morphir`, `morphir_tools` | `morphir-python` |
|
|
50
|
+
|
|
51
|
+
The distribution includes the core library and tools. It does not require a
|
|
52
|
+
separate `morphir` package from PyPI.
|
|
53
|
+
|
|
54
|
+
## Quick Start
|
|
55
|
+
|
|
56
|
+
Morphir IR comes in two first-class versions: format 3.0.0 (`morphir.ir.v3`), which
|
|
57
|
+
morphir-elm writes today, and draft IR v4 (`morphir.ir.v4`, also re-exported as
|
|
58
|
+
`morphir.ir`). Read a morphir-elm file and migrate it to v4:
|
|
59
|
+
|
|
60
|
+
```python
|
|
61
|
+
from pathlib import Path
|
|
62
|
+
|
|
63
|
+
from morphir.ir.migrate import v3_to_v4
|
|
64
|
+
from morphir.ir.v3 import codec
|
|
65
|
+
|
|
66
|
+
library = codec.decode_versioned_distribution(Path("morphir-ir.json").read_text())
|
|
67
|
+
v4_library = v3_to_v4(library).value
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Or from the command line:
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
morphir-python ir inspect morphir-ir.json
|
|
74
|
+
morphir-python ir convert morphir-ir.json --to v4 -o morphir-ir.v4.json
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
See the [morphir package README](packages/morphir/README.md#morphir-ir-versions)
|
|
78
|
+
for format-version handling, the draft v4 status, and migrations, the
|
|
79
|
+
[IR specs](openspec/specs/) for the requirements, and the archived
|
|
80
|
+
[`add-ir-v3-support` change](openspec/changes/archive/2026-10-27-add-ir-v3-support/proposal.md)
|
|
81
|
+
for the design.
|
|
82
|
+
|
|
83
|
+
## Morphir SDK
|
|
84
|
+
|
|
85
|
+
`morphir.sdk` is the Python runtime for the Morphir SDK, the standard library that
|
|
86
|
+
Morphir models compile against. It covers the core modules of the
|
|
87
|
+
`Morphir.IR.SDK` specification: `basics`, `char`, `string`, `list`, `dict`, `set`,
|
|
88
|
+
`maybe`, `result`, `tuple`, `decimal`, `int` and `number`. The behaviour follows
|
|
89
|
+
elm/core 1.0.5 and the `Morphir.SDK` Elm runtime.
|
|
90
|
+
|
|
91
|
+
```python
|
|
92
|
+
from morphir.sdk import basics
|
|
93
|
+
from morphir.sdk import decimal as Decimal
|
|
94
|
+
from morphir.sdk import dict as Dict
|
|
95
|
+
from morphir.sdk import list as List
|
|
96
|
+
from morphir.sdk import maybe as Maybe
|
|
97
|
+
from morphir.sdk.maybe import Just, Nothing
|
|
98
|
+
|
|
99
|
+
# Elm argument order, data last, not curried
|
|
100
|
+
List.map(lambda n: n * 2, (1, 2, 3)) # (2, 4, 6)
|
|
101
|
+
Maybe.with_default(0, List.head(())) # 0
|
|
102
|
+
|
|
103
|
+
# Immutable Dict, sorted by structural comparable keys
|
|
104
|
+
prices = Dict.from_list(((("EUR", 2), 1.5), (("EUR", 1), 1.2)))
|
|
105
|
+
Dict.keys(prices) # (("EUR", 1), ("EUR", 2))
|
|
106
|
+
Dict.get(("EUR", 1), prices) # Just(value=1.2)
|
|
107
|
+
|
|
108
|
+
# Elm number rules
|
|
109
|
+
basics.round(2.5) # 3, not Python's 2
|
|
110
|
+
basics.integer_divide(-7, 2) # -3
|
|
111
|
+
Decimal.to_string(Decimal.add(Decimal.tenth(1), Decimal.tenth(2))) # "0.3"
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
Names are the Elm names in snake_case (`withDefault` is `with_default`). See the
|
|
115
|
+
[`morphir` package README](packages/morphir/README.md#morphir-sdk) for the
|
|
116
|
+
conventions and the list of departures from Elm.
|
|
117
|
+
|
|
118
|
+
## Requirements
|
|
119
|
+
|
|
120
|
+
- Python 3.14+
|
|
121
|
+
|
|
122
|
+
## Development Setup
|
|
123
|
+
|
|
124
|
+
This project uses [mise](https://mise.jdx.dev/) for tool management and [uv](https://docs.astral.sh/uv/) for Python package management.
|
|
125
|
+
|
|
126
|
+
### Prerequisites
|
|
127
|
+
|
|
128
|
+
Install mise (if not already installed):
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
curl https://mise.run | sh
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
### Setup
|
|
135
|
+
|
|
136
|
+
1. Clone the repository:
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
git clone https://github.com/finos/morphir-python.git
|
|
140
|
+
cd morphir-python
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
2. Install tools and dependencies:
|
|
144
|
+
|
|
145
|
+
```bash
|
|
146
|
+
mise install
|
|
147
|
+
uv sync --all-groups
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
3. Run the checks:
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
mise run check
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
### Available Tasks
|
|
157
|
+
|
|
158
|
+
| Task | Description |
|
|
159
|
+
|------|-------------|
|
|
160
|
+
| `mise run lint` | Run ruff linter |
|
|
161
|
+
| `mise run format` | Run ruff formatter |
|
|
162
|
+
| `mise run typecheck` | Run mypy and pyright |
|
|
163
|
+
| `mise run test` | Run pytest unit tests |
|
|
164
|
+
| `mise run test-bdd` | Run behave BDD tests |
|
|
165
|
+
| `mise run test-all` | Run all tests |
|
|
166
|
+
| `mise run coverage` | Run tests with coverage |
|
|
167
|
+
| `mise run check` | Run all checks |
|
|
168
|
+
| `mise run build` | Build packages |
|
|
169
|
+
| `mise run release-check` | Validate built packages and scan runtime dependencies for vulnerabilities and licenses |
|
|
170
|
+
| `mise run clean` | Clean build artifacts |
|
|
171
|
+
|
|
172
|
+
## Releases
|
|
173
|
+
|
|
174
|
+
The initial PyPI release is `morphir-python==0.0.1`, containing both the `morphir`
|
|
175
|
+
library and the `morphir-python` CLI. Python 3.14 or later is required. The root
|
|
176
|
+
`pyproject.toml` defines the public distribution. The library workspace under
|
|
177
|
+
`packages/morphir/` remains independent of CLI dependencies for development; it
|
|
178
|
+
is included in the bundle rather than published separately by this workflow.
|
|
179
|
+
|
|
180
|
+
Publishing uses [PyPI trusted publishing](https://docs.pypi.org/trusted-publishers/using-a-publisher/)
|
|
181
|
+
without a stored PyPI token. Configure the `morphir-python` project on PyPI with:
|
|
182
|
+
|
|
183
|
+
| Publisher field | Value |
|
|
184
|
+
|-----------------|-------|
|
|
185
|
+
| Owner | `finos` |
|
|
186
|
+
| Repository | `morphir-python` |
|
|
187
|
+
| Workflow filename | `release.yml` |
|
|
188
|
+
| Environment | `pypi` |
|
|
189
|
+
|
|
190
|
+
The GitHub `pypi` environment permits release tags matching `v*` or `python-v*`.
|
|
191
|
+
After maintainer approval, push a tag such as `python-v0.0.1` whose version matches
|
|
192
|
+
root package metadata and the runtime `__version__` values. Refresh `uv.lock`
|
|
193
|
+
when changing versions. A new tag records the corrected source without moving
|
|
194
|
+
the earlier failed `v0.0.1` tag.
|
|
195
|
+
|
|
196
|
+
The release workflow runs the same lint, format, type, coverage and BDD checks as
|
|
197
|
+
PR CI. It builds the bundle once, validates wheel and source metadata and license
|
|
198
|
+
files, verifies that every library and CLI source file is in the wheel, installs
|
|
199
|
+
only that wheel in an isolated environment, checks imports and the CLI, then
|
|
200
|
+
scans the locked runtime dependency versions with `pip-audit` and `pip-licenses`.
|
|
201
|
+
Known vulnerabilities, audit failures, unknown licenses and licenses outside the
|
|
202
|
+
Apache-2.0, MIT, BSD-2-Clause, BSD-3-Clause and ISC allowlist block publication.
|
|
203
|
+
The allowlist also accepts corresponding legacy license classifiers. The CVE
|
|
204
|
+
scan queries third-party dependencies, excluding the first-party bundle being
|
|
205
|
+
released. These checks use package metadata and known vulnerability advisories;
|
|
206
|
+
they do not replace a source-code license or security review. Scan reports are
|
|
207
|
+
retained as workflow artifacts.
|
|
208
|
+
|
|
209
|
+
Only the publishing job receives `id-token: write`. It publishes the checked
|
|
210
|
+
artifacts, then a separate job creates the GitHub release. The workflow's manual
|
|
211
|
+
**Run workflow** action runs qualification without publishing. To qualify locally:
|
|
212
|
+
|
|
213
|
+
```bash
|
|
214
|
+
mise run install
|
|
215
|
+
mise run check
|
|
216
|
+
mise run coverage
|
|
217
|
+
mise run build
|
|
218
|
+
RELEASE_TAG=python-v0.0.1 mise run release-check
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
## Project Principles
|
|
222
|
+
|
|
223
|
+
This project follows functional programming principles:
|
|
224
|
+
|
|
225
|
+
- **Immutability**: Data structures are immutable by default
|
|
226
|
+
- **Type Safety**: Strict type annotations with mypy and pyright
|
|
227
|
+
- **Algebraic Data Types**: Using `@dataclass(frozen=True)`, Unions, and Protocols
|
|
228
|
+
- **Making Illegal States Unrepresentable**: Domain modeling that prevents invalid states at compile time
|
|
229
|
+
|
|
230
|
+
## Roadmap
|
|
231
|
+
|
|
232
|
+
1. Core IR model implementation
|
|
233
|
+
2. Morphir SDK runtime (`morphir.sdk`) - core modules done
|
|
234
|
+
3. JSON serialization/deserialization
|
|
235
|
+
4. Type checking and validation
|
|
236
|
+
5. Code generation backends
|
|
237
|
+
6. CLI tooling
|
|
238
|
+
|
|
239
|
+
## Contributing
|
|
240
|
+
|
|
241
|
+
For any questions, bugs or feature requests please open an [issue](https://github.com/finos/morphir-python/issues).
|
|
242
|
+
For anything else please send an email to morphir@finos.org.
|
|
243
|
+
|
|
244
|
+
To submit a contribution:
|
|
245
|
+
|
|
246
|
+
1. Fork it (<https://github.com/finos/morphir-python/fork>)
|
|
247
|
+
2. Create your feature branch (`git checkout -b feature/fooBar`)
|
|
248
|
+
3. Read our [contribution guidelines](.github/CONTRIBUTING.md) and [Community Code of Conduct](https://www.finos.org/code-of-conduct)
|
|
249
|
+
4. Commit your changes (`git commit -am 'Add some fooBar'`)
|
|
250
|
+
5. Push to the branch (`git push origin feature/fooBar`)
|
|
251
|
+
6. Create a new Pull Request
|
|
252
|
+
|
|
253
|
+
_NOTE:_ Commits and pull requests to FINOS repositories will only be accepted from those contributors with an active, executed Individual Contributor License Agreement (ICLA) with FINOS OR who are covered under an existing and active Corporate Contribution License Agreement (CCLA) executed with FINOS. Commits from individuals not covered under an ICLA or CCLA will be flagged and blocked by the FINOS Clabot tool (or [EasyCLA](https://community.finos.org/docs/governance/Software-Projects/easycla)). Please note that some CCLAs require individuals/employees to be explicitly named on the CCLA.
|
|
254
|
+
|
|
255
|
+
*Need an ICLA? Unsure if you are covered under an existing CCLA? Email [help@finos.org](mailto:help@finos.org)*
|
|
256
|
+
|
|
257
|
+
## Related Projects
|
|
258
|
+
|
|
259
|
+
- [Morphir](https://github.com/finos/morphir) - The main Morphir project
|
|
260
|
+
- [Morphir Elm](https://github.com/finos/morphir-elm) - Elm implementation
|
|
261
|
+
- [Morphir Scala](https://github.com/finos/morphir-scala) - Scala implementation
|
|
262
|
+
|
|
263
|
+
## License
|
|
264
|
+
|
|
265
|
+
Copyright 2026 FINOS
|
|
266
|
+
|
|
267
|
+
Distributed under the [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0).
|
|
268
|
+
|
|
269
|
+
SPDX-License-Identifier: [Apache-2.0](https://spdx.org/licenses/Apache-2.0)
|