pylode 3.3.3__tar.gz → 3.3.4__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 (49) hide show
  1. {pylode-3.3.3 → pylode-3.3.4}/PKG-INFO +81 -27
  2. {pylode-3.3.3 → pylode-3.3.4}/README.md +75 -26
  3. {pylode-3.3.3 → pylode-3.3.4}/pylode/profiles/ontpub.py +2 -2
  4. pylode-3.3.4/pylode/profiles/supermodel/component/properties_table.py +344 -0
  5. {pylode-3.3.3 → pylode-3.3.4}/pylode/profiles/supermodel/dataset.py +5 -1
  6. {pylode-3.3.3 → pylode-3.3.4}/pylode/profiles/supermodel/html.py +10 -1
  7. {pylode-3.3.3 → pylode-3.3.4}/pylode/profiles/supermodel/model.py +21 -1
  8. {pylode-3.3.3 → pylode-3.3.4}/pylode/profiles/supermodel/query/property_shape.py +90 -10
  9. {pylode-3.3.3 → pylode-3.3.4}/pylode/pylode.css +3 -0
  10. {pylode-3.3.3 → pylode-3.3.4}/pylode/rdf_elements.py +1 -0
  11. pylode-3.3.4/pylode/server.py +163 -0
  12. {pylode-3.3.3 → pylode-3.3.4}/pylode/utils.py +16 -11
  13. {pylode-3.3.3 → pylode-3.3.4}/pyproject.toml +9 -1
  14. pylode-3.3.3/pylode/profiles/supermodel/component/properties_table.py +0 -212
  15. {pylode-3.3.3 → pylode-3.3.4}/pylode/__init__.py +0 -0
  16. {pylode-3.3.3 → pylode-3.3.4}/pylode/__main__.py +0 -0
  17. {pylode-3.3.3 → pylode-3.3.4}/pylode/cli.py +0 -0
  18. {pylode-3.3.3 → pylode-3.3.4}/pylode/profiles/__init__.py +0 -0
  19. {pylode-3.3.3 → pylode-3.3.4}/pylode/profiles/supermodel/__init__.py +0 -0
  20. {pylode-3.3.3 → pylode-3.3.4}/pylode/profiles/supermodel/component/__init__.py +0 -0
  21. {pylode-3.3.3 → pylode-3.3.4}/pylode/profiles/supermodel/component/example.py +0 -0
  22. {pylode-3.3.3 → pylode-3.3.4}/pylode/profiles/supermodel/component/heading.py +0 -0
  23. {pylode-3.3.3 → pylode-3.3.4}/pylode/profiles/supermodel/component/link.py +0 -0
  24. {pylode-3.3.3 → pylode-3.3.4}/pylode/profiles/supermodel/component/preamble.py +0 -0
  25. {pylode-3.3.3 → pylode-3.3.4}/pylode/profiles/supermodel/component/tooltip.py +0 -0
  26. {pylode-3.3.3 → pylode-3.3.4}/pylode/profiles/supermodel/fragment.py +0 -0
  27. {pylode-3.3.3 → pylode-3.3.4}/pylode/profiles/supermodel/loader.py +0 -0
  28. {pylode-3.3.3 → pylode-3.3.4}/pylode/profiles/supermodel/namespace.py +0 -0
  29. {pylode-3.3.3 → pylode-3.3.4}/pylode/profiles/supermodel/query/__init__.py +0 -0
  30. {pylode-3.3.3 → pylode-3.3.4}/pylode/profiles/supermodel/query/common.py +0 -0
  31. {pylode-3.3.3 → pylode-3.3.4}/pylode/profiles/supermodel/random.py +0 -0
  32. {pylode-3.3.3 → pylode-3.3.4}/pylode/profiles/supermodel/state.py +0 -0
  33. {pylode-3.3.3 → pylode-3.3.4}/pylode/profiles/vocpub.py +0 -0
  34. {pylode-3.3.3 → pylode-3.3.4}/pylode/rdf/dcterms-mod.ttl +0 -0
  35. {pylode-3.3.3 → pylode-3.3.4}/pylode/rdf/licenses.ttl +0 -0
  36. {pylode-3.3.3 → pylode-3.3.4}/pylode/rdf/ontdoc.ttl +0 -0
  37. {pylode-3.3.3 → pylode-3.3.4}/pylode/rdf/owl.ttl +0 -0
  38. {pylode-3.3.3 → pylode-3.3.4}/pylode/rdf/prov.ttl +0 -0
  39. {pylode-3.3.3 → pylode-3.3.4}/pylode/rdf/rdf.ttl +0 -0
  40. {pylode-3.3.3 → pylode-3.3.4}/pylode/rdf/rdfs-mod.ttl +0 -0
  41. {pylode-3.3.3 → pylode-3.3.4}/pylode/rdf/sdo-mod.ttl +0 -0
  42. {pylode-3.3.3 → pylode-3.3.4}/pylode/rdf/skos.ttl +0 -0
  43. {pylode-3.3.3 → pylode-3.3.4}/pylode/rdf/void.ttl +0 -0
  44. {pylode-3.3.3 → pylode-3.3.4}/pylode/static/asciidoc.css +0 -0
  45. {pylode-3.3.3 → pylode-3.3.4}/pylode/static/hierarchy.css +0 -0
  46. {pylode-3.3.3 → pylode-3.3.4}/pylode/static/hierarchy.js +0 -0
  47. {pylode-3.3.3 → pylode-3.3.4}/pylode/static/property-table-row.js +0 -0
  48. {pylode-3.3.3 → pylode-3.3.4}/pylode/static/pylode.css +0 -0
  49. {pylode-3.3.3 → pylode-3.3.4}/pylode/version.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pylode
