Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
104 changes: 104 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
name: CI

on:
push:
branches:
- main
pull_request:
paths:
- '.github/workflows/**'
- 'rdmo_client/**'
- 'testing/**'
- 'notebooks/**'
- '.pre-commit-config.yaml'
- 'pyproject.toml'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
PYTHONDONTWRITEBYTECODE: 1
FORCE_COLOR: 1

jobs:
lint:
uses: rdmorganiser/.github/.github/workflows/_lint.yml@main

build-wheel:
name: Build Python Wheel
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4

- name: Install uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
cache-dependency-glob: "pyproject.toml"

- name: Set up Python
run: uv python install

- name: Install dependencies
run: uv sync --all-extras --dev

- name: Build the wheel
run: uv build

- name: Check wheel metadata
run: uvx twine check --strict dist/*

- name: Install package from built wheel
run: uv pip install --no-compile dist/rdmo_client*.whl

- name: Write info to step summary
run: |
{
echo -e "# ✓ Wheel successfully built\n\n"
echo '<details><summary>Information about installed wheel</summary>'
echo -e "\n\`\`\`console"
echo "$ uv pip show --files --verbose rdmo_client"
uv pip show --files --verbose rdmo_client
echo -e "\`\`\`\n</details>"
} >> $GITHUB_STEP_SUMMARY

- name: Upload wheel as artifact
uses: actions/upload-artifact@v4
with:
name: wheel
path: dist/rdmo_client*.whl
if-no-files-found: error
retention-days: 30

dev-setup:
name: "Import rdmo_client on ${{ matrix.os }} with ${{ matrix.python-version }}"
needs: build-wheel
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version:
- "3.9"
- "3.12"
steps:
- uses: actions/checkout@v4

- name: Install uv
uses: astral-sh/setup-uv@v5
with:
python-version: ${{ matrix.python-version }}
enable-cache: true
cache-dependency-glob: "pyproject.toml"

- name: Download built wheel
uses: actions/download-artifact@v4
with:
name: wheel
path: dist

- name: Install package from built wheel
run: uv pip install --no-compile "$(ls dist/rdmo_client*none-any.whl)"

- name: Check version
run: uv run --no-project -- python -c "import rdmo_client; print(rdmo_client.__version__)"
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ env*
build
dist
*.egg-info
_version.py

.ipynb_checkpoints
test*
20 changes: 20 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
repos:
- repo: meta
hooks:
- id: check-hooks-apply
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: check-ast
- id: end-of-file-fixer
- id: trailing-whitespace
- id: debug-statements
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.9.7
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
- repo: https://github.com/crate-ci/typos
rev: v1.29.9
hooks:
- id: typos
9 changes: 5 additions & 4 deletions notebooks/conditions.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@
"metadata": {},
"outputs": [],
"source": [
"from rdmo_client import Client\n",
"\n",
"BASE_URL = 'http://localhost:8000'\n",
"AUTH = ('admin', 'admin')\n",
"TOKEN = '8bd704f41e0def27e0406e5ae8ec479ce575aa8f'\n",
"URI_PREFIX = 'https://rdmorganiser.github.io/terms/'\n",
"\n",
"from rdmo_client import Client\n",
"client = Client(BASE_URL, auth=AUTH)"
]
},
Expand All @@ -30,13 +31,13 @@
"metadata": {},
"outputs": [],
"source": [
"client.resolve_condition(13)"
"client.retrieve_condition(13)"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
Expand All @@ -50,7 +51,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.3"
"version": "3.13.1"
}
},
"nbformat": 4,
Expand Down
9 changes: 5 additions & 4 deletions notebooks/domain.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@
"metadata": {},
"outputs": [],
"source": [
"from rdmo_client import Client\n",
"\n",
"BASE_URL = 'http://localhost:8000'\n",
"AUTH = ('admin', 'admin')\n",
"TOKEN = '8bd704f41e0def27e0406e5ae8ec479ce575aa8f'\n",
"URI_PREFIX = 'https://rdmorganiser.github.io/terms/'\n",
"\n",
"from rdmo_client import Client\n",
"client = Client(BASE_URL, auth=AUTH)"
]
},
Expand All @@ -21,13 +22,13 @@
"metadata": {},
"outputs": [],
"source": [
"client.nest_attributes()"
"client.nest_attributes(1)"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
Expand All @@ -41,7 +42,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.3"
"version": "3.13.1"
}
},
"nbformat": 4,
Expand Down
21 changes: 11 additions & 10 deletions notebooks/options.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@
"metadata": {},
"outputs": [],
"source": [
"from rdmo_client import Client\n",
"\n",
"BASE_URL = 'http://localhost:8000'\n",
"AUTH = ('api', 'api')\n",
"TOKEN = '8bd704f41e0def27e0406e5ae8ec479ce575aa8f'\n",
"URI_PREFIX = 'https://rdmorganiser.github.io/terms/'\n",
"\n",
"from rdmo_client import Client\n",
"client = Client(BASE_URL, auth=AUTH)"
]
},
Expand Down Expand Up @@ -41,7 +42,7 @@
"source": [
"optionset = client.create_optionset({\n",
" 'uri_prefix': URI_PREFIX,\n",
" 'key': 'new',\n",
" 'uri_path': 'new',\n",
" 'order': 666,\n",
"})"
]
Expand All @@ -53,13 +54,13 @@
"outputs": [],
"source": [
"for i in range(5):\n",
" key = 'new-%.2i' % i\n",
" \n",
" uri_path = f'new-{i:02}'\n",
"\n",
" client.create_option({\n",
" 'uri_prefix': URI_PREFIX,\n",
" 'key': key,\n",
" 'uri_path': uri_path,\n",
" 'order': i,\n",
" 'optionset': optionset['id'] \n",
" 'optionset': optionset['id']\n",
" })"
]
},
Expand All @@ -71,8 +72,8 @@
"source": [
"for option in client.list_options(optionset=optionset['id']):\n",
" option.update({\n",
" 'text_en': option['key'] + '-en',\n",
" 'text_de': option['key'] + '-de'\n",
" 'text_en': option['uri_path'] + '-en',\n",
" 'text_de': option['uri_path'] + '-de'\n",
" })\n",
" client.update_option(option['id'], option)"
]
Expand All @@ -89,7 +90,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
Expand All @@ -103,7 +104,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.3"
"version": "3.13.1"
}
},
"nbformat": 4,
Expand Down
8 changes: 5 additions & 3 deletions notebooks/projects.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@
"metadata": {},
"outputs": [],
"source": [
"from rdmo_client import Client\n",
"\n",
"BASE_URL = 'http://localhost:8000'\n",
"AUTH = ('api', 'api')\n",
"TOKEN = '8bd704f41e0def27e0406e5ae8ec479ce575aa8f'\n",
"URI_PREFIX = 'https://rdmorganiser.github.io/terms/'\n",
"\n",
"from rdmo_client import Client\n",
"client = Client(BASE_URL, auth=AUTH)"
]
},
Expand Down Expand Up @@ -68,14 +69,15 @@
"source": [
"client.create_project({\n",
" 'user': 1,\n",
" 'catalog': 1,\n",
" 'title': 'FOO'\n",
"})"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
Expand All @@ -89,7 +91,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.3"
"version": "3.13.1"
}
},
"nbformat": 4,
Expand Down
7 changes: 4 additions & 3 deletions notebooks/questions.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@
"metadata": {},
"outputs": [],
"source": [
"from rdmo_client import Client\n",
"\n",
"BASE_URL = 'http://localhost:8000'\n",
"AUTH = ('admin', 'admin')\n",
"TOKEN = '8bd704f41e0def27e0406e5ae8ec479ce575aa8f'\n",
"URI_PREFIX = 'https://rdmorganiser.github.io/terms/'\n",
"\n",
"from rdmo_client import Client\n",
"client = Client(BASE_URL, auth=AUTH)"
]
},
Expand Down Expand Up @@ -54,7 +55,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
Expand All @@ -68,7 +69,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.3"
"version": "3.13.1"
}
},
"nbformat": 4,
Expand Down
7 changes: 4 additions & 3 deletions notebooks/tasks.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@
"metadata": {},
"outputs": [],
"source": [
"from rdmo_client import Client\n",
"\n",
"BASE_URL = 'http://localhost:8000'\n",
"AUTH = ('admin', 'admin')\n",
"TOKEN = '8bd704f41e0def27e0406e5ae8ec479ce575aa8f'\n",
"URI_PREFIX = 'https://rdmorganiser.github.io/terms/'\n",
"\n",
"from rdmo_client import Client\n",
"client = Client(BASE_URL, auth=AUTH)"
]
},
Expand All @@ -27,7 +28,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
Expand All @@ -41,7 +42,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.3"
"version": "3.13.1"
}
},
"nbformat": 4,
Expand Down
Loading
Loading