semantify3 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.
@@ -0,0 +1,37 @@
1
+ # This workflow will install Python dependencies, run tests and lint with a variety of Python versions
2
+ # For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
3
+
4
+ name: Build
5
+
6
+ on:
7
+ push:
8
+ branches: [ main ]
9
+ pull_request:
10
+ branches: [ main ]
11
+
12
+ jobs:
13
+ build:
14
+
15
+ runs-on: ubuntu-latest
16
+ strategy:
17
+ matrix:
18
+ # os: [ubuntu-latest, macos-latest, windows-latest]
19
+ # python-version: [ '3.10', '3.11', '3.12', '3.13' ]
20
+ os: [ubuntu-latest]
21
+ python-version: [ '3.12']
22
+
23
+ steps:
24
+ - uses: actions/checkout@v4
25
+ - name: Set up Python ${{ matrix.python-version }}
26
+ uses: actions/setup-python@v5
27
+ with:
28
+ python-version: ${{ matrix.python-version }}
29
+ - name: Install pip
30
+ run: |
31
+ python -m pip install --upgrade pip
32
+ - name: Install dependencies
33
+ run: |
34
+ scripts/install
35
+ - name: Run tests
36
+ run: |
37
+ scripts/test
@@ -0,0 +1,27 @@
1
+ name: Upload Python Package
2
+
3
+ on:
4
+ release:
5
+ types: [created]
6
+
7
+ jobs:
8
+ deploy:
9
+ runs-on: ubuntu-latest
10
+ permissions:
11
+ # IMPORTANT: this permission is mandatory for trusted publishing
12
+ id-token: write
13
+ steps:
14
+ - uses: actions/checkout@v4
15
+ - name: Set up Python
16
+ uses: actions/setup-python@v5
17
+ with:
18
+ python-version: '3.x'
19
+ - name: Install dependencies
20
+ run: |
21
+ python -m pip install --upgrade pip
22
+ pip install hatch
23
+ - name: Build and publish
24
+ run: |
25
+ hatch build
26
+ - name: Publish distribution to PyPI
27
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,207 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[codz]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ # Usually these files are written by a python script from a template
31
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
32
+ *.manifest
33
+ *.spec
34
+
35
+ # Installer logs
36
+ pip-log.txt
37
+ pip-delete-this-directory.txt
38
+
39
+ # Unit test / coverage reports
40
+ htmlcov/
41
+ .tox/
42
+ .nox/
43
+ .coverage
44
+ .coverage.*
45
+ .cache
46
+ nosetests.xml
47
+ coverage.xml
48
+ *.cover
49
+ *.py.cover
50
+ .hypothesis/
51
+ .pytest_cache/
52
+ cover/
53
+
54
+ # Translations
55
+ *.mo
56
+ *.pot
57
+
58
+ # Django stuff:
59
+ *.log
60
+ local_settings.py
61
+ db.sqlite3
62
+ db.sqlite3-journal
63
+
64
+ # Flask stuff:
65
+ instance/
66
+ .webassets-cache
67
+
68
+ # Scrapy stuff:
69
+ .scrapy
70
+
71
+ # Sphinx documentation
72
+ docs/_build/
73
+
74
+ # PyBuilder
75
+ .pybuilder/
76
+ target/
77
+
78
+ # Jupyter Notebook
79
+ .ipynb_checkpoints
80
+
81
+ # IPython
82
+ profile_default/
83
+ ipython_config.py
84
+
85
+ # pyenv
86
+ # For a library or package, you might want to ignore these files since the code is
87
+ # intended to run in multiple environments; otherwise, check them in:
88
+ # .python-version
89
+
90
+ # pipenv
91
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
93
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
94
+ # install all needed dependencies.
95
+ #Pipfile.lock
96
+
97
+ # UV
98
+ # Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
99
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
100
+ # commonly ignored for libraries.
101
+ #uv.lock
102
+
103
+ # poetry
104
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
105
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
106
+ # commonly ignored for libraries.
107
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
108
+ #poetry.lock
109
+ #poetry.toml
110
+
111
+ # pdm
112
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
113
+ # pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
114
+ # https://pdm-project.org/en/latest/usage/project/#working-with-version-control
115
+ #pdm.lock
116
+ #pdm.toml
117
+ .pdm-python
118
+ .pdm-build/
119
+
120
+ # pixi
121
+ # Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
122
+ #pixi.lock
123
+ # Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
124
+ # in the .venv directory. It is recommended not to include this directory in version control.
125
+ .pixi
126
+
127
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
128
+ __pypackages__/
129
+
130
+ # Celery stuff
131
+ celerybeat-schedule
132
+ celerybeat.pid
133
+
134
+ # SageMath parsed files
135
+ *.sage.py
136
+
137
+ # Environments
138
+ .env
139
+ .envrc
140
+ .venv
141
+ env/
142
+ venv/
143
+ ENV/
144
+ env.bak/
145
+ venv.bak/
146
+
147
+ # Spyder project settings
148
+ .spyderproject
149
+ .spyproject
150
+
151
+ # Rope project settings
152
+ .ropeproject
153
+
154
+ # mkdocs documentation
155
+ /site
156
+
157
+ # mypy
158
+ .mypy_cache/
159
+ .dmypy.json
160
+ dmypy.json
161
+
162
+ # Pyre type checker
163
+ .pyre/
164
+
165
+ # pytype static type analyzer
166
+ .pytype/
167
+
168
+ # Cython debug symbols
169
+ cython_debug/
170
+
171
+ # PyCharm
172
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
173
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
174
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
175
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
176
+ #.idea/
177
+
178
+ # Abstra
179
+ # Abstra is an AI-powered process automation framework.
180
+ # Ignore directories containing user credentials, local state, and settings.
181
+ # Learn more at https://abstra.io/docs
182
+ .abstra/
183
+
184
+ # Visual Studio Code
185
+ # Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
186
+ # that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
187
+ # and can be added to the global gitignore or merged into this file. However, if you prefer,
188
+ # you could uncomment the following to ignore the entire vscode folder
189
+ # .vscode/
190
+
191
+ # Ruff stuff:
192
+ .ruff_cache/
193
+
194
+ # PyPI configuration file
195
+ .pypirc
196
+
197
+ # Cursor
198
+ # Cursor is an AI-powered code editor. `.cursorignore` specifies files/directories to
199
+ # exclude from AI features like autocomplete and code analysis. Recommended for sensitive data
200
+ # refer to https://docs.cursor.com/context/ignore-files
201
+ .cursorignore
202
+ .cursorindexingignore
203
+
204
+ # Marimo
205
+ marimo/_static/
206
+ marimo/_lsp/
207
+ __marimo__/
@@ -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,49 @@
1
+ Metadata-Version: 2.4
2
+ Name: semantify3
3
+ Version: 0.0.1
4
+ Summary: semantify³ — Extract knowledge graph ready triples from human-readable annotations wherever possible — Syntax matters!
5
+ Project-URL: Home, https://github.com/WolfgangFahl/semantify3
6
+ Project-URL: Documentation, https://wiki.bitplan.com/index.php/semantify3
7
+ Project-URL: Source, https://github.com/WolfgangFahl/semantify3
8
+ Author-email: Wolfgang Fahl <wf@WolfgangFahl.com>
9
+ Maintainer-email: Wolfgang Fahl <wf@WolfgangFahl.com>
10
+ License: Apache-2.0
11
+ License-File: LICENSE
12
+ Keywords: RDF,SiDIF,YAML,knowledge-graph,ontology,semantic-web,triples
13
+ Classifier: Development Status :: 3 - Alpha
14
+ Classifier: Environment :: Console
15
+ Classifier: Intended Audience :: Developers
16
+ Classifier: Intended Audience :: Science/Research
17
+ Classifier: License :: OSI Approved :: Apache Software License
18
+ Classifier: Operating System :: OS Independent
19
+ Classifier: Programming Language :: Python :: 3 :: Only
20
+ Classifier: Programming Language :: Python :: 3.10
21
+ Classifier: Programming Language :: Python :: 3.11
22
+ Classifier: Programming Language :: Python :: 3.12
23
+ Classifier: Programming Language :: Python :: 3.13
24
+ Classifier: Topic :: Scientific/Engineering :: Information Analysis
25
+ Classifier: Topic :: Text Processing :: Markup
26
+ Requires-Python: >=3.10
27
+ Requires-Dist: pybasemkit>=0.1.3
28
+ Requires-Dist: pyyaml>=6.0
29
+ Requires-Dist: rdflib>=7.0.0
30
+ Provides-Extra: test
31
+ Requires-Dist: green; extra == 'test'
32
+ Description-Content-Type: text/markdown
33
+
34
+ # semantify3
35
+ semantify³ - extract knowledge graph ready triples from human readable annotations whereever possible - Syntax matters!
36
+
37
+ | | |
38
+ | :--- | :--- |
39
+ | **PyPi** | [![PyPI Status](https://img.shields.io/pypi/v/semantify3.svg)](https://pypi.python.org/pypi/semantify3/) [![License](https://img.shields.io/github/license/BITPlan/semantify3.svg)](https://www.apache.org/licenses/LICENSE-2.0) [![pypi](https://img.shields.io/pypi/pyversions/semantify3)](https://pypi.org/project/semantify3/) [![format](https://img.shields.io/pypi/format/semantify3)](https://pypi.org/project/semantify3/) [![downloads](https://img.shields.io/pypi/dd/semantify3)](https://pypi.org/project/semantify3/) |
40
+ | **GitHub** | [![Github Actions Build](https://github.com/BITPlan/semantify3/actions/workflows/build.yml/badge.svg)](https://github.com/BITPlan/semantify3/actions/workflows/build.yml) [![Release](https://img.shields.io/github/v/release/BITPlan/semantify3)](https://github.com/BITPlan/semantify3/releases) [![Contributors](https://img.shields.io/github/contributors/BITPlan/semantify3)](https://github.com/BITPlan/semantify3/graphs/contributors) [![Last Commit](https://img.shields.io/github/last-commit/BITPlan/semantify3)](https://github.com/BITPlan/semantify3/commits/) [![GitHub issues](https://img.shields.io/github/issues/BITPlan/semantify3.svg)](https://github.com/BITPlan/semantify3/issues) [![GitHub closed issues](https://img.shields.io/github/issues-closed/BITPlan/semantify3.svg)](https://github.com/BITPlan/semantify3/issues/?q=is%3Aissue+is%3Aclosed) |
41
+ | **Code** | [![style-black](https://img.shields.io/badge/%20style-black-000000.svg)](https://github.com/psf/black) [![imports-isort](https://img.shields.io/badge/%20imports-isort-%231674b1)](https://pycqa.github.io/isort/) |
42
+ | **Docs** | [![API Docs](https://img.shields.io/badge/API-Documentation-blue)](https://BITPlan.github.io/semantify3/) [![formatter-docformatter](https://img.shields.io/badge/%20formatter-docformatter-fedcba.svg)](https://github.com/PyCQA/docformatter) [![style-google](https://img.shields.io/badge/%20style-google-3666d6.svg)](https://google.github.io/styleguide/pyguide.html#s3.8-comments-and-docstrings) |
43
+
44
+ ## Documentation
45
+ [Wiki](https://wiki.bitplan.com/index.php/semantify3)
46
+
47
+ ### Authors
48
+ * [Tim Holzheim](https://www.semantic-mediawiki.org/wiki/Tim_Holzheim)
49
+ * [Wolfgang Fahl](http://www.bitplan.com/Wolfgang_Fahl)
@@ -0,0 +1,16 @@
1
+ # semantify3
2
+ semantify³ - extract knowledge graph ready triples from human readable annotations whereever possible - Syntax matters!
3
+
4
+ | | |
5
+ | :--- | :--- |
6
+ | **PyPi** | [![PyPI Status](https://img.shields.io/pypi/v/semantify3.svg)](https://pypi.python.org/pypi/semantify3/) [![License](https://img.shields.io/github/license/BITPlan/semantify3.svg)](https://www.apache.org/licenses/LICENSE-2.0) [![pypi](https://img.shields.io/pypi/pyversions/semantify3)](https://pypi.org/project/semantify3/) [![format](https://img.shields.io/pypi/format/semantify3)](https://pypi.org/project/semantify3/) [![downloads](https://img.shields.io/pypi/dd/semantify3)](https://pypi.org/project/semantify3/) |
7
+ | **GitHub** | [![Github Actions Build](https://github.com/BITPlan/semantify3/actions/workflows/build.yml/badge.svg)](https://github.com/BITPlan/semantify3/actions/workflows/build.yml) [![Release](https://img.shields.io/github/v/release/BITPlan/semantify3)](https://github.com/BITPlan/semantify3/releases) [![Contributors](https://img.shields.io/github/contributors/BITPlan/semantify3)](https://github.com/BITPlan/semantify3/graphs/contributors) [![Last Commit](https://img.shields.io/github/last-commit/BITPlan/semantify3)](https://github.com/BITPlan/semantify3/commits/) [![GitHub issues](https://img.shields.io/github/issues/BITPlan/semantify3.svg)](https://github.com/BITPlan/semantify3/issues) [![GitHub closed issues](https://img.shields.io/github/issues-closed/BITPlan/semantify3.svg)](https://github.com/BITPlan/semantify3/issues/?q=is%3Aissue+is%3Aclosed) |
8
+ | **Code** | [![style-black](https://img.shields.io/badge/%20style-black-000000.svg)](https://github.com/psf/black) [![imports-isort](https://img.shields.io/badge/%20imports-isort-%231674b1)](https://pycqa.github.io/isort/) |
9
+ | **Docs** | [![API Docs](https://img.shields.io/badge/API-Documentation-blue)](https://BITPlan.github.io/semantify3/) [![formatter-docformatter](https://img.shields.io/badge/%20formatter-docformatter-fedcba.svg)](https://github.com/PyCQA/docformatter) [![style-google](https://img.shields.io/badge/%20style-google-3666d6.svg)](https://google.github.io/styleguide/pyguide.html#s3.8-comments-and-docstrings) |
10
+
11
+ ## Documentation
12
+ [Wiki](https://wiki.bitplan.com/index.php/semantify3)
13
+
14
+ ### Authors
15
+ * [Tim Holzheim](https://www.semantic-mediawiki.org/wiki/Tim_Holzheim)
16
+ * [Wolfgang Fahl](http://www.bitplan.com/Wolfgang_Fahl)
@@ -0,0 +1,74 @@
1
+ # see https://flit.pypa.io/en/latest/pyproject_toml.html
2
+ [build-system]
3
+ requires = ["hatchling"]
4
+ build-backend = "hatchling.build"
5
+
6
+ [project]
7
+ name = "semantify3"
8
+ description = "semantify³ — Extract knowledge graph ready triples from human-readable annotations wherever possible — Syntax matters!"
9
+ keywords = ["RDF", "YAML", "SiDIF", "triples", "knowledge-graph", "semantic-web", "ontology"]
10
+
11
+ authors = [
12
+ {name = "Wolfgang Fahl", email = "wf@WolfgangFahl.com"}
13
+ ]
14
+
15
+ maintainers = [
16
+ { name = "Wolfgang Fahl", email = "wf@WolfgangFahl.com" },
17
+ ]
18
+
19
+ readme = "README.md"
20
+ license = {text = "Apache-2.0"}
21
+ dependencies = [
22
+ # https://pypi.org/project/pybasemkit/
23
+ # https://github.com/WolfgangFahl/pybasemkit
24
+ # Python base module kit: YAML/JSON I/O, structured logging, CLI tooling, shell execution, and remote pydevd debug support.
25
+ "pybasemkit>=0.1.3",
26
+ # https://pypi.org/project/rdflib/
27
+ # RDF library for Python - parsing, serializing, querying RDF
28
+ "rdflib>=7.0.0",
29
+ # https://pypi.org/project/PyYAML/
30
+ # YAML parser and emitter for Python
31
+ "PyYAML>=6.0",
32
+ ]
33
+
34
+ requires-python = ">=3.10"
35
+ classifiers=[
36
+ "Development Status :: 3 - Alpha",
37
+ "Environment :: Console",
38
+ "Programming Language :: Python :: 3 :: Only",
39
+ "Programming Language :: Python :: 3.10",
40
+ "Programming Language :: Python :: 3.11",
41
+ "Programming Language :: Python :: 3.12",
42
+ "Programming Language :: Python :: 3.13",
43
+ "Operating System :: OS Independent",
44
+ "Topic :: Scientific/Engineering :: Information Analysis",
45
+ "Topic :: Text Processing :: Markup",
46
+ "Intended Audience :: Developers",
47
+ "Intended Audience :: Science/Research",
48
+ "License :: OSI Approved :: Apache Software License"
49
+ ]
50
+ dynamic = ["version"]
51
+
52
+ [tool.hatch.version]
53
+ path = "sem3/__init__.py"
54
+
55
+ [project.urls]
56
+ Home = "https://github.com/WolfgangFahl/semantify3"
57
+ Documentation = "https://wiki.bitplan.com/index.php/semantify3"
58
+ Source = "https://github.com/WolfgangFahl/semantify3"
59
+
60
+ [project.scripts]
61
+ sem3 = "sem3.sem3_cmd:main"
62
+
63
+ [project.optional-dependencies]
64
+ test = [
65
+ "green",
66
+ ]
67
+
68
+ [tool.hatch.build.targets.wheel]
69
+ only-include = ["sem3"]
70
+
71
+ [tool.hatch.build.targets.wheel.sources]
72
+ "semantify3" = "sem3"
73
+
74
+
@@ -0,0 +1,15 @@
1
+ #!/bin/bash
2
+ # WF 2025-11-29
3
+ package=sem3
4
+
5
+ # Sort imports
6
+ isort tests/*.py
7
+ isort $package/*.py
8
+
9
+ # Format code
10
+ black tests/*.py
11
+ black $package/*.py
12
+
13
+ # Format docstrings
14
+ #docformatter --in-place tests/*.py
15
+ #docformatter --in-place $package/*.py
@@ -0,0 +1,88 @@
1
+ #!/bin/bash
2
+ # create docs for a configurable project
3
+ # WF 2024-07-30 - updated
4
+
5
+ # Extract project name from pyproject.toml
6
+ PROJECT_NAME=$(grep "\[project\]" pyproject.toml -A1 | grep name | cut -d '=' -f2 | tr -d ' "')
7
+ PACKAGE_NAME=$(grep "\[tool.hatch.build.targets.wheel.sources\]" pyproject.toml -A1 | tail -1 | cut -d '=' -f2 | tr -d ' "')
8
+
9
+
10
+ # Function to print usage information
11
+ print_usage() {
12
+ echo "Usage: $0 [OPTIONS]"
13
+ echo "Options:"
14
+ echo " -pr, --project NAME Set the project name (default: $PROJECT_NAME)"
15
+ echo " -pa, --package NAME Set the package name (default: $PACKAGE_NAME)"
16
+ echo " -d, --deploy Deploy the documentation after building"
17
+ echo " -h, --help Display this help message"
18
+ }
19
+
20
+ # Parse command line arguments
21
+ DEPLOY=false
22
+ while [[ "$#" -gt 0 ]]; do
23
+ case $1 in
24
+ -pr|--project) PROJECT_NAME="$2"; shift ;;
25
+ -pa|--package) PACKAGE_NAME="$2"; shift ;;
26
+ -d|--deploy) DEPLOY=true ;;
27
+ -h|--help) print_usage; exit 0 ;;
28
+ *) echo "Unknown parameter: $1"; print_usage; exit 1 ;;
29
+ esac
30
+ shift
31
+ done
32
+
33
+ # Ensure we're in the correct directory
34
+ if [[ ! -d "$PACKAGE_NAME" ]]; then
35
+ echo "Error: $PACKAGE_NAME package directory not found. Are you in the correct directory?"
36
+ exit 1
37
+ fi
38
+
39
+ # Check if mkdocs is installed
40
+ if ! command -v mkdocs &> /dev/null; then
41
+ pip install mkdocs mkdocs-material mkdocstrings[python]
42
+ fi
43
+
44
+ # Create or update mkdocs.yml
45
+ cat << EOF > mkdocs.yml
46
+ site_name: $PROJECT_NAME API Documentation
47
+ theme:
48
+ name: material
49
+ plugins:
50
+ - search
51
+ - mkdocstrings:
52
+ handlers:
53
+ python:
54
+ setup_commands:
55
+ - import sys
56
+ - import os
57
+ - sys.path.insert(0, os.path.abspath("."))
58
+ selection:
59
+ docstring_style: google
60
+ rendering:
61
+ show_source: true
62
+ nav:
63
+ - API: index.md
64
+ EOF
65
+
66
+ # Create or update index.md
67
+ index_md=docs/index.md
68
+ mkdir -p docs
69
+ cat << EOF > $index_md
70
+ # $PROJECT_NAME API Documentation
71
+
72
+ ::: $PACKAGE_NAME
73
+ options:
74
+ show_submodules: true
75
+ EOF
76
+
77
+ # Ignore DeprecationWarnings during build
78
+ export PYTHONWARNINGS="ignore::DeprecationWarning"
79
+
80
+ # Build the documentation
81
+ mkdocs build --config-file ./mkdocs.yml
82
+
83
+ # Deploy if requested
84
+ if [ "$DEPLOY" = true ]; then
85
+ mkdocs gh-deploy --force --config-file ./mkdocs.yml
86
+ fi
87
+
88
+ echo "Documentation process completed for $PROJECT_NAME."
@@ -0,0 +1,4 @@
1
+ #!/bin/bash
2
+ # WF 2023-07-19
3
+ # simple install via pyproject.toml
4
+ pip install .
@@ -0,0 +1,8 @@
1
+ #!/bin/bash
2
+ # WF 2024-07-31
3
+ # prepare a release
4
+ scripts/doc -d
5
+
6
+ # Commit with a message that includes the current ISO timestamp
7
+ git commit -a -m "release commit"
8
+ git push
@@ -0,0 +1,132 @@
1
+ #!/bin/bash
2
+ # WF 2022-08-20
3
+ # WF 2024-08-03
4
+
5
+ #ansi colors
6
+ #http://www.csc.uvic.ca/~sae/seng265/fall04/tips/s265s047-tips/bash-using-colors.html
7
+ blue='\033[0;34m'
8
+ red='\033[0;31m'
9
+ green='\033[0;32m' # '\e[1;32m' is too bright for white bg.
10
+ endColor='\033[0m'
11
+
12
+ #
13
+ # a colored message
14
+ # params:
15
+ # 1: l_color - the color of the message
16
+ # 2: l_msg - the message to display
17
+ #
18
+ color_msg() {
19
+ local l_color="$1"
20
+ local l_msg="$2"
21
+ echo -e "${l_color}$l_msg${endColor}"
22
+ }
23
+
24
+ #
25
+ # error
26
+ #
27
+ # show the given error message on stderr and exit
28
+ #
29
+ # params:
30
+ # 1: l_msg - the error message to display
31
+ #
32
+ error() {
33
+ local l_msg="$1"
34
+ # use ansi red for error
35
+ color_msg $red "Error:" 1>&2
36
+ color_msg $red "\t$l_msg" 1>&2
37
+ exit 1
38
+ }
39
+
40
+ #
41
+ # show a negative message
42
+ #
43
+ negative() {
44
+ local l_msg="$1"
45
+ color_msg $red "❌:$l_msg"
46
+ }
47
+
48
+ #
49
+ # show a positive message
50
+ #
51
+ positive() {
52
+ local l_msg="$1"
53
+ color_msg $green "✅:$l_msg"
54
+ }
55
+
56
+ # show usage
57
+ #
58
+ usage() {
59
+ echo "$0 [-g|--green|-m|--module|-t|--tox|-h|--help]"
60
+ echo "-t |--tox: run tests with tox"
61
+ echo "-g |--green: run tests with green"
62
+ echo "-m |--module: run modulewise test"
63
+ echo "-h |--help: show this usage"
64
+ echo "default is running tests with unittest discover"
65
+ exit 1
66
+ }
67
+
68
+ #
69
+ # check and optional install the given package
70
+ #
71
+ check_package() {
72
+ local l_package="$1"
73
+ pip show $l_package > /dev/null
74
+ if [ $? -ne 0 ]
75
+ then
76
+ negative "$l_package"
77
+ color_msg $blue "installing $l_package"
78
+ pip install $l_package
79
+ else
80
+ positive "$l_package"
81
+ fi
82
+ }
83
+
84
+ #
85
+ # test module by module
86
+ #
87
+ modulewise_test() {
88
+ foundErrors=0
89
+ foundTests=0
90
+ for testmodule in tests/test*.py
91
+ do
92
+ echo "testing $testmodule ..."
93
+ # see https://github.com/CleanCut/green/issues/263
94
+ #green $testmodule -s1
95
+ python -m unittest $testmodule
96
+ exit_code=$?
97
+ foundErrors=$((foundErrors+exit_code))
98
+ foundTests=$((foundTests+1))
99
+ done
100
+ echo "$foundErrors/$foundTests module unit tests failed" 1>&2
101
+ if [[ $foundErrors -gt 0 ]]
102
+ then
103
+ exit 1
104
+ fi
105
+ }
106
+
107
+ export PYTHON_PATH="."
108
+ while [ "$1" != "" ]
109
+ do
110
+ option="$1"
111
+ case $option in
112
+ -h|--help)
113
+ usage
114
+ exit 0
115
+ ;;
116
+ -g|--green)
117
+ check_package green
118
+ green tests -s 1
119
+ exit 0
120
+ ;;
121
+ -m|--module)
122
+ modulewise_test
123
+ exit 0
124
+ ;;
125
+ -t|--tox)
126
+ check_package tox
127
+ tox -e py
128
+ exit 0
129
+ ;;
130
+ esac
131
+ done
132
+ python3 -m unittest discover
@@ -0,0 +1,11 @@
1
+ """
2
+ semantify³ - Extract knowledge graph ready triples from human-readable annotations wherever possible.
3
+
4
+ Syntax matters!
5
+
6
+ Created: 2025-01-29
7
+ Authors: Wolfgang Fahl, Tim Holzheim
8
+ Repository: https://github.com/BITPlan/semantify3
9
+ """
10
+
11
+ __version__ = "0.0.1"
@@ -0,0 +1,169 @@
1
+ """Command-line interface for semantify³.
2
+
3
+ ```yaml
4
+ # 🌐🕸
5
+ extractor:
6
+ isA: PythonModule
7
+ author: Wolfgang Fahl
8
+ createdAt: 2025-11-29
9
+ purpose: extraction of relevant markup snippets for semantify³.
10
+ ```
11
+ """
12
+
13
+ import glob
14
+ import logging
15
+ import re
16
+ from dataclasses import dataclass
17
+ from typing import List, Optional
18
+
19
+ from basemkit.yamlable import lod_storable
20
+
21
+
22
+ @lod_storable
23
+ @dataclass
24
+ class Markup:
25
+ """A single markup."""
26
+
27
+ lang: str
28
+ code: str
29
+ source: str
30
+
31
+
32
+ class Extractor:
33
+ """Extract semantic annotation markup from files."""
34
+
35
+ def __init__(self, marker: str = "🌐🕸", debug: bool = False):
36
+ """constructor."""
37
+ self.marker = marker
38
+ self.debug = debug
39
+ self.logger = logging.getLogger(__name__)
40
+ self.logger.setLevel(logging.DEBUG if debug else logging.INFO)
41
+
42
+ def log(self, msg: str):
43
+ if self.debug:
44
+ self.logger.debug(msg)
45
+
46
+ def extract_from_file(self, filepath: str) -> List[Markup]:
47
+ """Extract markup snippets from a single file.
48
+
49
+ Args:
50
+ filepath: Path to the file to extract from.
51
+
52
+ Returns:
53
+ List[Markup]: List of extracted markup snippets.
54
+ """
55
+ markups = []
56
+ try:
57
+ with open(filepath, "r", encoding="utf-8") as f:
58
+ content = f.read()
59
+ markups = self.extract_from_text(content, source_path=filepath)
60
+ except (IOError, UnicodeDecodeError) as e:
61
+ self.logger.warning(f"Error reading {filepath}: {e}")
62
+ markups = []
63
+ return markups
64
+
65
+ def extract_from_text(
66
+ self, text: str, source_path: Optional[str] = None
67
+ ) -> List[Markup]:
68
+ """Extract all semantic markup snippets from text.
69
+
70
+ Args:
71
+ text: The source text to extract from.
72
+ source_path: Optional file path for location tracking.
73
+
74
+ Returns:
75
+ List[Markup]: List of extracted markup snippets.
76
+ """
77
+ markups = []
78
+
79
+ # Pattern to match code blocks with yaml or sidif
80
+ pattern = re.compile(
81
+ r"```(yaml|sidif)\s*\n" # Opening fence with language
82
+ r"(.*?)" # Content (non-greedy)
83
+ r"\n\s*```", # Closing fence
84
+ re.DOTALL,
85
+ )
86
+
87
+ for match in pattern.finditer(text):
88
+ lang = match.group(1)
89
+ raw_content = match.group(2)
90
+
91
+ # Find first non-empty line
92
+ lines = raw_content.split("\n")
93
+ first_content_idx = None
94
+
95
+ for idx, line in enumerate(lines):
96
+ if line.strip():
97
+ first_content_idx = idx
98
+ break
99
+
100
+ if first_content_idx is None:
101
+ continue
102
+
103
+ first_line = lines[first_content_idx].strip()
104
+
105
+ # Check for marker
106
+ if self.marker not in first_line:
107
+ continue
108
+
109
+ # Extract content after marker line
110
+ content_lines = lines[first_content_idx + 1 :]
111
+ code = "\n".join(content_lines).strip()
112
+
113
+ if not code:
114
+ continue
115
+
116
+ # Calculate source line (1-based)
117
+ line_num = text[: match.start()].count("\n") + 1
118
+
119
+ source = ""
120
+ if source_path:
121
+ source = f"{source_path}:{line_num}"
122
+
123
+ markup = Markup(lang=lang, code=code, source=source)
124
+ markups.append(markup)
125
+
126
+ if self.debug and len(markups) > 0:
127
+ self.log(f"Found {len(markups)} snippets in {source_path}")
128
+
129
+ return markups
130
+
131
+ def extract_from_glob(self, pattern: str) -> List[Markup]:
132
+ """Extract markup snippets from files matching a glob pattern.
133
+
134
+ Args:
135
+ pattern: Glob pattern to match files (supports **).
136
+
137
+ Returns:
138
+ List[Markup]: All markup snippets from matching files.
139
+ """
140
+ all_markups = []
141
+
142
+ files = glob.glob(pattern, recursive=True)
143
+ self.log(f"Glob pattern '{pattern}' found {len(files)} files")
144
+
145
+ for filepath in files:
146
+ markups = self.extract_from_file(filepath)
147
+ all_markups.extend(markups)
148
+
149
+ return all_markups
150
+
151
+ def extract_from_glob_list(self, patterns: List[str]) -> List[Markup]:
152
+ """Extract markup snippets from files matching multiple glob patterns.
153
+
154
+ Args:
155
+ patterns: List of glob patterns to match files.
156
+
157
+ Returns:
158
+ List[Markup]: All markup snippets from matching files.
159
+ """
160
+ all_markups = []
161
+
162
+ self.log(f"Processing {len(patterns)} glob patterns")
163
+
164
+ for pattern in patterns:
165
+ self.log(f"Checking pattern: {pattern}")
166
+ markups = self.extract_from_glob(pattern)
167
+ all_markups.extend(markups)
168
+
169
+ return all_markups
@@ -0,0 +1,116 @@
1
+ """Command-line interface for semantify³.
2
+
3
+ ```yaml
4
+ 🌐🕸
5
+ sem3_cmd:
6
+ isA: PythonModule
7
+ author: Wolfgang Fahl
8
+ createdAt: 2025-11-29
9
+ purpose: Command-line interface for semantify³.
10
+ ```
11
+ """
12
+
13
+ from argparse import ArgumentParser, Namespace
14
+ import argparse
15
+ import os
16
+ import sys
17
+
18
+ from basemkit.base_cmd import BaseCmd
19
+ from sem3.extractor import Extractor
20
+ from sem3.version import Version
21
+
22
+
23
+ class Semantify3Cmd(BaseCmd):
24
+ """Command line interface for semantify³."""
25
+
26
+ def __init__(self):
27
+ """Initialize the semantify³ command."""
28
+ super().__init__(version=Version, description=Version.description)
29
+
30
+ def get_arg_parser(self) -> ArgumentParser:
31
+ """Create and configure the argument parser.
32
+
33
+ Returns:
34
+ ArgumentParser: The configured argument parser.
35
+ """
36
+ parser = super().get_arg_parser()
37
+ parser.add_argument('files', type=argparse.FileType('r'), nargs='*')
38
+
39
+ parser.add_argument(
40
+ "-i",
41
+ "--input",
42
+ type=str,
43
+ help="Input file glob expression",
44
+ )
45
+ parser.add_argument(
46
+ "-o",
47
+ "--output",
48
+ type=str,
49
+ help="Output file path for triples",
50
+ )
51
+ parser.add_argument(
52
+ "--format",
53
+ type=str,
54
+ choices=[
55
+ "turtle",
56
+ "n3",
57
+ "ntriples",
58
+ "xml",
59
+ "json-ld",
60
+ "sidif",
61
+ "graphml", # Supported by Gremlin and Neo4j (via APOC)
62
+ "graphson", # Gremlin specific JSON
63
+ "cypher", # Neo4j Cypher CREATE statements
64
+ ],
65
+ default="turtle",
66
+ help="Output serialization format (default: turtle)",
67
+ )
68
+ return parser
69
+
70
+ def handle_args(self, args: Namespace) -> bool:
71
+ """Handle parsed arguments.
72
+
73
+ Args:
74
+ args: Parsed argument namespace.
75
+
76
+ Returns:
77
+ bool: True if handled, False otherwise.
78
+ """
79
+ handled = super().handle_args(args)
80
+ if handled:
81
+ return True
82
+
83
+ if args.input or args.files:
84
+ extractor = Extractor(debug=self.debug)
85
+ markups = []
86
+ if args.input:
87
+ markups.extend(extractor.extract_from_glob(args.input))
88
+ if args.files:
89
+ for file_path in args.files:
90
+ markups.extend(extractor.extract_from_file(file_path))
91
+ if args.verbose:
92
+ print(f"Found {len(markups)} markups")
93
+ for i, markup in enumerate(markups):
94
+ print(f"{i+1}: {markup.lang} in {os.path.basename(markup.source)}")
95
+ print(markup.code)
96
+ print("-" * 20)
97
+ return True
98
+
99
+ return False
100
+
101
+
102
+ def main(argv=None) -> int:
103
+ """Main entry point for semantify3 CLI.
104
+
105
+ Args:
106
+ argv: Command line arguments.
107
+
108
+ Returns:
109
+ int: Exit code.
110
+ """
111
+ cmd = Semantify3Cmd()
112
+ return cmd.run(argv)
113
+
114
+
115
+ if __name__ == "__main__":
116
+ sys.exit(main())
@@ -0,0 +1,38 @@
1
+ """Created on 2025-11-29.
2
+
3
+ @author: wf
4
+ """
5
+
6
+ from basemkit.yamlable import lod_storable
7
+
8
+ import sem3
9
+
10
+
11
+ @lod_storable
12
+ class Version:
13
+ """Version handling for semantify³."""
14
+
15
+ name = "semantify³"
16
+ version = sem3.__version__
17
+ date = "2025-11-29"
18
+ updated = "2025-11-29"
19
+ description = "Extract knowledge graph ready triples from human-readable annotations wherever possible — Syntax matters!"
20
+
21
+ authors = "Wolfgang Fahl, Tim Holzheim"
22
+
23
+ doc_url = "https://wiki.bitplan.com/index.php/semantify3"
24
+ chat_url = "https://github.com/BITPlan/semantify3/discussions"
25
+ cm_url = "https://github.com/BITPlan/semantify3"
26
+
27
+ license = """Copyright 2025 contributors. All rights reserved.
28
+
29
+ Licensed under the Apache License 2.0
30
+ http://www.apache.org/licenses/LICENSE-2.0
31
+
32
+ Distributed on an "AS IS" basis without warranties
33
+ or conditions of any kind, either express or implied."""
34
+
35
+ longDescription = f"""{name} version {version}
36
+ {description}
37
+
38
+ Created by {authors} on {date} last updated {updated}"""
File without changes
@@ -0,0 +1,45 @@
1
+ """
2
+ ```sidif
3
+ # 🌐🕸
4
+ test_extractor isA PythonModule
5
+ "Wolfgang Fahl" is author of it
6
+ "2025-11-29" is createdAt of it
7
+ "Test main micro annotation snippet extraction" is purpose of it
8
+ ```
9
+ """
10
+
11
+ import os
12
+
13
+ from basemkit.basetest import Basetest
14
+
15
+ from sem3.extractor import Extractor
16
+
17
+
18
+ class Test_Extractor(Basetest):
19
+ """Test the extractor."""
20
+
21
+ def setUp(self, debug=True, profile=True):
22
+ Basetest.setUp(self, debug=debug, profile=profile)
23
+ self.script_path = os.path.abspath(__file__)
24
+ self.project_root = os.path.dirname(os.path.dirname(self.script_path))
25
+
26
+ def test_extract_from_own_source(self):
27
+ """Test that the extractor can find annotations in the project's own
28
+ source code."""
29
+ # recursive=True in glob() requires the "**" pattern to actually traverse directories
30
+ glob_patterns = [
31
+ os.path.join(self.project_root, "**", "*.py"),
32
+ ]
33
+
34
+ extractor = Extractor(debug=self.debug)
35
+ markups = extractor.extract_from_glob_list(glob_patterns)
36
+ if self.debug:
37
+ print(f"Found {len(markups)} markups")
38
+ for i, markup in enumerate(markups):
39
+ print(f"{i+1}: {markup.lang} in {os.path.basename(markup.source)}")
40
+ print(markup.code)
41
+ print("-" * 20)
42
+ self.assertGreaterEqual(3, len(markups))
43
+ for markup in markups:
44
+ for field in ["isA", "author", "createdAt", "purpose"]:
45
+ self.assertTrue(field in markup.code)