|
6 | 6 |
|
7 | 7 | # osw |
8 | 8 |
|
9 | | -Python toolset for data processing, queries, wikicode generation and page manipulation within OpenSemanticLab. |
| 9 | +Python toolset for data processing, queries, wikicode generation and page |
| 10 | +manipulation within [OpenSemanticLab](https://github.com/OpenSemanticLab). |
10 | 11 |
|
11 | | -General features for object-oriented interaction with knowledge graphs are planned to be moved to a standalone package: |
12 | | -[oold-python](https://github.com/OO-LD/oold-python) |
| 12 | +Work with OpenSemanticLab instances the way you work with Python objects: |
| 13 | +load pages as typed pydantic entities, query with semantic search, generate |
| 14 | +models from the schemas stored in the wiki, and write changes back. |
13 | 15 |
|
14 | | -## Installation |
15 | | -``` |
16 | | -pip install osw |
17 | | -``` |
| 16 | +**Documentation: <https://opensemanticlab.github.io/osw-python/>** |
18 | 17 |
|
19 | | -### Variants |
20 | | -| Variant | Description | |
21 | | -| -- | -- | |
22 | | -`osw[wikitext]` | Additional functions in `wiki_tools` to transform mediawiki markup / templates |
23 | | -`osw[DB]` | interact with SQL databases per DatabaseController |
24 | | -`osw[S3]` | Interact with S3 Stores per S3FileController |
25 | | -`osw[dataimport]` | Additional tools to import data |
26 | | -`osw[UI]` | To use a helper UI to work with entity slots |
27 | | - |
28 | | -To install multiple optional/extra dependencies run |
29 | | -``` |
30 | | -pip install osw[opt1, opt2, ...] |
31 | | -``` |
32 | | - |
33 | | -To install all optional/extra dependencies run |
34 | | -``` |
35 | | -pip install osw[all] |
36 | | -``` |
37 | | - |
38 | | -## Getting started |
39 | | -You can find examples in the tutorial folder, e.g. [entity creation](https://github.com/OpenSemanticLab/osw-python/blob/main/examples/create_entity.py), [entity manipulaton](https://github.com/OpenSemanticLab/osw-python/blob/main/examples/store_entity.py), [querying](https://github.com/OpenSemanticLab/osw-python/blob/main/examples/query_minimal.py), and [file downloads](https://github.com/OpenSemanticLab/osw-python/blob/main/examples/file_download_minimal.py) |
40 | | - |
41 | | -## Troubleshooting |
| 18 | +## Installation |
42 | 19 |
|
43 | | -### `Error: datamodel-codegen not found` |
44 | | -make sure datamodel-codegen is installed and included in PATH, e. g. on jupyterlab: |
45 | | -``` |
46 | | -os.environ["PATH"] += os.pathsep + "/home/jovyan/.local/bin" |
| 20 | +```bash |
| 21 | +pip install osw |
47 | 22 | ``` |
48 | 23 |
|
49 | | -## Documentation |
50 | | - |
51 | | -https://opensemanticlab.github.io/osw-python/ |
| 24 | +Optional extras (`osw[wikitext]`, `osw[DB]`, `osw[S3]`, `osw[dataimport]`, |
| 25 | +`osw[UI]`, `osw[all]`) are described in the |
| 26 | +[Get Started guide](https://opensemanticlab.github.io/osw-python/get-started/). |
52 | 27 |
|
53 | | -### Tutorials |
| 28 | +## Quickstart |
54 | 29 |
|
55 | | -Tutorials can be found at [tutorials](docs/tutorials/) |
56 | | -- [Basics](docs/tutorials/basics.ipynb) - a description of the data model of OpenSemanticLab and how to interact with it |
| 30 | +```python |
| 31 | +from osw.express import OswExpress |
57 | 32 |
|
58 | | -## Development |
59 | | - |
60 | | -Dev install (requires [uv](https://docs.astral.sh/uv/)) |
61 | | - |
62 | | -```bash |
63 | | -make install |
| 33 | +osw = OswExpress(domain="wiki-dev.open-semantic-lab.org") |
| 34 | +instances = osw.site.semantic_search("[[Category:Item]]") |
| 35 | +print(instances) |
64 | 36 | ``` |
65 | 37 |
|
66 | | -Run code quality checks (pre-commit incl. ruff, ty, deptry) |
| 38 | +More runnable scripts live in [examples/](examples/), and the |
| 39 | +[Basics tutorial](docs/tutorials/basics.ipynb) walks through the |
| 40 | +OpenSemanticLab data model. |
67 | 41 |
|
68 | | -```bash |
69 | | -make check |
70 | | -``` |
| 42 | +## Contributing |
71 | 43 |
|
72 | | -Run tests (integration tests excluded by default) |
| 44 | +Contributions are welcome, see [CONTRIBUTING.md](CONTRIBUTING.md). |
| 45 | +Development setup, checks and tests are one command each: `make install`, |
| 46 | +`make check`, `make test`. |
73 | 47 |
|
74 | | -```bash |
75 | | -make test |
76 | | -``` |
| 48 | +## Related projects |
77 | 49 |
|
78 | | -Run integration tests (tests are skipped if login params are not provided) |
| 50 | +General features for object-oriented interaction with knowledge graphs live |
| 51 | +in the standalone package [oold-python](https://github.com/OO-LD/oold-python). |
79 | 52 |
|
80 | | -```bash |
81 | | -uv run pytest tests/integration -o addopts="" --wiki_domain "<osl-domain>" --wiki_username "<(bot)login>" --wiki_password "<password>" --db_username "<username>" --db_password "<password>" |
82 | | -``` |
| 53 | +## License |
83 | 54 |
|
84 | | -See [docs/dev.md](docs/dev.md) for details. |
| 55 | +AGPL-3.0-or-later, see [LICENSE.txt](LICENSE.txt). |
0 commit comments