functional-owl 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.
- functional_owl-0.1.0/LICENSE +21 -0
- functional_owl-0.1.0/PKG-INFO +373 -0
- functional_owl-0.1.0/README.md +331 -0
- functional_owl-0.1.0/pyproject.toml +254 -0
- functional_owl-0.1.0/src/functional_owl/.DS_Store +0 -0
- functional_owl-0.1.0/src/functional_owl/__init__.py +189 -0
- functional_owl-0.1.0/src/functional_owl/dsl.py +2581 -0
- functional_owl-0.1.0/src/functional_owl/macros.py +426 -0
- functional_owl-0.1.0/src/functional_owl/ontology.py +271 -0
- functional_owl-0.1.0/src/functional_owl/py.typed +1 -0
- functional_owl-0.1.0/src/functional_owl/utils.py +127 -0
- functional_owl-0.1.0/src/functional_owl/version.py +39 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Charles Tapley Hoyt
|
|
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.
|
|
@@ -0,0 +1,373 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: functional-owl
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: An implementation of the Functional OWL (OFN) object model
|
|
5
|
+
Keywords: snekpack,cookiecutter
|
|
6
|
+
Author: Charles Tapley Hoyt
|
|
7
|
+
Author-email: Charles Tapley Hoyt <cthoyt@gmail.com>
|
|
8
|
+
License-Expression: MIT
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Classifier: Development Status :: 1 - Planning
|
|
11
|
+
Classifier: Environment :: Console
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Operating System :: OS Independent
|
|
14
|
+
Classifier: Framework :: Pytest
|
|
15
|
+
Classifier: Framework :: Sphinx
|
|
16
|
+
Classifier: Natural Language :: English
|
|
17
|
+
Classifier: Programming Language :: Python
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
23
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
24
|
+
Classifier: Typing :: Typed
|
|
25
|
+
Requires-Dist: curies
|
|
26
|
+
Requires-Dist: rdflib
|
|
27
|
+
Requires-Dist: bioregistry
|
|
28
|
+
Requires-Dist: pystow
|
|
29
|
+
Requires-Dist: robot-obo-tool ; extra == 'oracle'
|
|
30
|
+
Requires-Dist: bioregistry ; extra == 'standardize'
|
|
31
|
+
Maintainer: Charles Tapley Hoyt
|
|
32
|
+
Maintainer-email: Charles Tapley Hoyt <cthoyt@gmail.com>
|
|
33
|
+
Requires-Python: >=3.10
|
|
34
|
+
Project-URL: Bug Tracker, https://github.com/cthoyt/functional-owl/issues
|
|
35
|
+
Project-URL: Homepage, https://github.com/cthoyt/functional-owl
|
|
36
|
+
Project-URL: Repository, https://github.com/cthoyt/functional-owl.git
|
|
37
|
+
Project-URL: Documentation, https://functional_owl.readthedocs.io
|
|
38
|
+
Project-URL: Funding, https://github.com/sponsors/cthoyt
|
|
39
|
+
Provides-Extra: oracle
|
|
40
|
+
Provides-Extra: standardize
|
|
41
|
+
Description-Content-Type: text/markdown
|
|
42
|
+
|
|
43
|
+
<!--
|
|
44
|
+
<p align="center">
|
|
45
|
+
<img src="https://github.com/cthoyt/functional-owl/raw/main/docs/source/logo.png" height="150">
|
|
46
|
+
</p>
|
|
47
|
+
-->
|
|
48
|
+
|
|
49
|
+
<h1 align="center">
|
|
50
|
+
Functional OWL
|
|
51
|
+
</h1>
|
|
52
|
+
|
|
53
|
+
<p align="center">
|
|
54
|
+
<a href="https://github.com/cthoyt/functional-owl/actions/workflows/tests.yml">
|
|
55
|
+
<img alt="Tests" src="https://github.com/cthoyt/functional-owl/actions/workflows/tests.yml/badge.svg" /></a>
|
|
56
|
+
<a href="https://pypi.org/project/functional-owl">
|
|
57
|
+
<img alt="PyPI" src="https://img.shields.io/pypi/v/functional-owl" /></a>
|
|
58
|
+
<a href="https://pypi.org/project/functional-owl">
|
|
59
|
+
<img alt="PyPI - Python Version" src="https://img.shields.io/pypi/pyversions/functional-owl" /></a>
|
|
60
|
+
<a href="https://github.com/cthoyt/functional-owl/blob/main/LICENSE">
|
|
61
|
+
<img alt="PyPI - License" src="https://img.shields.io/pypi/l/functional-owl" /></a>
|
|
62
|
+
<a href='https://functional_owl.readthedocs.io/en/latest/?badge=latest'>
|
|
63
|
+
<img src='https://readthedocs.org/projects/functional_owl/badge/?version=latest' alt='Documentation Status' /></a>
|
|
64
|
+
<a href="https://codecov.io/gh/cthoyt/functional-owl/branch/main">
|
|
65
|
+
<img src="https://codecov.io/gh/cthoyt/functional-owl/branch/main/graph/badge.svg" alt="Codecov status" /></a>
|
|
66
|
+
<a href="https://github.com/cthoyt/cookiecutter-python-package">
|
|
67
|
+
<img alt="Cookiecutter template from @cthoyt" src="https://img.shields.io/badge/Cookiecutter-snekpack-blue" /></a>
|
|
68
|
+
<a href="https://github.com/astral-sh/ruff">
|
|
69
|
+
<img src="https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json" alt="Ruff" style="max-width:100%;"></a>
|
|
70
|
+
<a href="https://github.com/cthoyt/functional-owl/blob/main/.github/CODE_OF_CONDUCT.md">
|
|
71
|
+
<img src="https://img.shields.io/badge/Contributor%20Covenant-2.1-4baaaa.svg" alt="Contributor Covenant"/></a>
|
|
72
|
+
<!-- uncomment if you archive on zenodo
|
|
73
|
+
<a href="https://doi.org/10.5281/zenodo.XXXXXX">
|
|
74
|
+
<img src="https://zenodo.org/badge/DOI/10.5281/zenodo.XXXXXX.svg" alt="DOI"></a>
|
|
75
|
+
-->
|
|
76
|
+
</p>
|
|
77
|
+
|
|
78
|
+
An implementation of the
|
|
79
|
+
[Functional OWL (OFN)](https://www.w3.org/TR/owl2-syntax/) object model.
|
|
80
|
+
|
|
81
|
+
This code was originally part of [PyOBO](https://github.com/biopragmatics/pyobo)
|
|
82
|
+
but split out for more reusability. Partially inspired by
|
|
83
|
+
https://github.com/Harold-Solbrig/funowl.
|
|
84
|
+
|
|
85
|
+
## 💪 Getting Started
|
|
86
|
+
|
|
87
|
+
```python-console
|
|
88
|
+
>>> from functional_owl import RelationshipMacro
|
|
89
|
+
>>> RelationshipMacro("hgnc:16793", "RO:0002160", "NCBITaxon:9606").to_funowl()
|
|
90
|
+
'SubClassOf(hgnc:16793 ObjectSomeValuesFrom(RO:0002160 NCBITaxon:9606))'
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## 🚀 Installation
|
|
94
|
+
|
|
95
|
+
<!-- Uncomment this section after your first ``just finish``
|
|
96
|
+
The most recent release can be installed from
|
|
97
|
+
[PyPI](https://pypi.org/project/functional-owl/) with uv:
|
|
98
|
+
|
|
99
|
+
```console
|
|
100
|
+
$ uv pip install functional-owl
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
or with pip:
|
|
104
|
+
|
|
105
|
+
```console
|
|
106
|
+
$ python3 -m pip install functional-owl
|
|
107
|
+
```
|
|
108
|
+
-->
|
|
109
|
+
|
|
110
|
+
The most recent code and data can be installed directly from GitHub with uv:
|
|
111
|
+
|
|
112
|
+
```console
|
|
113
|
+
$ uv pip install git+https://github.com/cthoyt/functional-owl.git
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
or with pip:
|
|
117
|
+
|
|
118
|
+
```console
|
|
119
|
+
$ python3 -m pip install git+https://github.com/cthoyt/functional-owl.git
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
## 👐 Contributing
|
|
123
|
+
|
|
124
|
+
Contributions, whether filing an issue, making a pull request, or forking, are
|
|
125
|
+
appreciated. See
|
|
126
|
+
[CONTRIBUTING.md](https://github.com/cthoyt/functional-owl/blob/main/.github/CONTRIBUTING.md)
|
|
127
|
+
for more information on getting involved.
|
|
128
|
+
|
|
129
|
+
## 👋 Attribution
|
|
130
|
+
|
|
131
|
+
### ⚖️ License
|
|
132
|
+
|
|
133
|
+
The code in this package is licensed under the MIT License.
|
|
134
|
+
|
|
135
|
+
<!--
|
|
136
|
+
### 📖 Citation
|
|
137
|
+
|
|
138
|
+
Citation goes here!
|
|
139
|
+
-->
|
|
140
|
+
|
|
141
|
+
<!--
|
|
142
|
+
### 🎁 Support
|
|
143
|
+
|
|
144
|
+
This project has been supported by the following organizations (in alphabetical order):
|
|
145
|
+
|
|
146
|
+
- [Biopragmatics Lab](https://biopragmatics.github.io)
|
|
147
|
+
|
|
148
|
+
-->
|
|
149
|
+
|
|
150
|
+
<!--
|
|
151
|
+
### 💰 Funding
|
|
152
|
+
|
|
153
|
+
This project has been supported by the following grants:
|
|
154
|
+
|
|
155
|
+
| Funding Body | Program | Grant Number |
|
|
156
|
+
|---------------|--------------------------------------------------------------|--------------|
|
|
157
|
+
| Funder | [Grant Name (GRANT-ACRONYM)](https://example.com/grant-link) | ABCXYZ |
|
|
158
|
+
-->
|
|
159
|
+
|
|
160
|
+
### 🍪 Cookiecutter
|
|
161
|
+
|
|
162
|
+
This package was created with
|
|
163
|
+
[@audreyfeldroy](https://github.com/audreyfeldroy)'s
|
|
164
|
+
[cookiecutter](https://github.com/cookiecutter/cookiecutter) package using
|
|
165
|
+
[@cthoyt](https://github.com/cthoyt)'s
|
|
166
|
+
[cookiecutter-snekpack](https://github.com/cthoyt/cookiecutter-snekpack)
|
|
167
|
+
template.
|
|
168
|
+
|
|
169
|
+
## 🛠️ For Developers
|
|
170
|
+
|
|
171
|
+
<details>
|
|
172
|
+
<summary>See developer instructions</summary>
|
|
173
|
+
|
|
174
|
+
The final section of the README is for if you want to get involved by making a
|
|
175
|
+
code contribution.
|
|
176
|
+
|
|
177
|
+
### Development Installation
|
|
178
|
+
|
|
179
|
+
To install in development mode, use the following:
|
|
180
|
+
|
|
181
|
+
```console
|
|
182
|
+
$ git clone git+https://github.com/cthoyt/functional-owl.git
|
|
183
|
+
$ cd functional-owl
|
|
184
|
+
$ uv pip install -e .
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
Alternatively, install using pip:
|
|
188
|
+
|
|
189
|
+
```console
|
|
190
|
+
$ python3 -m pip install -e .
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
### Pre-commit
|
|
194
|
+
|
|
195
|
+
You can optionally use [pre-commit](https://pre-commit.com) to automate running
|
|
196
|
+
key code quality checks on each commit. Enable it with:
|
|
197
|
+
|
|
198
|
+
```console
|
|
199
|
+
$ uvx pre-commit install
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
Or using `pip`:
|
|
203
|
+
|
|
204
|
+
```console
|
|
205
|
+
$ pip install pre-commit
|
|
206
|
+
$ pre-commit install
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
### 🥼 Testing
|
|
210
|
+
|
|
211
|
+
After cloning the repository and installing `just` with
|
|
212
|
+
`uv tool install rust-just` or `python3 -m pip install rust-just`, the unit
|
|
213
|
+
tests in the `tests/` folder can be run reproducibly with:
|
|
214
|
+
|
|
215
|
+
```console
|
|
216
|
+
$ just test
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
Additionally, these tests are automatically re-run with each commit in a
|
|
220
|
+
[GitHub Action](https://github.com/cthoyt/functional-owl/actions?query=workflow%3ATests).
|
|
221
|
+
|
|
222
|
+
### 📖 Building the Documentation
|
|
223
|
+
|
|
224
|
+
The documentation can be built locally using the following:
|
|
225
|
+
|
|
226
|
+
```console
|
|
227
|
+
$ git clone git+https://github.com/cthoyt/functional-owl.git
|
|
228
|
+
$ cd functional-owl
|
|
229
|
+
$ just docs
|
|
230
|
+
$ open docs/build/html/index.html
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
The documentation automatically installs the package as well as the `docs` extra
|
|
234
|
+
specified in the [`pyproject.toml`](pyproject.toml). `sphinx` plugins like
|
|
235
|
+
`texext` can be added there. Additionally, they need to be added to the
|
|
236
|
+
`extensions` list in [`docs/source/conf.py`](docs/source/conf.py).
|
|
237
|
+
|
|
238
|
+
The documentation can be deployed to [ReadTheDocs](https://readthedocs.io) using
|
|
239
|
+
[this guide](https://docs.readthedocs.io/en/stable/intro/import-guide.html). The
|
|
240
|
+
[`.readthedocs.yml`](.readthedocs.yml) YAML file contains all the configuration
|
|
241
|
+
you'll need. You can also set up continuous integration on GitHub to check not
|
|
242
|
+
only that Sphinx can build the documentation in an isolated environment (i.e.,
|
|
243
|
+
with `just docs-test`) but also that
|
|
244
|
+
[ReadTheDocs can build it too](https://docs.readthedocs.io/en/stable/pull-requests.html).
|
|
245
|
+
|
|
246
|
+
</details>
|
|
247
|
+
|
|
248
|
+
## 🧑💻 For Maintainers
|
|
249
|
+
|
|
250
|
+
<details>
|
|
251
|
+
<summary>See maintainer instructions</summary>
|
|
252
|
+
|
|
253
|
+
### Initial Configuration
|
|
254
|
+
|
|
255
|
+
#### Configuring ReadTheDocs
|
|
256
|
+
|
|
257
|
+
[ReadTheDocs](https://readthedocs.org) is an external documentation hosting
|
|
258
|
+
service that integrates with GitHub's CI/CD. Do the following for each
|
|
259
|
+
repository:
|
|
260
|
+
|
|
261
|
+
1. Log in to ReadTheDocs with your GitHub account to install the integration at
|
|
262
|
+
https://readthedocs.org/accounts/login/?next=/dashboard/
|
|
263
|
+
2. Import your project by navigating to https://readthedocs.org/dashboard/import
|
|
264
|
+
then clicking the plus icon next to your repository
|
|
265
|
+
3. You can rename the repository on the next screen using a more stylized name
|
|
266
|
+
(i.e., with spaces and capital letters)
|
|
267
|
+
4. Click next, and you're good to go!
|
|
268
|
+
|
|
269
|
+
#### Configuring Archival on Zenodo
|
|
270
|
+
|
|
271
|
+
[Zenodo](https://zenodo.org) is a long-term archival system that assigns a DOI
|
|
272
|
+
to each release of your package. Do the following for each repository:
|
|
273
|
+
|
|
274
|
+
1. Log in to Zenodo via GitHub with this link:
|
|
275
|
+
https://zenodo.org/oauth/login/github/?next=%2F. This brings you to a page
|
|
276
|
+
that lists all of your organizations and asks you to approve installing the
|
|
277
|
+
Zenodo app on GitHub. Click "grant" next to any organizations you want to
|
|
278
|
+
enable the integration for, then click the big green "approve" button. This
|
|
279
|
+
step only needs to be done once.
|
|
280
|
+
2. Navigate to https://zenodo.org/account/settings/github/, which lists all of
|
|
281
|
+
your GitHub repositories (both in your username and any organizations you
|
|
282
|
+
enabled). Click the on/off toggle for any relevant repositories. When you
|
|
283
|
+
make a new repository, you'll have to come back to this
|
|
284
|
+
|
|
285
|
+
After these steps, you're ready to go! After you make "release" on GitHub (steps
|
|
286
|
+
for this are below), you can navigate to
|
|
287
|
+
https://zenodo.org/account/settings/github/repository/cthoyt/functional-owl to
|
|
288
|
+
see the DOI for the release and link to the Zenodo record for it.
|
|
289
|
+
|
|
290
|
+
#### Registering with the Python Package Index (PyPI)
|
|
291
|
+
|
|
292
|
+
The [Python Package Index (PyPI)](https://pypi.org) hosts packages so they can
|
|
293
|
+
be easily installed with `pip`, `uv`, and equivalent tools.
|
|
294
|
+
|
|
295
|
+
1. Register for an account [here](https://pypi.org/account/register)
|
|
296
|
+
2. Navigate to https://pypi.org/manage/account and make sure you have verified
|
|
297
|
+
your email address. A verification email might not have been sent by default,
|
|
298
|
+
so you might have to click the "options" dropdown next to your address to get
|
|
299
|
+
to the "re-send verification email" button
|
|
300
|
+
3. 2-Factor authentication is required for PyPI since the end of 2023 (see this
|
|
301
|
+
[blog post from PyPI](https://blog.pypi.org/posts/2023-05-25-securing-pypi-with-2fa/)).
|
|
302
|
+
This means you have to first issue account recovery codes, then set up
|
|
303
|
+
2-factor authentication
|
|
304
|
+
4. Issue an API token from https://pypi.org/manage/account/token
|
|
305
|
+
|
|
306
|
+
This only needs to be done once per developer.
|
|
307
|
+
|
|
308
|
+
#### Configuring your machine's connection to PyPI
|
|
309
|
+
|
|
310
|
+
This needs to be done once per machine.
|
|
311
|
+
|
|
312
|
+
```console
|
|
313
|
+
$ uv tool install keyring
|
|
314
|
+
$ keyring set https://upload.pypi.org/legacy/ __token__
|
|
315
|
+
$ keyring set https://test.pypi.org/legacy/ __token__
|
|
316
|
+
```
|
|
317
|
+
|
|
318
|
+
Note that this deprecates previous workflows using `.pypirc`.
|
|
319
|
+
|
|
320
|
+
### 📦 Making a Release
|
|
321
|
+
|
|
322
|
+
#### Uploading to PyPI
|
|
323
|
+
|
|
324
|
+
After installing the package in development mode and installing `just` with
|
|
325
|
+
`uv tool install rust-just` or `python3 -m pip install rust-just`, run the
|
|
326
|
+
following from the console:
|
|
327
|
+
|
|
328
|
+
```console
|
|
329
|
+
$ just finish
|
|
330
|
+
```
|
|
331
|
+
|
|
332
|
+
This script does the following:
|
|
333
|
+
|
|
334
|
+
1. Uses [bump-my-version](https://github.com/callowayproject/bump-my-version) to
|
|
335
|
+
switch the version number in the `pyproject.toml`,
|
|
336
|
+
`src/functional_owl/version.py`, and
|
|
337
|
+
[`docs/source/conf.py`](docs/source/conf.py) to not have the `-dev` suffix
|
|
338
|
+
2. Packages the code in both a tar archive and a wheel using
|
|
339
|
+
[`uv build`](https://docs.astral.sh/uv/guides/publish/#building-your-package)
|
|
340
|
+
3. Uploads to PyPI using
|
|
341
|
+
[`uv publish`](https://docs.astral.sh/uv/guides/publish/#publishing-your-package).
|
|
342
|
+
4. Push to GitHub. You'll need to make a release going with the commit where the
|
|
343
|
+
version was bumped.
|
|
344
|
+
5. Bump the version to the next patch. If you made big changes and want to bump
|
|
345
|
+
the version by minor, you can use `tox -e bumpversion -- minor` after.
|
|
346
|
+
|
|
347
|
+
#### Releasing on GitHub
|
|
348
|
+
|
|
349
|
+
1. Navigate to https://github.com/cthoyt/functional-owl/releases/new to draft a
|
|
350
|
+
new release
|
|
351
|
+
2. Click the "Choose a Tag" dropdown and select the tag corresponding to the
|
|
352
|
+
release you just made
|
|
353
|
+
3. Click the "Generate Release Notes" button to get a quick outline of recent
|
|
354
|
+
changes. Modify the title and description as you see fit
|
|
355
|
+
4. Click the big green "Publish Release" button
|
|
356
|
+
|
|
357
|
+
This will trigger Zenodo to assign a DOI to your release as well.
|
|
358
|
+
|
|
359
|
+
### Updating Package Boilerplate
|
|
360
|
+
|
|
361
|
+
This project uses `cruft` to keep boilerplate (i.e., configuration, contribution
|
|
362
|
+
guidelines, documentation configuration) up-to-date with the upstream
|
|
363
|
+
cookiecutter package. Install cruft with either `uv tool install cruft` or
|
|
364
|
+
`python3 -m pip install cruft` then run:
|
|
365
|
+
|
|
366
|
+
```console
|
|
367
|
+
$ cruft update
|
|
368
|
+
```
|
|
369
|
+
|
|
370
|
+
More info on Cruft's update command is available
|
|
371
|
+
[here](https://github.com/cruft/cruft?tab=readme-ov-file#updating-a-project).
|
|
372
|
+
|
|
373
|
+
</details>
|