morphir-python 0.0.1__tar.gz → 0.0.2__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 (106) hide show
  1. morphir_python-0.0.2/PKG-INFO +97 -0
  2. {morphir_python-0.0.1/packages/morphir-tools → morphir_python-0.0.2}/README.md +5 -4
  3. {morphir_python-0.0.1/packages/morphir → morphir_python-0.0.2}/pyproject.toml +16 -7
  4. {morphir_python-0.0.1/packages/morphir-tools → morphir_python-0.0.2}/src/morphir_tools/__init__.py +2 -2
  5. morphir_python-0.0.1/PKG-INFO +0 -269
  6. morphir_python-0.0.1/README.md +0 -246
  7. morphir_python-0.0.1/packages/morphir/LICENSE +0 -201
  8. morphir_python-0.0.1/packages/morphir/README.md +0 -387
  9. morphir_python-0.0.1/packages/morphir/src/morphir/__init__.py +0 -14
  10. morphir_python-0.0.1/packages/morphir/src/morphir/ir/__init__.py +0 -110
  11. morphir_python-0.0.1/packages/morphir/src/morphir/ir/access_controlled.py +0 -15
  12. morphir_python-0.0.1/packages/morphir/src/morphir/ir/decorations.py +0 -19
  13. morphir_python-0.0.1/packages/morphir/src/morphir/ir/diagnostics.py +0 -105
  14. morphir_python-0.0.1/packages/morphir/src/morphir/ir/distribution.py +0 -21
  15. morphir_python-0.0.1/packages/morphir/src/morphir/ir/document.py +0 -37
  16. morphir_python-0.0.1/packages/morphir/src/morphir/ir/documented.py +0 -11
  17. morphir_python-0.0.1/packages/morphir/src/morphir/ir/format_version.py +0 -483
  18. morphir_python-0.0.1/packages/morphir/src/morphir/ir/fqname.py +0 -9
  19. morphir_python-0.0.1/packages/morphir/src/morphir/ir/json.py +0 -11
  20. morphir_python-0.0.1/packages/morphir/src/morphir/ir/literal.py +0 -25
  21. morphir_python-0.0.1/packages/morphir/src/morphir/ir/meta.py +0 -11
  22. morphir_python-0.0.1/packages/morphir/src/morphir/ir/migrate.py +0 -1267
  23. morphir_python-0.0.1/packages/morphir/src/morphir/ir/module.py +0 -17
  24. morphir_python-0.0.1/packages/morphir/src/morphir/ir/name.py +0 -27
  25. morphir_python-0.0.1/packages/morphir/src/morphir/ir/package.py +0 -15
  26. morphir_python-0.0.1/packages/morphir/src/morphir/ir/path.py +0 -25
  27. morphir_python-0.0.1/packages/morphir/src/morphir/ir/qname.py +0 -9
  28. morphir_python-0.0.1/packages/morphir/src/morphir/ir/ref.py +0 -17
  29. morphir_python-0.0.1/packages/morphir/src/morphir/ir/type.py +0 -37
  30. morphir_python-0.0.1/packages/morphir/src/morphir/ir/type_constraints.py +0 -33
  31. morphir_python-0.0.1/packages/morphir/src/morphir/ir/type_def.py +0 -19
  32. morphir_python-0.0.1/packages/morphir/src/morphir/ir/type_spec.py +0 -25
  33. morphir_python-0.0.1/packages/morphir/src/morphir/ir/v3/__init__.py +0 -64
  34. morphir_python-0.0.1/packages/morphir/src/morphir/ir/v3/_legacy_value.py +0 -201
  35. morphir_python-0.0.1/packages/morphir/src/morphir/ir/v3/access_controlled.py +0 -31
  36. morphir_python-0.0.1/packages/morphir/src/morphir/ir/v3/codec.py +0 -1275
  37. morphir_python-0.0.1/packages/morphir/src/morphir/ir/v3/codec_v1.py +0 -491
  38. morphir_python-0.0.1/packages/morphir/src/morphir/ir/v3/codec_v2.py +0 -187
  39. morphir_python-0.0.1/packages/morphir/src/morphir/ir/v3/distribution.py +0 -42
  40. morphir_python-0.0.1/packages/morphir/src/morphir/ir/v3/documented.py +0 -13
  41. morphir_python-0.0.1/packages/morphir/src/morphir/ir/v3/fqname.py +0 -30
  42. morphir_python-0.0.1/packages/morphir/src/morphir/ir/v3/literal.py +0 -46
  43. morphir_python-0.0.1/packages/morphir/src/morphir/ir/v3/module.py +0 -32
  44. morphir_python-0.0.1/packages/morphir/src/morphir/ir/v3/name.py +0 -42
  45. morphir_python-0.0.1/packages/morphir/src/morphir/ir/v3/package.py +0 -23
  46. morphir_python-0.0.1/packages/morphir/src/morphir/ir/v3/path.py +0 -29
  47. morphir_python-0.0.1/packages/morphir/src/morphir/ir/v3/qname.py +0 -16
  48. morphir_python-0.0.1/packages/morphir/src/morphir/ir/v3/type.py +0 -126
  49. morphir_python-0.0.1/packages/morphir/src/morphir/ir/v3/value.py +0 -235
  50. morphir_python-0.0.1/packages/morphir/src/morphir/ir/v4/__init__.py +0 -160
  51. morphir_python-0.0.1/packages/morphir/src/morphir/ir/v4/access_controlled.py +0 -17
  52. morphir_python-0.0.1/packages/morphir/src/morphir/ir/v4/annotation.py +0 -75
  53. morphir_python-0.0.1/packages/morphir/src/morphir/ir/v4/codec.py +0 -2161
  54. morphir_python-0.0.1/packages/morphir/src/morphir/ir/v4/decorations.py +0 -88
  55. morphir_python-0.0.1/packages/morphir/src/morphir/ir/v4/distribution.py +0 -56
  56. morphir_python-0.0.1/packages/morphir/src/morphir/ir/v4/document.py +0 -69
  57. morphir_python-0.0.1/packages/morphir/src/morphir/ir/v4/documented.py +0 -10
  58. morphir_python-0.0.1/packages/morphir/src/morphir/ir/v4/fqname.py +0 -69
  59. morphir_python-0.0.1/packages/morphir/src/morphir/ir/v4/incompleteness.py +0 -78
  60. morphir_python-0.0.1/packages/morphir/src/morphir/ir/v4/json.py +0 -103
  61. morphir_python-0.0.1/packages/morphir/src/morphir/ir/v4/literal.py +0 -51
  62. morphir_python-0.0.1/packages/morphir/src/morphir/ir/v4/meta.py +0 -27
  63. morphir_python-0.0.1/packages/morphir/src/morphir/ir/v4/module.py +0 -30
  64. morphir_python-0.0.1/packages/morphir/src/morphir/ir/v4/name.py +0 -69
  65. morphir_python-0.0.1/packages/morphir/src/morphir/ir/v4/package.py +0 -19
  66. morphir_python-0.0.1/packages/morphir/src/morphir/ir/v4/path.py +0 -50
  67. morphir_python-0.0.1/packages/morphir/src/morphir/ir/v4/qname.py +0 -34
  68. morphir_python-0.0.1/packages/morphir/src/morphir/ir/v4/ref.py +0 -35
  69. morphir_python-0.0.1/packages/morphir/src/morphir/ir/v4/type.py +0 -140
  70. morphir_python-0.0.1/packages/morphir/src/morphir/ir/v4/type_constraints.py +0 -91
  71. morphir_python-0.0.1/packages/morphir/src/morphir/ir/v4/type_def.py +0 -38
  72. morphir_python-0.0.1/packages/morphir/src/morphir/ir/v4/type_spec.py +0 -64
  73. morphir_python-0.0.1/packages/morphir/src/morphir/ir/v4/value.py +0 -480
  74. morphir_python-0.0.1/packages/morphir/src/morphir/ir/value.py +0 -81
  75. morphir_python-0.0.1/packages/morphir/src/morphir/py.typed +0 -0
  76. morphir_python-0.0.1/packages/morphir/src/morphir/sdk/__init__.py +0 -110
  77. morphir_python-0.0.1/packages/morphir/src/morphir/sdk/_compare.py +0 -187
  78. morphir_python-0.0.1/packages/morphir/src/morphir/sdk/aggregate.py +0 -421
  79. morphir_python-0.0.1/packages/morphir/src/morphir/sdk/basics.py +0 -504
  80. morphir_python-0.0.1/packages/morphir/src/morphir/sdk/char.py +0 -110
  81. morphir_python-0.0.1/packages/morphir/src/morphir/sdk/decimal.py +0 -311
  82. morphir_python-0.0.1/packages/morphir/src/morphir/sdk/dict.py +0 -336
  83. morphir_python-0.0.1/packages/morphir/src/morphir/sdk/instant.py +0 -118
  84. morphir_python-0.0.1/packages/morphir/src/morphir/sdk/int.py +0 -86
  85. morphir_python-0.0.1/packages/morphir/src/morphir/sdk/key.py +0 -522
  86. morphir_python-0.0.1/packages/morphir/src/morphir/sdk/list.py +0 -356
  87. morphir_python-0.0.1/packages/morphir/src/morphir/sdk/local_date.py +0 -436
  88. morphir_python-0.0.1/packages/morphir/src/morphir/sdk/local_time.py +0 -267
  89. morphir_python-0.0.1/packages/morphir/src/morphir/sdk/maybe.py +0 -135
  90. morphir_python-0.0.1/packages/morphir/src/morphir/sdk/number.py +0 -237
  91. morphir_python-0.0.1/packages/morphir/src/morphir/sdk/regex.py +0 -287
  92. morphir_python-0.0.1/packages/morphir/src/morphir/sdk/result.py +0 -162
  93. morphir_python-0.0.1/packages/morphir/src/morphir/sdk/result_list.py +0 -169
  94. morphir_python-0.0.1/packages/morphir/src/morphir/sdk/rule.py +0 -103
  95. morphir_python-0.0.1/packages/morphir/src/morphir/sdk/set.py +0 -214
  96. morphir_python-0.0.1/packages/morphir/src/morphir/sdk/stateful_app.py +0 -49
  97. morphir_python-0.0.1/packages/morphir/src/morphir/sdk/string.py +0 -427
  98. morphir_python-0.0.1/packages/morphir/src/morphir/sdk/tuple.py +0 -43
  99. morphir_python-0.0.1/packages/morphir/src/morphir/sdk/uuid.py +0 -209
  100. morphir_python-0.0.1/packages/morphir-tools/LICENSE +0 -201
  101. morphir_python-0.0.1/pyproject.toml +0 -177
  102. morphir_python-0.0.1/uv.lock +0 -527
  103. {morphir_python-0.0.1 → morphir_python-0.0.2}/.gitignore +0 -0
  104. {morphir_python-0.0.1 → morphir_python-0.0.2}/LICENSE +0 -0
  105. {morphir_python-0.0.1/packages/morphir-tools → morphir_python-0.0.2}/src/morphir_tools/cli.py +0 -0
  106. {morphir_python-0.0.1/packages/morphir-tools → morphir_python-0.0.2}/src/morphir_tools/py.typed +0 -0