3
- Version: 3.3.3
3
+ Version: 3.3.4
4
4
  Summary: An OWL ontology documentation tool using Python, based on LODE.
5
5
  Author: Nicholas Car
6
6
  Author-email: Nicholas Car <nick@kurrawong.ai>
@@ -17,11 +17,16 @@ Requires-Dist: markdown>=3.3.7,<4
17
17
  Requires-Dist: dominate>=2.6.0,<3
18
18
  Requires-Dist: html5lib>=1.1,<2
19
19
  Requires-Dist: httpx>=0.25.0,<1.0.0
20
+ Requires-Dist: tqdm>=4.67.3
21
+ Requires-Dist: bs4>=0.0.2 ; extra == 'server'
22
+ Requires-Dist: falcon>=4.2.0 ; extra == 'server'
23
+ Requires-Dist: validators>=0.35.0 ; extra == 'server'
20
24
  Requires-Python: >=3.9, <4
21
25
  Project-URL: Homepage, https://github.com/RDFLib/pyLODE
22
26
  Project-URL: Documentation, https://github.com/RDFLib/pyLODE
23
27
  Project-URL: Source, https://github.com/RDFLib/pyLODE
24
28
  Project-URL: Changelog, https://github.com/RDFLib/pyLODE/releases
29
+ Provides-Extra: server
25
30
  Description-Content-Type: text/markdown
26
31
 
