mdmodels-core 0.1.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 (98) hide show
  1. mdmodels_core-0.1.2/.github/scripts/generate_types.sh +11 -0
  2. mdmodels_core-0.1.2/.github/workflows/docs.yml +61 -0
  3. mdmodels_core-0.1.2/.github/workflows/format.yml +37 -0
  4. mdmodels_core-0.1.2/.github/workflows/lint.yml +30 -0
  5. mdmodels_core-0.1.2/.github/workflows/publish.yml +21 -0
  6. mdmodels_core-0.1.2/.github/workflows/test.yml +31 -0
  7. mdmodels_core-0.1.2/.gitignore +9 -0
  8. mdmodels_core-0.1.2/.idea/workspace.xml +141 -0
  9. mdmodels_core-0.1.2/Cargo.lock +2067 -0
  10. mdmodels_core-0.1.2/Cargo.toml +41 -0
  11. mdmodels_core-0.1.2/LICENSE.md +7 -0
  12. mdmodels_core-0.1.2/PKG-INFO +65 -0
  13. mdmodels_core-0.1.2/README.md +50 -0
  14. mdmodels_core-0.1.2/assets/schema.png +0 -0
  15. mdmodels_core-0.1.2/build.rs +3 -0
  16. mdmodels_core-0.1.2/docs/index.md +119 -0
  17. mdmodels_core-0.1.2/docs/library/code-generation.md +3 -0
  18. mdmodels_core-0.1.2/docs/library/conversion.md +3 -0
  19. mdmodels_core-0.1.2/docs/library/index.md +3 -0
  20. mdmodels_core-0.1.2/docs/library/pipelines.md +3 -0
  21. mdmodels_core-0.1.2/docs/library/validation.md +3 -0
  22. mdmodels_core-0.1.2/docs/syntax/configuration.md +3 -0
  23. mdmodels_core-0.1.2/docs/syntax/enumerations.md +3 -0
  24. mdmodels_core-0.1.2/docs/syntax/index.md +3 -0
  25. mdmodels_core-0.1.2/docs/syntax/ontologies.md +3 -0
  26. mdmodels_core-0.1.2/docs/syntax/types.md +3 -0
  27. mdmodels_core-0.1.2/docs/types/equation.md +83 -0
  28. mdmodels_core-0.1.2/docs/types/index.md +27 -0
  29. mdmodels_core-0.1.2/docs/types/unit-definition.md +105 -0
  30. mdmodels_core-0.1.2/mkdocs.yml +73 -0
  31. mdmodels_core-0.1.2/pyproject.toml +16 -0
  32. mdmodels_core-0.1.2/src/attribute.rs +448 -0
  33. mdmodels_core-0.1.2/src/bin/cli.rs +348 -0
  34. mdmodels_core-0.1.2/src/datamodel.rs +470 -0
  35. mdmodels_core-0.1.2/src/exporters.rs +422 -0
  36. mdmodels_core-0.1.2/src/json/datatype.rs +203 -0
  37. mdmodels_core-0.1.2/src/json/parser.rs +233 -0
  38. mdmodels_core-0.1.2/src/lib.rs +36 -0
  39. mdmodels_core-0.1.2/src/markdown/frontmatter.rs +157 -0
  40. mdmodels_core-0.1.2/src/markdown/parser.rs +525 -0
  41. mdmodels_core-0.1.2/src/object.rs +209 -0
  42. mdmodels_core-0.1.2/src/pipeline.rs +563 -0
  43. mdmodels_core-0.1.2/src/primitives.rs +121 -0
  44. mdmodels_core-0.1.2/src/python/bindings.rs +32 -0
  45. mdmodels_core-0.1.2/src/schema.rs +330 -0
  46. mdmodels_core-0.1.2/src/validation.rs +268 -0
  47. mdmodels_core-0.1.2/src/xmltype.rs +135 -0
  48. mdmodels_core-0.1.2/templates/markdown-compact.jinja +39 -0
  49. mdmodels_core-0.1.2/templates/markdown.jinja +35 -0
  50. mdmodels_core-0.1.2/templates/mkdocs.jinja +123 -0
  51. mdmodels_core-0.1.2/templates/python-dataclass.jinja +106 -0
  52. mdmodels_core-0.1.2/templates/python-macros.jinja +127 -0
  53. mdmodels_core-0.1.2/templates/python-pydantic-xml.jinja +65 -0
  54. mdmodels_core-0.1.2/templates/python-pydantic.jinja +246 -0
  55. mdmodels_core-0.1.2/templates/shacl.jinja +32 -0
  56. mdmodels_core-0.1.2/templates/shex.jinja +46 -0
  57. mdmodels_core-0.1.2/templates/typescript.jinja +121 -0
  58. mdmodels_core-0.1.2/templates/xml-schema.jinja +154 -0
  59. mdmodels_core-0.1.2/test.py +15 -0
  60. mdmodels_core-0.1.2/tests/data/expected_json_schema.json +60 -0
  61. mdmodels_core-0.1.2/tests/data/expected_mkdocs.md +71 -0
  62. mdmodels_core-0.1.2/tests/data/expected_pydantic.py +308 -0
  63. mdmodels_core-0.1.2/tests/data/expected_python_dc.py +98 -0
  64. mdmodels_core-0.1.2/tests/data/expected_python_pydantic_xml.py +111 -0
  65. mdmodels_core-0.1.2/tests/data/expected_sdrdm_full_schema.json +128 -0
  66. mdmodels_core-0.1.2/tests/data/expected_sdrdm_schema.json +128 -0
  67. mdmodels_core-0.1.2/tests/data/expected_sdrdm_schema_inheritance.json +77 -0
  68. mdmodels_core-0.1.2/tests/data/expected_shacl.ttl +43 -0
  69. mdmodels_core-0.1.2/tests/data/expected_shex.shex +33 -0
  70. mdmodels_core-0.1.2/tests/data/expected_typescript.ts +72 -0
  71. mdmodels_core-0.1.2/tests/data/expected_xml_schema.xsd +45 -0
  72. mdmodels_core-0.1.2/tests/data/model.md +53 -0
  73. mdmodels_core-0.1.2/tests/data/model_duplicates.md +35 -0
  74. mdmodels_core-0.1.2/tests/data/model_full_documentation.md +75 -0
  75. mdmodels_core-0.1.2/tests/data/model_inheritance.md +19 -0
  76. mdmodels_core-0.1.2/tests/data/model_inheritance_invalid.md +14 -0
  77. mdmodels_core-0.1.2/tests/data/model_merge.md +20 -0
  78. mdmodels_core-0.1.2/tests/data/model_merge_invalid.md +20 -0
  79. mdmodels_core-0.1.2/tests/data/model_missing_types.md +25 -0
  80. mdmodels_core-0.1.2/tests/data/model_multiple_keyword.md +15 -0
  81. mdmodels_core-0.1.2/tests/data/model_no_frontmatter.md +18 -0
  82. mdmodels_core-0.1.2/tests/data/model_no_objects.md +9 -0
  83. mdmodels_core-0.1.2/tests/data/model_w_html.md +67 -0
  84. mdmodels_core-0.1.2/tests/integration_tests.rs +318 -0
  85. mdmodels_core-0.1.2/tests/test_pipeline.toml +15 -0
  86. mdmodels_core-0.1.2/tests/test_pipeline_per_spec.toml +13 -0
  87. mdmodels_core-0.1.2/tests/test_pipeline_per_spec_invalid.toml +7 -0
  88. mdmodels_core-0.1.2/types/README.md +27 -0
  89. mdmodels_core-0.1.2/types/equation/equation-internal.json +191 -0
  90. mdmodels_core-0.1.2/types/equation/equation.json +76 -0
  91. mdmodels_core-0.1.2/types/equation/equation.md +62 -0
  92. mdmodels_core-0.1.2/types/equation/equation.xsd +104 -0
  93. mdmodels_core-0.1.2/types/equation/gen.toml +10 -0
  94. mdmodels_core-0.1.2/types/unit-definition/gen.toml +10 -0
  95. mdmodels_core-0.1.2/types/unit-definition/unit-definition-internal.json +178 -0
  96. mdmodels_core-0.1.2/types/unit-definition/unit-definition.json +52 -0
  97. mdmodels_core-0.1.2/types/unit-definition/unit-definition.md +87 -0
  98. mdmodels_core-0.1.2/types/unit-definition/unit-definition.xsd +112 -0