@@ -0,0 +1,97 @@
1
+ Metadata-Version: 2.5
2
+ Name: morphir-python
3
+ Version: 0.0.2
4
+ Summary: CLI tools and extensions for Morphir 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,code-generation,domain-modeling,morphir,tools
13
+ Classifier: Development Status :: 3 - Alpha
14
+ Classifier: Environment :: Console
15
+ Classifier: Intended Audience :: Developers
16
+ Classifier: Operating System :: OS Independent
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Programming Language :: Python :: 3.14
19
+ Classifier: Topic :: Software Development :: Code Generators
20
+ Classifier: Topic :: Software Development :: Libraries
21
+ Classifier: Typing :: Typed
22
+ Requires-Python: >=3.14
23
+ Requires-Dist: morphir>=0.0.1
24
+ Requires-Dist: pygments>=2.20.0
25
+ Requires-Dist: typer>=0.15
26
+ Description-Content-Type: text/markdown
27
+
28
+ # Morphir Python
29
+
30
+ CLI tools and extensions for [Morphir Python](https://github.com/finos/morphir-python).
31
+
32
+ This package provides:
33
+
34
+ - Command-line interface for Morphir operations
35
+ - Code generation backends
36
+ - File I/O utilities
37
+ - Development tools
38
+
39
+ ## Installation
40
+
41
+ ```bash
42
+ pip install morphir-python
43
+ ```
44
+
45
+ Or with uv:
46
+
47
+ ```bash
48
+ uv add morphir-python
49
+ ```
50
+
51
+ The `morphir-python` distribution contains the CLI and depends on the separate
52
+ `morphir` library/SDK distribution. Python imports remain `morphir` and
53
+ `morphir_tools`. Version 0.0.1 was a bundle; for migration to CLI-only 0.0.2, see
54
+ the [repository installation guide](../../README.md#migrating-from-the-bundled-001-release).
55
+
56
+ ## Usage
57
+
58
+ The `morphir-python` command inspects and converts versioned `morphir-ir.json`
59
+ files. It reads format 3.0.x (what morphir-elm writes), format 3.1.x (which adds
60
+ the v3 `Specs` distribution) and draft IR 4.0.x, reads the legacy formats 1 and 2
61
+ to upgrade them, and uses the `morphir` library for every read, write, and
62
+ migration.
63
+
64
+ ```bash
65
+ morphir-python ir inspect morphir-ir.json
66
+ morphir-python ir convert morphir-ir.json --to v4 -o out.json --package-version 1.2.0
67
+ morphir-python ir convert v4.json --to v3 -o out.json --drop-source-locations
68
+ morphir-python ir convert old-format-1.json --to v3 -o out.json
69
+ ```
70
+
71
+ `inspect` prints the normalized format version, the distribution kind
72
+ (`Library`, `Specs` or `Application`), and the package name, and labels v4 as
73
+ draft and formats 1 and 2 as legacy. `convert` handles `Library` and `Specs` in
74
+ both directions. It writes a v3 `Library` as format `3` and a v3 `Specs` as
75
+ `"3.1.0"`, the lowest version that holds each. A legacy format 1 or 2 file
76
+ converts to a format 3.0.0 `Library` or draft v4; nothing writes format 1 or 2.
77
+ `convert` writes through a temporary file and renames it only on success, so a
78
+ failed conversion leaves no output file.
79
+ Diagnostics go to standard error as `code at location: message`.
80
+
81
+ Exit codes are 0 for success (also with warnings), 1 for a diagnostic, and 2 for
82
+ a usage error. 3.x releases from 3.2.0 on are rejected; see the
83
+ [morphir package README](../morphir/README.md#morphir-ir-versions) for the
84
+ format-version rules and the draft v4 status.
85
+
86
+ ## Requirements
87
+
88
+ - Python 3.14+
89
+ - `morphir>=0.0.1` (installed as a dependency)
90
+
91
+ ## License
92
+
93
+ Apache-2.0 - see the [LICENSE](../../LICENSE) file for details.
94
+
95
+ ## Related Packages
96
+
97
+ - [morphir](https://pypi.org/project/morphir/) - Core library
@@ -21,9 +21,10 @@ Or with uv:
21
21
  uv add morphir-python
22
22
  ```
23
23
 
24
- The `morphir-python` distribution includes the `morphir` core library and SDK
25
- runtime alongside the CLI. It does not depend on a separate `morphir` PyPI
26
- package. Python imports remain `morphir` and `morphir_tools`.
24
+ The `morphir-python` distribution contains the CLI and depends on the separate
25
+ `morphir` library/SDK distribution. Python imports remain `morphir` and
26
+ `morphir_tools`. Version 0.0.1 was a bundle; for migration to CLI-only 0.0.2, see
27
+ the [repository installation guide](../../README.md#migrating-from-the-bundled-001-release).
27
28
 
28
29
  ## Usage
29
30
 
@@ -58,7 +59,7 @@ format-version rules and the draft v4 status.
58
59
  ## Requirements
59
60
 
60
61
  - Python 3.14+
61
- - Core library and SDK included
62
+ - `morphir>=0.0.1` (installed as a dependency)
62
63
 
63
64
  ## License
64
65
 
@@ -1,26 +1,32 @@
1
1
  [project]
2
- name = "morphir"
3
- version = "0.0.1"
4
- description = "Python port of Morphir - functional domain modeling for the enterprise"
2
+ name = "morphir-python"
3
+ version = "0.0.2"
4
+ description = "CLI tools and extensions for Morphir Python"
5
5
  readme = "README.md"
6
6
  license = "Apache-2.0"
7
7
  license-files = ["LICENSE"]
8
8
  requires-python = ">=3.14"
9
- keywords = ["morphir", "domain-modeling", "functional", "dsl", "type-safe", "ir"]
9
+ keywords = ["morphir", "cli", "tools", "code-generation", "domain-modeling"]
10
10
  classifiers = [
11
11
  "Development Status :: 3 - Alpha",
12
+ "Environment :: Console",
12
13
  "Intended Audience :: Developers",
13
14
  "Operating System :: OS Independent",
14
15
  "Programming Language :: Python :: 3",
15
16
  "Programming Language :: Python :: 3.14",
17
+ "Topic :: Software Development :: Code Generators",
16
18
  "Topic :: Software Development :: Libraries",
17
- "Topic :: Software Development :: Libraries :: Python Modules",
18
19
  "Typing :: Typed",
19
20
  ]
20
21
  authors = [
21
22
  { name = "FINOS", email = "morphir@finos.org" }
22
23
  ]
23
- dependencies = []
24
+ dependencies = [
25
+ "morphir>=0.0.1",
26
+ "typer>=0.15",
27
+ # Rich uses Pygments; older versions are affected by CVE-2026-4539.
28
+ "pygments>=2.20.0",
29
+ ]
24
30
 
25
31
  [project.urls]
26
32
  Homepage = "https://github.com/finos/morphir-python"
@@ -28,9 +34,12 @@ Documentation = "https://morphir.finos.org"
28
34
  Repository = "https://github.com/finos/morphir-python"
29
35
  Issues = "https://github.com/finos/morphir-python/issues"
30
36
 
37
+ [project.scripts]
38
+ morphir-python = "morphir_tools.cli:main"
39
+
31
40
  [build-system]
32
41
  requires = ["hatchling>=1.27"]
33
42
  build-backend = "hatchling.build"
34
43
 
35
44
  [tool.hatch.build.targets.wheel]
36
- packages = ["src/morphir"]
45
+ packages = ["src/morphir_tools"]
@@ -6,8 +6,8 @@ Morphir domain models, including code generation and development tools.
6
6
  Example:
7
7
  >>> import morphir_tools
8
8
  >>> morphir_tools.__version__
9
- '0.0.1'
9
+ '0.0.2'
10
10
  """
11
11
 
12
- __version__ = "0.0.1"
12
+ __version__ = "0.0.2"
13
13
  __all__ = ["__version__"]
@@ -1,269 +0,0 @@
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
- [![FINOS - Incubating](https://cdn.jsdelivr.net/gh/finos/contrib-toolbox@master/images/badge-incubating.svg)](https://community.finos.org/docs/governance/Software-Projects/stages/incubating)
25
- [![CI](https://github.com/finos/morphir-python/actions/workflows/ci.yml/badge.svg)](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)