Skip to content

Commit 519af6b

Browse files
authored
Merge pull request #457 from terminusdb/support-for-prefixes
Add prefix management
2 parents 9f69b3d + f9ee6af commit 519af6b

File tree

9 files changed

+2334
-733
lines changed

9 files changed

+2334
-733
lines changed

.github/insert_docs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,4 @@ def parameter_to_document(param):
5454
}
5555
]}
5656

57-
print(json.dumps(application))
57+
print(json.dumps(application, indent=2))

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@
22
/requirements-dev.txt
33
/requirements.txt
44

5-
# converage file
5+
# Generated documentation JSON
6+
docs.json
7+
8+
# coverage file
69
cov.xml
710

811
.venv

CONTRIBUTING.md

Lines changed: 101 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,46 @@
22

33
Thanks for interested to contribute to TerminusDB Client, to get started, fork this repo and follow the [instruction setting up dev environment](#setting-up-dev-environment-). If you don't have idea where to start, you can look for [`good first issue`](https://github.com/terminusdb/terminusdb-client-python/contribute) or [`help wanted`](https://github.com/terminusdb/terminusdb-client-python/issues?q=is:open+is:issue+label:"help+wanted") label at issues. All pull request should follow the [Pull Request Format Guideline](#pull-request-format-guideline-) and pull request (PR) that involving coding should come with [tests](#writing-tests-and-testing-) and [documentations](#writing-documentation-).
44

5+
## Quick Start (Python + Poetry) 🚀
6+
7+
If you have Python 3.9+ installed, here's the fastest way to get started:
8+
9+
```bash
10+
# 1. Clone the repository
11+
git clone https://github.com/terminusdb/terminusdb-client-python.git
12+
cd terminusdb-client-python
13+
14+
# 2. Create and activate a virtual environment with Python 3.9+
15+
python3.9 -m venv .venv # or python3.10, python3.11, python3.12
16+
source .venv/bin/activate # On Windows: .venv\Scripts\activate
17+
18+
# 3. Install Poetry (if not already installed)
19+
pip install poetry
20+
21+
# 4. Install dependencies and set up development environment
22+
poetry install --with dev
23+
24+
# 5. Install pre-commit hooks (optional, requires Python 3.10+)
25+
# If you have Python 3.10+, you can install pre-commit:
26+
# poetry add --group dev pre-commit && poetry run pre-commit install
27+
28+
# 6. Install the package in editable mode
29+
poetry run dev install-dev
30+
31+
# 7. Start TerminusDB server (for integration tests)
32+
docker run --pull always -d -p 127.0.0.1:6363:6363 -v terminusdb_storage:/app/terminusdb/storage --name terminusdb terminusdb/terminusdb-server:v12
33+
34+
# 8. Run tests to verify everything works
35+
poetry run dev test
36+
37+
# 9. Get help with available commands
38+
poetry run dev --help
39+
```
40+
41+
**Important**: This project requires Python 3.9 or higher. If you're using Python 3.8, please upgrade to Python 3.9+ before proceeding.
42+
43+
That's it! You're now ready to start contributing. See [Poetry Scripts Reference](#poetry-scripts-reference-) for all available commands.
44+
545
## Setting up dev environment 💻
646

747
Make sure you have Python>=3.9 and <3.13 installed.
@@ -57,35 +97,82 @@ For integration tests, you can either:
5797

5898
The test configuration will automatically detect and use an available server.
5999

60-
We use [shed](https://pypi.org/project/shed/) to lint our code. Although you can do it manually by running `shed`, we highly recommend setting up the pre-commit hook to do the linting automatically.
100+
**To run integration tests, Docker must be installed locally.**
61101

62-
To install the pre-commit hook:
102+
We use [shed](https://pypi.org/project/shed/) to lint our code. You can run it manually with `poetry run dev lint`, or set up a pre-commit hook (requires Python 3.10+):
63103

64-
`pre-commit install`
104+
```bash
105+
poetry add --group dev pre-commit
106+
poetry run pre-commit install
107+
```
65108

66109
## Writing tests and testing ✅
67110

68-
We are using [pytest](https://docs.pytest.org/en/latest/) for testing. All tests are stored in `/tests`
111+
We are using [pytest](https://docs.pytest.org/en/latest/) for testing. All tests are stored in `terminusdb_client/tests/`.
112+
113+
### Using Poetry Scripts (Recommended)
69114

70-
We also use tox to run tests in a virtual environment, we recommend running `tox` for the first time before you make any changes. This is to initialize the tox environments (or do it separately by `tox -e deps`) and make sure all tests pass initially.
115+
```bash
116+
# Format your code
117+
poetry run dev format
118+
119+
# Run linting (read-only, just checks)
120+
poetry run dev lint
121+
122+
# Run flake8 only
123+
poetry run dev flake8
71124

72-
To run the unittests without integration tests:
125+
# Fix linting issues automatically
126+
poetry run dev lint-fix
73127

74-
`pytest terminusdb_client/tests/ --ignore=terminusdb_client/tests/integration_tests/`
128+
# Run all tests
129+
poetry run dev test-all
75130

76-
To run all tests including integration tests:
131+
# Prepare your PR (runs format, lint, and all tests)
132+
poetry run dev pr
133+
```
77134

78-
`tox -e test`
135+
### Using tox (Alternative)
79136

80-
To run all checks and auto formatting:
137+
You can also use tox to run tests in an isolated environment:
81138

82-
`tox -e check`
139+
```bash
140+
# Run all tests
141+
tox -e test
83142

84-
To run all tests and checks:
143+
# Run all checks and auto formatting
144+
tox -e check
85145

86-
`tox`
146+
# Run everything
147+
tox
148+
```
87149

88-
**please make sure `tox` passes before making PR**
150+
**Please make sure all tests pass before making a PR.**
151+
152+
## Poetry Scripts Reference 📋
153+
154+
The project includes a `dev` script that provides the following commands:
155+
156+
| Command | Description |
157+
|--------|-------------|
158+
| `poetry run dev init-dev` | Initialize development environment |
159+
| `poetry run dev install-dev` | Install package in editable mode |
160+
| `poetry run dev format` | Format code with black and ruff |
161+
| `poetry run dev lint` | Run flake8 linting (read-only) |
162+
| `poetry run dev lint-fix` | Run linting and fix issues automatically |
163+
| `poetry run dev flake8` | Run flake8 linting only |
164+
| `poetry run dev ruff` | Run ruff linting only |
165+
| `poetry run dev check` | Run all static analysis checks |
166+
| `poetry run dev test` | Run unit tests |
167+
| `poetry run dev test-unit` | Run unit tests with coverage |
168+
| `poetry run dev test-integration` | Run integration tests |
169+
| `poetry run dev test-all` | Run all tests |
170+
| `poetry run dev docs` | Build documentation |
171+
| `poetry run dev tox` | Run tox for isolated testing |
172+
| `poetry run dev clean` | Clean build artifacts |
173+
| `poetry run dev pr` | Run all PR preparation checks |
174+
175+
Run `poetry run dev --help` to see all available commands.
89176

90177
## Writing Documentation 📖
91178

0 commit comments

Comments
 (0)