@@ -0,0 +1,11 @@
1
+ #!/bin/bash
2
+
3
+ # Grep all *.toml files in the types directory recursively
4
+ GEN_FILES=$(find types -name '*.toml')
5
+
6
+ # Iterate over each file
7
+ for file in $GEN_FILES; do
8
+ # Generate the go file
9
+ echo "Generating $file"
10
+ md-models pipeline -i $file
11
+ done
@@ -0,0 +1,61 @@
1
+ name: Documentation
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - "main"
7
+ paths:
8
+ - "docs/**"
9
+ - "types/**"
10
+ - "mkdocs.yml"
11
+
12
+ permissions:
13
+ id-token: write
14
+ pages: write
15
+ contents: write
16
+
17
+ jobs:
18
+ deploy:
19
+ runs-on: ubuntu-latest
20
+ steps:
21
+ - uses: actions/checkout@v4
22
+
23
+ - name: Set up Rust
24
+ uses: actions-rs/toolchain@v1
25
+ with:
26
+ toolchain: stable
27
+ override: true
28
+
29
+ - name: Install MD-Models
30
+ run: cargo install --path .
31
+
32
+ - name: Run the generation pipeline
33
+ run: sh .github/scripts/generate_types.sh
34
+
35
+ - name: "Update docs"
36
+ shell: "bash"
37
+ run: |
38
+ if [[ `git status --porcelain` ]]; then
39
+ git add --all
40
+ git config --global user.name 'MD-Models Bot'
41
+ git config --global user.email 'mdmodels@bot.com'
42
+ git commit -am "Doc update"
43
+ git push
44
+ else
45
+ echo "Nothing changed!"
46
+ fi
47
+
48
+ - uses: actions/setup-python@v4
49
+ with:
50
+ python-version: 3.x
51
+
52
+ - uses: actions/cache@v2
53
+ with:
54
+ path: .cache
55
+ key: ${{ github.ref }}
56
+
57
+ - name: Install dependencies
58
+ run: pip install mkdocs-material jupyter nbconvert mkdocs-jupyter
59
+
60
+ - name: Deploy Documentation
61
+ run: mkdocs gh-deploy --force
@@ -0,0 +1,37 @@
1
+ name: Rust Format Check
2
+
3
+ on:
4
+ push:
5
+ paths:
6
+ - "src/**"
7
+ - "tests/**"
8
+ - "Cargo.toml"
9
+ - "Cargo.lock"
10
+ - "templates/**"
11
+ - "types/**"
12
+ pull_request:
13
+ paths:
14
+ - "src/**"
15
+ - "tests/**"
16
+ - "Cargo.toml"
17
+ - "Cargo.lock"
18
+ - "templates/**"
19
+ - "types/**"
20
+
21
+ jobs:
22
+ rustfmt:
23
+ runs-on: ubuntu-latest
24
+
25
+ steps:
26
+ - name: Checkout code
27
+ uses: actions/checkout@v2
28
+
29
+ - name: Install Rust
30
+ uses: actions-rs/toolchain@v1
31
+ with:
32
+ profile: minimal
33
+ toolchain: stable
34
+ components: rustfmt
35
+
36
+ - name: Run rustfmt
37
+ run: cargo fmt -- --check
@@ -0,0 +1,30 @@
1
+ name: Clippy check
2
+ on:
3
+ push:
4
+ paths:
5
+ - "src/**"
6
+ - "tests/**"
7
+ - "Cargo.toml"
8
+ - "Cargo.lock"
9
+ - "templates/**"
10
+ - "types/**"
11
+ pull_request:
12
+ paths:
13
+ - "src/**"
14
+ - "tests/**"
15
+ - "Cargo.toml"
16
+ - "Cargo.lock"
17
+ - "templates/**"
18
+ - "types/**"
19
+
20
+ # Make sure CI fails on all warnings, including Clippy lints
21
+ env:
22
+ RUSTFLAGS: "-Dwarnings"
23
+
24
+ jobs:
25
+ clippy_check:
26
+ runs-on: ubuntu-latest
27
+ steps:
28
+ - uses: actions/checkout@v4
29
+ - name: Run Clippy
30
+ run: cargo clippy --all-targets --all-features
@@ -0,0 +1,21 @@
1
+ name: Publish
2
+
3
+ on:
4
+ release:
5
+ types: [published]
6
+
7
+ env:
8
+ CARGO_TERM_COLOR: always
9
+
10
+ jobs:
11
+ build:
12
+ runs-on: ubuntu-latest
13
+ steps:
14
+ - uses: actions/checkout@v3
15
+ - uses: actions-rs/toolchain@v1
16
+ with:
17
+ toolchain: stable
18
+ override: true
19
+ - uses: katyo/publish-crates@v2
20
+ with:
21
+ registry-token: ${{ secrets.CARGO_REGISTRY_TOKEN }}
@@ -0,0 +1,31 @@
1
+ name: Tests
2
+
3
+ on:
4
+ push:
5
+ paths:
6
+ - "src/**"
7
+ - "tests/**"
8
+ - "Cargo.toml"
9
+ - "Cargo.lock"
10
+ - "templates/**"
11
+ pull_request:
12
+ paths:
13
+ - "src/**"
14
+ - "tests/**"
15
+ - "Cargo.toml"
16
+ - "Cargo.lock"
17
+ - "templates/**"
18
+
19
+ env:
20
+ CARGO_TERM_COLOR: always
21
+
22
+ jobs:
23
+ build:
24
+ runs-on: ubuntu-latest
25
+
26
+ steps:
27
+ - uses: actions/checkout@v4
28
+ - name: Build
29
+ run: cargo build --verbose
30
+ - name: Run tests
31
+ run: cargo test --verbose
@@ -0,0 +1,9 @@
1
+ /target
2
+ .DS_Store
3
+ */.DS_Store
4
+
5
+ # Ignore files that are generated while testing
6
+ tests/intermediates
7
+
8
+ # Ignore tarpaulin report
9
+ tarpaulin-report.html
@@ -0,0 +1,141 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="AutoImportSettings">
4
+ <option name="autoReloadType" value="ALL" />
5
+ </component>
6
+ <component name="CargoProjects">
7
+ <cargoProject FILE="$PROJECT_DIR$/Cargo.toml" />
8
+ </component>
9
+ <component name="ChangeListManager">
10
+ <list default="true" id="9840b972-e288-49cc-a667-5c6c68ce191a" name="Changes" comment="">
11
+ <change afterPath="$PROJECT_DIR$/pyproject.toml" afterDir="false" />
12
+ <change afterPath="$PROJECT_DIR$/src/python/bindings.rs" afterDir="false" />
13
+ <change beforePath="$PROJECT_DIR$/Cargo.lock" beforeDir="false" afterPath="$PROJECT_DIR$/Cargo.lock" afterDir="false" />
14
+ <change beforePath="$PROJECT_DIR$/Cargo.toml" beforeDir="false" afterPath="$PROJECT_DIR$/Cargo.toml" afterDir="false" />
15
+ <change beforePath="$PROJECT_DIR$/src/attribute.rs" beforeDir="false" afterPath="$PROJECT_DIR$/src/attribute.rs" afterDir="false" />
16
+ <change beforePath="$PROJECT_DIR$/src/datamodel.rs" beforeDir="false" afterPath="$PROJECT_DIR$/src/datamodel.rs" afterDir="false" />
17
+ <change beforePath="$PROJECT_DIR$/src/exporters.rs" beforeDir="false" afterPath="$PROJECT_DIR$/src/exporters.rs" afterDir="false" />
18
+ <change beforePath="$PROJECT_DIR$/src/lib.rs" beforeDir="false" afterPath="$PROJECT_DIR$/src/lib.rs" afterDir="false" />
19
+ <change beforePath="$PROJECT_DIR$/src/markdown/frontmatter.rs" beforeDir="false" afterPath="$PROJECT_DIR$/src/markdown/frontmatter.rs" afterDir="false" />
20
+ <change beforePath="$PROJECT_DIR$/src/object.rs" beforeDir="false" afterPath="$PROJECT_DIR$/src/object.rs" afterDir="false" />
21
+ <change beforePath="$PROJECT_DIR$/src/xmltype.rs" beforeDir="false" afterPath="$PROJECT_DIR$/src/xmltype.rs" afterDir="false" />
22
+ </list>
23
+ <option name="SHOW_DIALOG" value="false" />
24
+ <option name="HIGHLIGHT_CONFLICTS" value="true" />
25
+ <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
26
+ <option name="LAST_RESOLUTION" value="IGNORE" />
27
+ </component>
28
+ <component name="FileTemplateManagerImpl">
29
+ <option name="RECENT_TEMPLATES">
30
+ <list>
31
+ <option value="Rust File" />
32
+ </list>
33
+ </option>
34
+ </component>
35
+ <component name="FormatOnSaveOptions">
36
+ <option name="myRunOnSave" value="true" />
37
+ </component>
38
+ <component name="Git.Settings">
39
+ <option name="RECENT_BRANCH_BY_REPOSITORY">
40
+ <map>
41
+ <entry key="$PROJECT_DIR$" value="main" />
42
+ </map>
43
+ </option>
44
+ <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
45
+ </component>
46
+ <component name="MacroExpansionManager">
47
+ <option name="directoryName" value="1dfz0vcw" />
48
+ </component>
49
+ <component name="OptimizeOnSaveOptions">
50
+ <option name="myRunOnSave" value="true" />
51
+ </component>
52
+ <component name="ProjectColorInfo">{
53
+ &quot;associatedIndex&quot;: 1
54
+ }</component>
55
+ <component name="ProjectId" id="2keA5zw06dFSJlFUMNGnEIv0qqh" />
56
+ <component name="ProjectViewState">
57
+ <option name="hideEmptyMiddlePackages" value="true" />
58
+ <option name="showLibraryContents" value="true" />
59
+ </component>
60
+ <component name="PropertiesComponent">{
61
+ &quot;keyToString&quot;: {
62
+ &quot;Cargo.Test pipeline::tests::test_prepend_root.executor&quot;: &quot;Run&quot;,
63
+ &quot;RunOnceActivity.ShowReadmeOnStart&quot;: &quot;true&quot;,
64
+ &quot;RunOnceActivity.rust.reset.selective.auto.import&quot;: &quot;true&quot;,
65
+ &quot;git-widget-placeholder&quot;: &quot;main&quot;,
66
+ &quot;last_opened_file_path&quot;: &quot;/Users/janrange/GitHub/sdrdm.rs/tests/data&quot;,
67
+ &quot;node.js.detected.package.eslint&quot;: &quot;true&quot;,
68
+ &quot;node.js.detected.package.tslint&quot;: &quot;true&quot;,
69
+ &quot;node.js.selected.package.eslint&quot;: &quot;(autodetect)&quot;,
70
+ &quot;node.js.selected.package.tslint&quot;: &quot;(autodetect)&quot;,
71
+ &quot;nodejs_package_manager_path&quot;: &quot;npm&quot;,
72
+ &quot;org.rust.cargo.project.model.PROJECT_DISCOVERY&quot;: &quot;true&quot;,
73
+ &quot;org.rust.cargo.project.model.impl.CargoExternalSystemProjectAware.subscribe.first.balloon&quot;: &quot;&quot;,
74
+ &quot;rearrange.code.on.save&quot;: &quot;true&quot;,
75
+ &quot;settings.editor.selected.configurable&quot;: &quot;actions.on.save&quot;,
76
+ &quot;vue.rearranger.settings.migration&quot;: &quot;true&quot;
77
+ }
78
+ }</component>
79
+ <component name="RecentsManager">
80
+ <key name="CopyFile.RECENT_KEYS">
81
+ <recent name="$PROJECT_DIR$/tests/data" />
82
+ </key>
83
+ </component>
84
+ <component name="RsExternalLinterProjectSettings">
85
+ <option name="runOnTheFly" value="true" />
86
+ </component>
87
+ <component name="RunManager">
88
+ <configuration name="Test pipeline::tests::test_prepend_root" type="CargoCommandRunConfiguration" factoryName="Cargo Command" temporary="true">
89
+ <option name="command" value="test --package mdmodels --lib pipeline::tests::test_prepend_root -- --exact" />
90
+ <option name="workingDirectory" value="file://$PROJECT_DIR$" />
91
+ <envs />
92
+ <option name="emulateTerminal" value="true" />
93
+ <option name="channel" value="DEFAULT" />
94
+ <option name="requiredFeatures" value="true" />
95
+ <option name="allFeatures" value="false" />
96
+ <option name="withSudo" value="false" />
97
+ <option name="buildTarget" value="REMOTE" />
98
+ <option name="backtrace" value="SHORT" />
99
+ <option name="isRedirectInput" value="false" />
100
+ <option name="redirectInputPath" value="" />
101
+ <method v="2">
102
+ <option name="CARGO.BUILD_TASK_PROVIDER" enabled="true" />
103
+ </method>
104
+ </configuration>
105
+ </component>
106
+ <component name="RustProjectSettings">
107
+ <option name="toolchainHomeDirectory" value="$USER_HOME$/.cargo/bin" />
108
+ </component>
109
+ <component name="RustfmtProjectSettings">
110
+ <option name="useRustfmt" value="true" />
111
+ </component>
112
+ <component name="SharedIndexes">
113
+ <attachedChunks>
114
+ <set>
115
+ <option value="bundled-js-predefined-1d06a55b98c1-0b3e54e931b4-JavaScript-PY-241.18034.82" />
116
+ <option value="bundled-python-sdk-975db3bf15a3-2767605e8bc2-com.jetbrains.pycharm.pro.sharedIndexes.bundled-PY-241.18034.82" />
117
+ </set>
118
+ </attachedChunks>
119
+ </component>
120
+ <component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
121
+ <component name="TaskManager">
122
+ <task active="true" id="Default" summary="Default task">
123
+ <changelist id="9840b972-e288-49cc-a667-5c6c68ce191a" name="Changes" comment="" />
124
+ <created>1723633489708</created>
125
+ <option name="number" value="Default" />
126
+ <option name="presentableId" value="Default" />
127
+ <updated>1723633489708</updated>
128
+ <workItem from="1723633490772" duration="1253000" />
129
+ <workItem from="1724067795041" duration="1109000" />
130
+ <workItem from="1724096439057" duration="3000" />
131
+ <workItem from="1724097665624" duration="654000" />
132
+ <workItem from="1725790113955" duration="100000" />
133
+ <workItem from="1725790226243" duration="4246000" />
134
+ <workItem from="1725794662597" duration="16430000" />
135
+ </task>
136
+ <servers />
137
+ </component>
138
+ <component name="TypeScriptGeneratedFilesManager">
139
+ <option name="version" value="3" />
140
+ </component>
141
+ </project>