midas-nx 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.
- midas_nx-0.1.0/.github/workflows/publish.yml +38 -0
- midas_nx-0.1.0/.gitignore +14 -0
- midas_nx-0.1.0/LICENSE +21 -0
- midas_nx-0.1.0/PKG-INFO +129 -0
- midas_nx-0.1.0/README.md +108 -0
- midas_nx-0.1.0/ROADMAP.md +412 -0
- midas_nx-0.1.0/docs/coverage.json +3032 -0
- midas_nx-0.1.0/examples/python/kds_wind_load.py +70 -0
- midas_nx-0.1.0/examples/python/quickstart.py +72 -0
- midas_nx-0.1.0/pyproject.toml +38 -0
- midas_nx-0.1.0/scripts/gen_roadmap.py +61 -0
- midas_nx-0.1.0/scripts/vendor_coverage.py +216 -0
- midas_nx-0.1.0/src/midas_nx/__init__.py +43 -0
- midas_nx-0.1.0/src/midas_nx/client.py +192 -0
- midas_nx-0.1.0/src/midas_nx/db/__init__.py +0 -0
- midas_nx-0.1.0/src/midas_nx/db/base.py +91 -0
- midas_nx-0.1.0/src/midas_nx/db/boundary.py +509 -0
- midas_nx-0.1.0/src/midas_nx/db/node_element.py +159 -0
- midas_nx-0.1.0/src/midas_nx/db/project.py +281 -0
- midas_nx-0.1.0/src/midas_nx/db/properties/__init__.py +0 -0
- midas_nx-0.1.0/src/midas_nx/db/properties/damping.py +37 -0
- midas_nx-0.1.0/src/midas_nx/db/properties/hinge.py +57 -0
- midas_nx-0.1.0/src/midas_nx/db/properties/material.py +257 -0
- midas_nx-0.1.0/src/midas_nx/db/properties/section.py +257 -0
- midas_nx-0.1.0/src/midas_nx/db/properties/thickness.py +29 -0
- midas_nx-0.1.0/src/midas_nx/db/static_loads.py +541 -0
- midas_nx-0.1.0/src/midas_nx/doc.py +82 -0
- midas_nx-0.1.0/tests/conftest.py +13 -0
- midas_nx-0.1.0/tests/db/test_boundary.py +344 -0
- midas_nx-0.1.0/tests/db/test_node_element.py +123 -0
- midas_nx-0.1.0/tests/db/test_project.py +214 -0
- midas_nx-0.1.0/tests/db/test_properties.py +417 -0
- midas_nx-0.1.0/tests/db/test_static_loads.py +391 -0
- midas_nx-0.1.0/tests/test_client.py +121 -0
- midas_nx-0.1.0/tests/test_doc.py +47 -0
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
name: Publish to PyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [published]
|
|
6
|
+
|
|
7
|
+
permissions:
|
|
8
|
+
contents: read
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
build:
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
steps:
|
|
14
|
+
- uses: actions/checkout@v4
|
|
15
|
+
- uses: actions/setup-python@v5
|
|
16
|
+
with:
|
|
17
|
+
python-version: "3.x"
|
|
18
|
+
- run: pip install -e ".[dev]"
|
|
19
|
+
- run: pytest
|
|
20
|
+
- run: pip install build
|
|
21
|
+
- run: python -m build
|
|
22
|
+
- uses: actions/upload-artifact@v4
|
|
23
|
+
with:
|
|
24
|
+
name: dist
|
|
25
|
+
path: dist/
|
|
26
|
+
|
|
27
|
+
publish:
|
|
28
|
+
needs: build
|
|
29
|
+
runs-on: ubuntu-latest
|
|
30
|
+
environment: pypi
|
|
31
|
+
permissions:
|
|
32
|
+
id-token: write
|
|
33
|
+
steps:
|
|
34
|
+
- uses: actions/download-artifact@v4
|
|
35
|
+
with:
|
|
36
|
+
name: dist
|
|
37
|
+
path: dist/
|
|
38
|
+
- uses: pypa/gh-action-pypi-publish@release/v1
|
midas_nx-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Dennis5882
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
midas_nx-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: midas-nx
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Independent, unified Python SDK for the MIDAS NX Open API (Civil NX + Gen NX)
|
|
5
|
+
Project-URL: Homepage, https://github.com/Dennis5882/MIDAS-API-NX-SDK
|
|
6
|
+
Project-URL: Manual, https://github.com/Dennis5882/MIDAS-API
|
|
7
|
+
Author: Dennis5882
|
|
8
|
+
License-Expression: MIT
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Keywords: civil-nx,gen-nx,midas,midas-nx,structural-engineering
|
|
11
|
+
Classifier: Intended Audience :: Science/Research
|
|
12
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Topic :: Scientific/Engineering
|
|
15
|
+
Requires-Python: >=3.9
|
|
16
|
+
Requires-Dist: requests>=2.28
|
|
17
|
+
Provides-Extra: dev
|
|
18
|
+
Requires-Dist: pytest>=7.0; extra == 'dev'
|
|
19
|
+
Requires-Dist: responses>=0.23; extra == 'dev'
|
|
20
|
+
Description-Content-Type: text/markdown
|
|
21
|
+
|
|
22
|
+
# midas-nx
|
|
23
|
+
|
|
24
|
+
An independent, unified Python SDK for the **MIDAS NX Open API** (MIDAS Civil NX + MIDAS Gen NX).
|
|
25
|
+
|
|
26
|
+
Unlike MIDASIT's official [`midas-civil`](https://pypi.org/project/midas-civil/) /
|
|
27
|
+
[`midas-gen`](https://github.com/MIDASIT-Co-Ltd/midas-gen-python) packages — separate,
|
|
28
|
+
near-duplicated codebases per product, covering roughly a third of the documented API surface —
|
|
29
|
+
`midas_nx` is a single package for both products, built directly against the endpoint schema
|
|
30
|
+
documented at [Dennis5882/MIDAS-API](https://github.com/Dennis5882/MIDAS-API). See
|
|
31
|
+
[ROADMAP.md](./ROADMAP.md) for what's implemented so far vs. planned.
|
|
32
|
+
|
|
33
|
+
This is an unofficial, community project — not affiliated with or endorsed by MIDASIT.
|
|
34
|
+
|
|
35
|
+
## Install
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
pip install -e ".[dev]" # from a checkout, for development
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Quick start
|
|
42
|
+
|
|
43
|
+
```python
|
|
44
|
+
from midas_nx import MidasClient, Product
|
|
45
|
+
from midas_nx import doc
|
|
46
|
+
from midas_nx.db.project import Unit
|
|
47
|
+
from midas_nx.db.properties.material import Material
|
|
48
|
+
from midas_nx.db.properties.section import Section
|
|
49
|
+
from midas_nx.db.node_element import Node, Element
|
|
50
|
+
|
|
51
|
+
client = MidasClient(mapi_key="your-mapi-key-here", product=Product.GEN)
|
|
52
|
+
|
|
53
|
+
doc.new_project(client=client)
|
|
54
|
+
|
|
55
|
+
Unit.update({1: {"DIST": "M", "FORCE": "TONF"}}, client=client)
|
|
56
|
+
|
|
57
|
+
Material.create({1: {
|
|
58
|
+
"TYPE": "CONC", "NAME": "C32",
|
|
59
|
+
"PARAM": [{"P_TYPE": 1, "STANDARD": "AS17(RC)", "DB": "C32"}],
|
|
60
|
+
}}, client=client)
|
|
61
|
+
|
|
62
|
+
Section.create({1: {
|
|
63
|
+
"SECTTYPE": "DBUSER", "SECT_NAME": "H300x150",
|
|
64
|
+
"SECT_BEFORE": {
|
|
65
|
+
"SHAPE": "H", "OFFSET_PT": "CC", "DATATYPE": 1,
|
|
66
|
+
"SECT_I": {"DB_NAME": "KS21", "SECT_NAME": "H300x150x6.5/9"},
|
|
67
|
+
},
|
|
68
|
+
}}, client=client)
|
|
69
|
+
|
|
70
|
+
Node.create({
|
|
71
|
+
1: {"X": 0, "Y": 0, "Z": 0},
|
|
72
|
+
2: {"X": 0, "Y": 0, "Z": 3.2},
|
|
73
|
+
}, client=client)
|
|
74
|
+
|
|
75
|
+
Element.create({1: {
|
|
76
|
+
"TYPE": "BEAM", "MATL": 1, "SECT": 1, "NODE": [1, 2], "ANGLE": 0,
|
|
77
|
+
}}, client=client)
|
|
78
|
+
|
|
79
|
+
doc.save(client=client)
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Or use the low-level free function directly (same calling convention as the
|
|
83
|
+
[MIDAS-API manual repo](https://github.com/Dennis5882/MIDAS-API)'s examples):
|
|
84
|
+
|
|
85
|
+
```python
|
|
86
|
+
from midas_nx import configure, MidasAPI
|
|
87
|
+
|
|
88
|
+
configure(mapi_key="your-mapi-key-here", product="gen")
|
|
89
|
+
MidasAPI("POST", "/doc/NEW", {"Argument": {}})
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
## Design
|
|
93
|
+
|
|
94
|
+
- **Instance-based `MidasClient`** — no global mutable state; errors raise typed exceptions
|
|
95
|
+
(`MidasAuthError`, `MidasNotFoundError`, ...) instead of killing the process.
|
|
96
|
+
- **Unified Gen/Civil** — `MidasClient(product=Product.GEN | Product.CIVIL)`; each resource class
|
|
97
|
+
declares which product(s) it supports (`PRODUCTS`), and calling a Civil-only resource against a
|
|
98
|
+
Gen client raises `ProductMismatchError` by default (`strict_product=False` to only warn).
|
|
99
|
+
- **`/db/*` resources** are `DbResource` subclasses with `.create()/.get()/.update()/.delete()`
|
|
100
|
+
classmethods; `TypedDict` payload types document each endpoint's schema (from
|
|
101
|
+
`docs/manual/*.md` in the sibling repo) for editor/type-checker support, without runtime
|
|
102
|
+
payload validation — schemas are too conditional (see e.g. the Eurocode moving-load endpoint,
|
|
103
|
+
5 mutually-exclusive variants) for a one-size-fits-all validated model.
|
|
104
|
+
- **`/doc/*` lifecycle** endpoints are plain functions (`doc.new_project()`, `doc.save()`, ...) —
|
|
105
|
+
not ID-keyed, wrapped in `"Argument"` rather than `"Assign"`.
|
|
106
|
+
|
|
107
|
+
See `docs/coverage.json` / [ROADMAP.md](./ROADMAP.md) for the full endpoint list, what's
|
|
108
|
+
implemented, and where new endpoints should go.
|
|
109
|
+
|
|
110
|
+
## Testing
|
|
111
|
+
|
|
112
|
+
No live MIDAS Gen/Civil NX server is required — all tests mock HTTP via
|
|
113
|
+
[`responses`](https://github.com/getsentry/responses) and assert request shape (URL, headers,
|
|
114
|
+
JSON body) against what the manual documents.
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
pytest
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
## Contributing
|
|
121
|
+
|
|
122
|
+
Pick an unimplemented endpoint from [ROADMAP.md](./ROADMAP.md), follow the pattern in
|
|
123
|
+
`src/midas_nx/db/node_element.py` (or `doc.py` for `/doc/*`/`/ope/*`/`/view/*`-style plain-function
|
|
124
|
+
endpoints), and add a test mirroring `tests/db/test_node_element.py`. Mark it `"implemented"` in
|
|
125
|
+
`docs/coverage.json` (see `scripts/gen_roadmap.py`) and regenerate `ROADMAP.md`.
|
|
126
|
+
|
|
127
|
+
## License
|
|
128
|
+
|
|
129
|
+
MIT — see [LICENSE](./LICENSE).
|
midas_nx-0.1.0/README.md
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
# midas-nx
|
|
2
|
+
|
|
3
|
+
An independent, unified Python SDK for the **MIDAS NX Open API** (MIDAS Civil NX + MIDAS Gen NX).
|
|
4
|
+
|
|
5
|
+
Unlike MIDASIT's official [`midas-civil`](https://pypi.org/project/midas-civil/) /
|
|
6
|
+
[`midas-gen`](https://github.com/MIDASIT-Co-Ltd/midas-gen-python) packages — separate,
|
|
7
|
+
near-duplicated codebases per product, covering roughly a third of the documented API surface —
|
|
8
|
+
`midas_nx` is a single package for both products, built directly against the endpoint schema
|
|
9
|
+
documented at [Dennis5882/MIDAS-API](https://github.com/Dennis5882/MIDAS-API). See
|
|
10
|
+
[ROADMAP.md](./ROADMAP.md) for what's implemented so far vs. planned.
|
|
11
|
+
|
|
12
|
+
This is an unofficial, community project — not affiliated with or endorsed by MIDASIT.
|
|
13
|
+
|
|
14
|
+
## Install
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
pip install -e ".[dev]" # from a checkout, for development
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Quick start
|
|
21
|
+
|
|
22
|
+
```python
|
|
23
|
+
from midas_nx import MidasClient, Product
|
|
24
|
+
from midas_nx import doc
|
|
25
|
+
from midas_nx.db.project import Unit
|
|
26
|
+
from midas_nx.db.properties.material import Material
|
|
27
|
+
from midas_nx.db.properties.section import Section
|
|
28
|
+
from midas_nx.db.node_element import Node, Element
|
|
29
|
+
|
|
30
|
+
client = MidasClient(mapi_key="your-mapi-key-here", product=Product.GEN)
|
|
31
|
+
|
|
32
|
+
doc.new_project(client=client)
|
|
33
|
+
|
|
34
|
+
Unit.update({1: {"DIST": "M", "FORCE": "TONF"}}, client=client)
|
|
35
|
+
|
|
36
|
+
Material.create({1: {
|
|
37
|
+
"TYPE": "CONC", "NAME": "C32",
|
|
38
|
+
"PARAM": [{"P_TYPE": 1, "STANDARD": "AS17(RC)", "DB": "C32"}],
|
|
39
|
+
}}, client=client)
|
|
40
|
+
|
|
41
|
+
Section.create({1: {
|
|
42
|
+
"SECTTYPE": "DBUSER", "SECT_NAME": "H300x150",
|
|
43
|
+
"SECT_BEFORE": {
|
|
44
|
+
"SHAPE": "H", "OFFSET_PT": "CC", "DATATYPE": 1,
|
|
45
|
+
"SECT_I": {"DB_NAME": "KS21", "SECT_NAME": "H300x150x6.5/9"},
|
|
46
|
+
},
|
|
47
|
+
}}, client=client)
|
|
48
|
+
|
|
49
|
+
Node.create({
|
|
50
|
+
1: {"X": 0, "Y": 0, "Z": 0},
|
|
51
|
+
2: {"X": 0, "Y": 0, "Z": 3.2},
|
|
52
|
+
}, client=client)
|
|
53
|
+
|
|
54
|
+
Element.create({1: {
|
|
55
|
+
"TYPE": "BEAM", "MATL": 1, "SECT": 1, "NODE": [1, 2], "ANGLE": 0,
|
|
56
|
+
}}, client=client)
|
|
57
|
+
|
|
58
|
+
doc.save(client=client)
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Or use the low-level free function directly (same calling convention as the
|
|
62
|
+
[MIDAS-API manual repo](https://github.com/Dennis5882/MIDAS-API)'s examples):
|
|
63
|
+
|
|
64
|
+
```python
|
|
65
|
+
from midas_nx import configure, MidasAPI
|
|
66
|
+
|
|
67
|
+
configure(mapi_key="your-mapi-key-here", product="gen")
|
|
68
|
+
MidasAPI("POST", "/doc/NEW", {"Argument": {}})
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Design
|
|
72
|
+
|
|
73
|
+
- **Instance-based `MidasClient`** — no global mutable state; errors raise typed exceptions
|
|
74
|
+
(`MidasAuthError`, `MidasNotFoundError`, ...) instead of killing the process.
|
|
75
|
+
- **Unified Gen/Civil** — `MidasClient(product=Product.GEN | Product.CIVIL)`; each resource class
|
|
76
|
+
declares which product(s) it supports (`PRODUCTS`), and calling a Civil-only resource against a
|
|
77
|
+
Gen client raises `ProductMismatchError` by default (`strict_product=False` to only warn).
|
|
78
|
+
- **`/db/*` resources** are `DbResource` subclasses with `.create()/.get()/.update()/.delete()`
|
|
79
|
+
classmethods; `TypedDict` payload types document each endpoint's schema (from
|
|
80
|
+
`docs/manual/*.md` in the sibling repo) for editor/type-checker support, without runtime
|
|
81
|
+
payload validation — schemas are too conditional (see e.g. the Eurocode moving-load endpoint,
|
|
82
|
+
5 mutually-exclusive variants) for a one-size-fits-all validated model.
|
|
83
|
+
- **`/doc/*` lifecycle** endpoints are plain functions (`doc.new_project()`, `doc.save()`, ...) —
|
|
84
|
+
not ID-keyed, wrapped in `"Argument"` rather than `"Assign"`.
|
|
85
|
+
|
|
86
|
+
See `docs/coverage.json` / [ROADMAP.md](./ROADMAP.md) for the full endpoint list, what's
|
|
87
|
+
implemented, and where new endpoints should go.
|
|
88
|
+
|
|
89
|
+
## Testing
|
|
90
|
+
|
|
91
|
+
No live MIDAS Gen/Civil NX server is required — all tests mock HTTP via
|
|
92
|
+
[`responses`](https://github.com/getsentry/responses) and assert request shape (URL, headers,
|
|
93
|
+
JSON body) against what the manual documents.
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
pytest
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## Contributing
|
|
100
|
+
|
|
101
|
+
Pick an unimplemented endpoint from [ROADMAP.md](./ROADMAP.md), follow the pattern in
|
|
102
|
+
`src/midas_nx/db/node_element.py` (or `doc.py` for `/doc/*`/`/ope/*`/`/view/*`-style plain-function
|
|
103
|
+
endpoints), and add a test mirroring `tests/db/test_node_element.py`. Mark it `"implemented"` in
|
|
104
|
+
`docs/coverage.json` (see `scripts/gen_roadmap.py`) and regenerate `ROADMAP.md`.
|
|
105
|
+
|
|
106
|
+
## License
|
|
107
|
+
|
|
108
|
+
MIT — see [LICENSE](./LICENSE).
|