27
32
  ![pyLODE logo](https://rawcdn.githack.com/RDFLib/pyLODE/master/img/pyLODE-250.png)
@@ -114,13 +119,13 @@ optional arguments:
114
119
 
115
120
  ### Basic Use
116
121
 
117
- **As a Python script**
122
+ #### As a Python script
118
123
 
119
124
  ```bash
120
125
  python pylode examples/ontpub/minimal.ttl -o minimal.html
121
126
  ```
122
127
 
123
- **As a Docker container**
128
+ #### As a Docker container
124
129
 
125
130
  ```bash
126
131
  docker build -t pylode:latest .
@@ -133,9 +138,71 @@ docker run --mount 'type=bind,src=<ttl_directory>,target=/app/pylode/data' \
133
138
 
134
139
  > Note: `<ttl_directory>` must be absolute
135
140
 
141
+ #### Via a stand-alone server
142
+
143
+ The pyLODE server uses the popular [Falcon framework](https://falconframework.org/) to implement a lightweight web api.
144
+
145
+ It can be run standalone as a single-thread, single process HTTP server, or more robustly as a WSGI application with
146
+ [GUnicorn](https://gunicorn.org/).
147
+
148
+ In all launch methods listed here, the server will be available at http://localhost:8000 for the landing page and http://localhost:8000/pylode for the active endpoint.
149
+
150
+ The active endpoint accepts the following querystring parameters:
151
+
152
+ * `url` for the absolute URL of the ontology document that you wish to render. The server hosting that ontology document must be capable of responding to Content Negotiation,
153
+ i.e. it must supply RDF according to an HTTP `Accept` request for `text/turtle`, `application/rdf+xml` etc.
154
+ * `profile` for the profile to use to generate HTML. Must be one of:
155
+ * `ontpub` (https://w3id.org/profile/ontpub) for ontologies. This is the default if no ``profile`` is provided.
156
+ * `vocpub` (https://w3id.org/profile/vocpub) for SKOS vocabularies
157
+ * `supermodel` for profiles of profiles
158
+ * `sort` to indicate whether subjects should be sorted in the rendered output. Must be one of:
159
+ * `true` to sort the subjects (this is the default)
160
+ * `false` to NOT sort the subjects
161
+
162
+ Here's an example of use with the [AGIF Ontology](https://linked.data.gov.au/def/agrif) using the source in this repository:
163
+
164
+ ```bash
165
+ http://localhost:8000/pylode?url=https://raw.githubusercontent.com/RDFLib/pyLODE/refs/heads/master/examples/ontpub/agrif.ttl
166
+ ```
167
+
168
+ The LODE responses generated by the server can be globally customised by setting the following optional environment variables:
169
+
170
+ * `CSS_URL` can be set to the absolute URL of a CSS stylesheet hosted elsewhere that should be referenced by pyLODE documents
171
+ * `FAVICON_URL` can be set to the absolute URL of a favicon image hosted elsewhere that should be referenced by pyLODE documents
172
+ * `FAVICON_MIME` should be set to the MIME type of the resource at ``FAVICON_URL`` if that has been configured (e.g. ``image/png`)
173
+ * `GTAGID` can be set to a Google Analytics Tag ID that you would like to use for tracking requests to your server.
174
+
175
+ **Launch the pyLODE server standalone from your local directory:**
176
+
177
+ You will need a few extra python modules installed locally:
178
+
179
+ ```
180
+ pip install bs4 falcon validators
181
+ ```
182
+
183
+ You can then run the pyLODE Server in standalone mode like this:
184
+
185
+ ```
186
+ python -m pylode.server
187
+ ```
188
+
189
+ **Build and run the docker image for the pyLODE Standalone Server:**
190
+
191
+ ```
192
+ docker build --target=pylode-server -t pylode-server:latest .
193
+ docker run --rm -p 8000:8000 pylode-server:latest
194
+ ```
195
+
196
+ **Build and run the docker image for the pyLODE GUnicorn Server:**
197
+
198
+ ```
199
+ docker build --target=pylode-gunicorn -t pylode-gunicorn:latest .
200
+ docker run --rm -p 8000:8000 pylode-gunicorn:latest
201
+ ```
202
+
136
203
  ### Module Use
137
204
 
138
- **For OWL**
205
+ #### For OWL
139
206
 
140
207
  ```python
141
208
  from pylode.profiles.ontpub import OntPub
@@ -145,7 +212,7 @@ html = od.make_html()
145
212
  od.make_html(destination="some-resulting-html-file.html")
146
213
  ```
