Skip to content

Commit ba9912f

Browse files
Merge pull request #47 from CivicDataLab/dev
AImodel flow and Dataspace-sdk
2 parents 3845bdf + e3e1ce9 commit ba9912f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+7787
-8
lines changed

.github/workflows/publish-sdk.yml

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
name: Publish SDK to PyPI
2+
permissions:
3+
contents: write
4+
5+
on:
6+
workflow_dispatch:
7+
inputs:
8+
version:
9+
description: 'Version number (e.g., 0.1.0, 0.2.0)'
10+
required: true
11+
type: string
12+
release_notes:
13+
description: 'Release notes'
14+
required: false
15+
type: string
16+
default: 'Bug fixes and improvements'
17+
18+
jobs:
19+
publish:
20+
runs-on: ubuntu-latest
21+
22+
steps:
23+
- uses: actions/checkout@v3
24+
with:
25+
fetch-depth: 0
26+
27+
- name: Set up Python
28+
uses: actions/setup-python@v4
29+
with:
30+
python-version: '3.11'
31+
32+
- name: Install dependencies
33+
run: |
34+
python -m pip install --upgrade pip
35+
pip install build twine
36+
pip install -e ".[dev]"
37+
38+
- name: Update version in setup.py
39+
run: |
40+
sed -i "s/version=\".*\"/version=\"${{ inputs.version }}\"/" setup.py
41+
42+
- name: Update version in pyproject.toml
43+
run: |
44+
sed -i "s/version = \".*\"/version = \"${{ inputs.version }}\"/" pyproject.toml
45+
46+
- name: Run tests
47+
run: |
48+
# Run mypy
49+
mypy dataspace_sdk/ --ignore-missing-imports --config-file=/dev/null
50+
# Run pytest
51+
pytest tests/test_auth.py tests/test_base.py tests/test_client.py tests/test_datasets.py tests/test_aimodels.py tests/test_usecases.py tests/test_exceptions.py -v -p no:django -o addopts= --override-ini=django_find_project=false --noconftest --cov=dataspace_sdk --cov-report=term-missing
52+
53+
- name: Build package
54+
run: |
55+
python -m build
56+
57+
- name: Check package
58+
run: |
59+
twine check dist/*
60+
61+
- name: Publish to PyPI
62+
env:
63+
TWINE_USERNAME: __token__
64+
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
65+
run: |
66+
twine upload dist/*
67+
68+
- name: Commit version changes
69+
run: |
70+
git config --local user.email "github-actions[bot]@users.noreply.github.com"
71+
git config --local user.name "github-actions[bot]"
72+
git add setup.py pyproject.toml
73+
git commit -m "Bump version to ${{ inputs.version }}" || echo "No changes to commit"
74+
git push || echo "No changes to push"
75+
76+
- name: Create GitHub Release
77+
uses: actions/create-release@v1
78+
env:
79+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
80+
with:
81+
tag_name: v${{ inputs.version }}
82+
release_name: SDK v${{ inputs.version }}
83+
body: ${{ inputs.release_notes }}
84+
draft: false
85+
prerelease: false

.github/workflows/sdk-tests.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: SDK Tests
2+
3+
on:
4+
push:
5+
branches: [dev, main]
6+
pull_request:
7+
branches: [dev, main]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
strategy:
13+
matrix:
14+
python-version: ["3.9", "3.10", "3.11"]
15+
16+
steps:
17+
- uses: actions/checkout@v3
18+
19+
- name: Set up Python ${{ matrix.python-version }}
20+
uses: actions/setup-python@v4
21+
with:
22+
python-version: ${{ matrix.python-version }}
23+
24+
- name: Install dependencies
25+
run: |
26+
python -m pip install --upgrade pip
27+
pip install -e ".[dev]"
28+
29+
- name: Run type checking with mypy
30+
run: |
31+
mypy dataspace_sdk/ --ignore-missing-imports --config-file=/dev/null
32+
33+
- name: Run tests with pytest
34+
run: |
35+
pytest tests/test_auth.py tests/test_base.py tests/test_client.py tests/test_datasets.py tests/test_aimodels.py tests/test_usecases.py tests/test_exceptions.py -v -p no:django -o addopts= --override-ini=django_find_project=false --noconftest --cov=dataspace_sdk --cov-report=term-missing --cov-report=xml
36+
37+
- name: Upload coverage to Codecov
38+
uses: codecov/codecov-action@v3
39+
with:
40+
file: ./coverage.xml
41+
flags: unittests
42+
name: codecov-umbrella
43+
fail_ci_if_error: false

.gitignore

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,9 +147,11 @@ cython_debug/
147147
# IDE
148148
.vscode/
149149
.idea/
150+
.windsurf/
150151

151-
#Resources upload folder
152-
resources/
152+
#Resources upload folder (but not SDK resources)
153+
/resources/
154+
!/dataspace_sdk/resources/
153155

154156
#local env file
155157
.env
@@ -159,3 +161,10 @@ authorization/migrations/*
159161

160162
# AWS files
161163
aws/.env.*
164+
165+
#Public files
166+
files/public/*
167+
168+
#dvc files
169+
dvc
170+
dvc/*

.sdkignore

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# SDK-specific ignore file for distribution
2+
3+
# Python
4+
__pycache__/
5+
*.py[cod]
6+
*$py.class
7+
*.so
8+
.Python
9+
build/
10+
develop-eggs/
11+
dist/
12+
downloads/
13+
eggs/
14+
.eggs/
15+
lib/
16+
lib64/
17+
parts/
18+
sdist/
19+
var/
20+
wheels/
21+
*.egg-info/
22+
.installed.cfg
23+
*.egg
24+
25+
# Virtual environments
26+
venv/
27+
ENV/
28+
env/
29+
30+
# Testing
31+
.pytest_cache/
32+
.coverage
33+
htmlcov/
34+
35+
# IDE
36+
.vscode/
37+
.idea/
38+
*.swp
39+
*.swo
40+
*~
41+
42+
# OS
43+
.DS_Store
44+
Thumbs.db
45+
46+
# Django-specific (not needed for SDK)
47+
*.log
48+
db.sqlite3
49+
staticfiles/
50+
media/

CONTRIBUTING.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,35 +53,41 @@ Enhancement suggestions are tracked as GitHub issues. When creating an enhanceme
5353
### Local Development
5454

5555
1. Clone the repository:
56+
5657
```bash
5758
git clone https://github.com/CivicDataLab/DataSpaceBackend.git
5859
cd DataSpaceBackend
5960
```
6061

6162
2. Create a virtual environment:
63+
6264
```bash
6365
python -m venv venv
6466
source venv/bin/activate # On Windows: venv\Scripts\activate
6567
```
6668

6769
3. Install dependencies:
70+
6871
```bash
6972
pip install -r requirements.txt
7073
```
7174

7275
4. Set up environment variables:
76+
7377
```bash
7478
cp .env.example .env
7579
# Edit .env with your configuration
7680
```
7781

7882
5. Run migrations:
83+
7984
```bash
8085
python manage.py migrate
8186
python manage.py init_roles
8287
```
8388

8489
6. Start the development server:
90+
8591
```bash
8692
python manage.py runserver
8793
```
@@ -110,6 +116,7 @@ We use several tools to maintain code quality:
110116
- **mypy**: Type checking
111117

112118
Run these before committing:
119+
113120
```bash
114121
black .
115122
isort .

DataSpace/settings.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,7 @@
273273
ELASTICSEARCH_INDEX_NAMES = {
274274
"search.documents.dataset_document": "dataset",
275275
"search.documents.usecase_document": "usecase",
276+
"search.documents.aimodel_document": "aimodel",
276277
}
277278

278279

MANIFEST.in

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
include docs/sdk/README.md
2+
include docs/sdk/QUICKSTART.md
3+
include docs/sdk/DEVELOPMENT.md
4+
include LICENSE
5+
recursive-include dataspace_sdk *.py
6+
recursive-include examples *.py

0 commit comments

Comments
 (0)