147
214
 
148
- **For SKOS**
215
+ #### For SKOS
149
216
 
150
217
  ```python
151
218
  from pylode.profiles.vocpub import VocPub
@@ -229,20 +296,12 @@ python -m pytest tests --disable-warnings
229
296
 
230
297
  ## Releases
231
298
 
232
- **Current release:** **3.2.3**
299
+ Since version 3.0.1, we have moved to documenting releases in GitHub: https://github.com/RDFLib/pyLODE/releases
233
300
 
234
- ### Release Schedule
301
+ Older releasese
235
302
 
236
303
  | Version | Date | Description |
237
304
  |---------|------------------|---------------------------------------------------------------------------------|
238
- | 3.2.3 | 27 January 2026 | Updating dependencies & release procedure. Tidy testing cleanup |
239
- | 3.2.1 | 31 January 2025 | Fix version number in version.py |
240
- | 3.2.0 | 27 July 2024 | dependency updates and merged multiple small PRs |
241
- | 3.1.4 | 6 April 2024 | Fix load_ontology function's detection of data input |
242
- | 3.1.3 | 18 March 2024 | Relax rdflib version constraint |
243
- | 3.1.2 | 18 March 2024 | Relax httpx version constraint |
244
- | 3.1.1 | 19 February 2024 | Fix release |
245
- | 3.1.0 | 19 February 2024 | Add supermodel mode - supports documenting profiles and modules |
246
305
  | 3.0.5 | 27 April 2023 | Minor patching |
247
306
  | 3.0.4 | 24 May 2022 | Use of Poetry |
248
307
  | 3.0.2 | 24 May 2022 | Support for preformatted skos:example literals |
@@ -284,25 +343,20 @@ But the very best thing you could do is create a Pull Request for us to action!
284
343
  **Author:**
285
344
  Nicholas Car
286
345
  *Data Architect*
287
- [Kurrawong AI](https://kurrawong.ai)
346
+ [KurrawongAI](https://kurrawong.ai)
288
347
  <nick@kurrawong.ai>
289
348
 
290
349
  ## Release Procedure
291
350
 
292
351
  1. tidy code: `$ task format`
293
352
  2. pass all tests: `$ task test`
294
- 3. increment version number
295
- * in `pyproject.toml`
296
- * in README.md, 'Current Release' & 'Release Schedule'
353
+ 3. increment version number in `pyproject.toml`
297
354
  4. commit all changes `$ git commit -a "..."`
298
355
  5. tag with version number: `$git tag ...`
299
356
  6. push changes `$ git push`
300
357
  7. push version `git push --tags`
301
- 8. publish on PyPI:
302
- * `poetry build`
303
- * `poetry publish -u __token__ -p {TOKEN}`
304
- 9. make a GitHub release
305
- * include `/dist` build artefacts
306
- 10. increment version number to next release in `pyproject.toml`
307
- 11. commit all changes `$ git commit -a "..."`
308
- 12. push changes `$ git push`
358
+ 8make a GitHub release
359
+ * PyPI release is automated from this in `pypi.yml`
360
+ 9. increment version number to next release alpha in `pyproject.toml`
361
+ 10. commit all changes `$ git commit -a "..."`
362
+ 1push changes `$ git push`
@@ -88,13 +88,13 @@ optional arguments:
88
88
 
89
89
  ### Basic Use
90
90
 
91
- **As a Python script**
91
+ #### As a Python script
92
92
 
93
93
  ```bash
94
94
  python pylode examples/ontpub/minimal.ttl -o minimal.html
95
95
  ```
96
96
 
97
- **As a Docker container**
97
+ #### As a Docker container
98
98
 
99
99
  ```bash
100
100
  docker build -t pylode:latest .
@@ -107,9 +107,71 @@ docker run --mount 'type=bind,src=<ttl_directory>,target=/app/pylode/data' \
107
107
 
108
108
  > Note: `<ttl_directory>` must be absolute
109
109
 
110
+ #### Via a stand-alone server
111
+
112
+ The pyLODE server uses the popular [Falcon framework](https://falconframework.org/) to implement a lightweight web api.
113
+
114
+ It can be run standalone as a single-thread, single process HTTP server, or more robustly as a WSGI application with
115
+ [GUnicorn](https://gunicorn.org/).
116
+
117
+ In all launch methods listed here, the server will be available at http://localhost:8000 for the landing page and http://localhost:8000/pylode for the active endpoint.
118
+
119
+ The active endpoint accepts the following querystring parameters:
120
+
121
+ * `url` for the absolute URL of the ontology document that you wish to render. The server hosting that ontology document must be capable of responding to Content Negotiation,
122
+ i.e. it must supply RDF according to an HTTP `Accept` request for `text/turtle`, `application/rdf+xml` etc.
123
+ * `profile` for the profile to use to generate HTML. Must be one of:
124
+ * `ontpub` (https://w3id.org/profile/ontpub) for ontologies. This is the default if no ``profile`` is provided.
125
+ * `vocpub` (https://w3id.org/profile/vocpub) for SKOS vocabularies
126
+ * `supermodel` for profiles of profiles
127
+ * `sort` to indicate whether subjects should be sorted in the rendered output. Must be one of:
128
+ * `true` to sort the subjects (this is the default)
129
+ * `false` to NOT sort the subjects
130
+
131
+ Here's an example of use with the [AGIF Ontology](https://linked.data.gov.au/def/agrif) using the source in this repository:
132
+
133
+ ```bash
134
+ http://localhost:8000/pylode?url=https://raw.githubusercontent.com/RDFLib/pyLODE/refs/heads/master/examples/ontpub/agrif.ttl
135
+ ```
136
+
137
+ The LODE responses generated by the server can be globally customised by setting the following optional environment variables:
138
+
139
+ * `CSS_URL` can be set to the absolute URL of a CSS stylesheet hosted elsewhere that should be referenced by pyLODE documents
140
+ * `FAVICON_URL` can be set to the absolute URL of a favicon image hosted elsewhere that should be referenced by pyLODE documents
141
+ * `FAVICON_MIME` should be set to the MIME type of the resource at ``FAVICON_URL`` if that has been configured (e.g. ``image/png`)
142
+ * `GTAGID` can be set to a Google Analytics Tag ID that you would like to use for tracking requests to your server.
143
+
144
+ **Launch the pyLODE server standalone from your local directory:**
145
+
146
+ You will need a few extra python modules installed locally:
147
+
148
+ ```
149
+ pip install bs4 falcon validators
150
+ ```
151
+
152
+ You can then run the pyLODE Server in standalone mode like this:
153
+
154
+ ```
155
+ python -m pylode.server
156
+ ```
157
+
158
+ **Build and run the docker image for the pyLODE Standalone Server:**
159
+
160
+ ```
161
+ docker build --target=pylode-server -t pylode-server:latest .
162
+ docker run --rm -p 8000:8000 pylode-server:latest
163
+ ```
164
+
165
+ **Build and run the docker image for the pyLODE GUnicorn Server:**
166
+
167
+ ```
168
+ docker build --target=pylode-gunicorn -t pylode-gunicorn:latest .
169
+ docker run --rm -p 8000:8000 pylode-gunicorn:latest
170
+ ```
171
+
110
172
  ### Module Use
111
173
 
112
- **For OWL**
174
+ #### For OWL
113
175
 
114
176
  ```python
115
177
  from pylode.profiles.ontpub import OntPub
@@ -119,7 +181,7 @@ html = od.make_html()
119
181
  od.make_html(destination="some-resulting-html-file.html")
120
182
  ```
121
183
 
122
- **For SKOS**
184
+ #### For SKOS
123
185
 
124
186
  ```python
125
187
  from pylode.profiles.vocpub import VocPub
@@ -203,20 +265,12 @@ python -m pytest tests --disable-warnings
203
265
 
204
266
  ## Releases
205
267
 
206
- **Current release:** **3.2.3**
268
+ Since version 3.0.1, we have moved to documenting releases in GitHub: https://github.com/RDFLib/pyLODE/releases
207
269
 
208
- ### Release Schedule
270
+ Older releasese
209
271
 
210
272
  | Version | Date | Description |
211
273
  |---------|------------------|---------------------------------------------------------------------------------|
212
- | 3.2.3 | 27 January 2026 | Updating dependencies & release procedure. Tidy testing cleanup |
213
- | 3.2.1 | 31 January 2025 | Fix version number in version.py |
214
- | 3.2.0 | 27 July 2024 | dependency updates and merged multiple small PRs |
215
- | 3.1.4 | 6 April 2024 | Fix load_ontology function's detection of data input |
216
- | 3.1.3 | 18 March 2024 | Relax rdflib version constraint |
217
- | 3.1.2 | 18 March 2024 | Relax httpx version constraint |
218
- | 3.1.1 | 19 February 2024 | Fix release |
219
- | 3.1.0 | 19 February 2024 | Add supermodel mode - supports documenting profiles and modules |
220
274
  | 3.0.5 | 27 April 2023 | Minor patching |
221
275
  | 3.0.4 | 24 May 2022 | Use of Poetry |
222
276
  | 3.0.2 | 24 May 2022 | Support for preformatted skos:example literals |
@@ -258,25 +312,20 @@ But the very best thing you could do is create a Pull Request for us to action!
258
312
  **Author:**
259
313
  Nicholas Car
260
314
  *Data Architect*
261
- [Kurrawong AI](https://kurrawong.ai)
315
+ [KurrawongAI](https://kurrawong.ai)
262
316
  <nick@kurrawong.ai>
263
317
 
264
318
  ## Release Procedure
265
319
 
266
320
  1. tidy code: `$ task format`
267
321
  2. pass all tests: `$ task test`
268
- 3. increment version number
269
- * in `pyproject.toml`
270
- * in README.md, 'Current Release' & 'Release Schedule'
322
+ 3. increment version number in `pyproject.toml`
271
323
  4. commit all changes `$ git commit -a "..."`
272
324
  5. tag with version number: `$git tag ...`
273
325
  6. push changes `$ git push`
274
326
  7. push version `git push --tags`
275
- 8. publish on PyPI:
276
- * `poetry build`
277
- * `poetry publish -u __token__ -p {TOKEN}`
278
- 9. make a GitHub release
279
- * include `/dist` build artefacts
280
- 10. increment version number to next release in `pyproject.toml`
281
- 11. commit all changes `$ git commit -a "..."`
282
- 12. push changes `$ git push`
327
+ 8make a GitHub release
328
+ * PyPI release is automated from this in `pypi.yml`
329
+ 9. increment version number to next release alpha in `pyproject.toml`
330
+ 10. commit all changes `$ git commit -a "..."`
331
+ 1push changes `$ git push`
@@ -275,7 +275,7 @@ class OntPub:
275
275
  def _make_head(
276
276
  self, schema_org: Graph, include_css: bool = True, destination: Path = None
277
277
  ):
278
- """Healper function for make_html(). Makes <head>???</head> content"""
278
+ """Helper function for make_html(). Makes <head>???</head> content"""
279
279
  with self.doc.head:
280
280
  # use standard pyLODE stylesheet
281
281
  if include_css:
@@ -312,7 +312,7 @@ class OntPub:
312
312
  )
313
313
 
314
314
  def _make_body(self):
315
- """Healper function for make_html(). Makes <body>???</body> content.
315
+ """Helper function for make_html(). Makes <body>???</body> content.
316
316
 
317
317
  Just calls other helper functions in order"""
318
318
  make_pylode_logo(