Skip to content

Commit 40a856f

Browse files
committed
Migrate project and CI to standard uv workflow
1 parent 0914f53 commit 40a856f

10 files changed

Lines changed: 3412 additions & 88 deletions

File tree

.github/workflows/deploy_documentation.yml

Lines changed: 9 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ name: Deploy Documentation
44
on:
55
workflow_dispatch:
66
push:
7-
branches: [ main ]
7+
branches: [main]
88

99
paths:
1010
- 'src/docs/*'
@@ -22,38 +22,26 @@ jobs:
2222
# check-out repo and set-up python
2323
#----------------------------------------------
2424
- name: Check out repository
25-
uses: actions/checkout@v3
25+
uses: actions/checkout@v4
2626
with:
2727
# persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal token
2828
fetch-depth: 0 # otherwise, you will failed to push refs to dest repo
2929

30-
- name: Set up Python3
31-
uses: actions/setup-python@v5
32-
with:
33-
python-version: '3.11'
34-
3530
#----------------------------------------------
3631
# install uv
3732
#----------------------------------------------
3833
- name: Install uv
39-
uses: astral-sh/setup-uv@v5
34+
uses: astral-sh/setup-uv@v6
4035
with:
36+
python-version: "3.11"
4137
enable-cache: true
38+
cache-dependency-glob: "uv.lock"
4239

4340
#----------------------------------------------
44-
# create env and install deps
41+
# install project dependencies
4542
#----------------------------------------------
4643
- name: Install dependencies
47-
run: |
48-
uv venv
49-
uv pip install . \
50-
mkdocs \
51-
"linkml>=1.7.4" \
52-
mkdocs-mermaid2-plugin \
53-
jupyter \
54-
ipython-sql \
55-
tox \
56-
black
44+
run: uv sync --dev --locked --no-progress
5745

5846
#----------------------------------------------
5947
# Create documentation and deploy.
@@ -63,5 +51,5 @@ jobs:
6351
mkdir docs
6452
touch docs/.nojekyll
6553
cp -r src/docs/* docs/
66-
make RUN="uv run" gendoc
67-
make RUN="uv run" mkd-gh-deploy
54+
make gendoc
55+
make mkd-gh-deploy

.github/workflows/main.yaml

Lines changed: 13 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2,38 +2,34 @@ name: Build and test
22

33
on:
44
push:
5-
branches: [ main ]
5+
branches: [main]
66
pull_request:
7-
branches: [ main ]
7+
branches: [main]
88

99
jobs:
1010
lint:
1111
runs-on: ubuntu-latest
1212
strategy:
1313
matrix:
14-
python-version: [ '3.11' ]
14+
python-version: ["3.11"]
1515
steps:
1616
- uses: actions/checkout@v4
17-
- name: Set up Python ${{ matrix.python-version }}
18-
uses: actions/setup-python@v5
19-
with:
20-
python-version: ${{ matrix.python-version }}
2117
- name: Install uv
22-
uses: astral-sh/setup-uv@v5
18+
uses: astral-sh/setup-uv@v6
2319
with:
20+
python-version: ${{ matrix.python-version }}
2421
enable-cache: true
25-
- name: Create virtual environment
26-
run: uv venv
27-
- name: Install lint dependencies
28-
run: uv pip install tox
22+
cache-dependency-glob: "uv.lock"
23+
- name: Install dependencies
24+
run: uv sync --dev --locked
2925
- name: Check code quality with flake8
3026
run: uv run tox -e flake8
3127

3228
test:
3329
runs-on: ubuntu-latest
3430
strategy:
3531
matrix:
36-
python-version: [ '3.11' ]
32+
python-version: ["3.11"]
3733

3834
steps:
3935

@@ -43,30 +39,21 @@ jobs:
4339
- name: Check out repository
4440
uses: actions/checkout@v4
4541

46-
- name: Set up Python ${{ matrix.python-version }}
47-
uses: actions/setup-python@v5
48-
with:
49-
python-version: ${{ matrix.python-version }}
50-
5142
#----------------------------------------------
5243
# install uv
5344
#----------------------------------------------
5445
- name: Install uv
55-
uses: astral-sh/setup-uv@v5
46+
uses: astral-sh/setup-uv@v6
5647
with:
48+
python-version: ${{ matrix.python-version }}
5749
enable-cache: true
58-
59-
#----------------------------------------------
60-
# create virtualenv
61-
#----------------------------------------------
62-
- name: Create virtual environment
63-
run: uv venv
50+
cache-dependency-glob: "uv.lock"
6451

6552
#----------------------------------------------
6653
# install dependencies
6754
#----------------------------------------------
6855
- name: Install dependencies
69-
run: uv pip install .
56+
run: uv sync --dev --locked
7057

7158
#----------------------------------------------
7259
# run test suite

.github/workflows/pypi-publish.yaml

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,22 +12,16 @@ jobs:
1212
steps:
1313
- uses: actions/checkout@v4
1414

15-
- name: Set up Python
16-
uses: actions/setup-python@v5
17-
with:
18-
python-version: '3.11'
19-
2015
- name: Install uv
21-
uses: astral-sh/setup-uv@v5
16+
uses: astral-sh/setup-uv@v6
2217
with:
18+
python-version: "3.12"
2319
enable-cache: true
24-
25-
- name: Create virtual environment
26-
run: uv venv
20+
cache-dependency-glob: "uv.lock"
2721

2822
- name: Build source and wheel archives
2923
run: |
30-
uv pip install build
24+
uv sync --locked --no-dev
3125
VERSION="$(git describe --tags --abbrev=0)"
3226
VERSION="${VERSION#v}"
3327
export VERSION
@@ -49,7 +43,7 @@ jobs:
4943
path.write_text(updated)
5044
print(f"Set project version to {version}")
5145
PY
52-
uv run python -m build
46+
uv build
5347
5448
- name: Publish distribution 📦 to PyPI
5549
uses: pypa/gh-action-pypi-publish@v1.2.2

AGENTS.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ Semantic-SQL transforms OWL/RDF ontologies into SQLite databases with standardiz
1111
```bash
1212
# Build/test
1313
make test # Run unit tests
14-
poetry run pytest tests/ # Run specific tests
15-
poetry run pytest tests/test_orm/test_basic_sqla.py -k "test_name" # Single test
14+
uv run pytest tests/ # Run specific tests
15+
uv run pytest tests/test_orm/test_basic_sqla.py -k "test_name" # Single test
1616

1717
# Schema development (after editing src/semsql/linkml/*.yaml)
1818
make gen-ddl # Generate SQL DDL from LinkML
@@ -103,8 +103,8 @@ runoak -i db/NAME.db terms
103103
Tests use pytest, not unittest. Integration tests require rdftab/relation-graph and are marked `@pytest.mark.integration`.
104104

105105
```bash
106-
poetry run pytest tests/test_orm/ # ORM tests use tests/inputs/go-nucleus.db
107-
poetry run pytest tests/test_builder/ # Builder tests
106+
uv run pytest tests/test_orm/ # ORM tests use tests/inputs/go-nucleus.db
107+
uv run pytest tests/test_builder/ # Builder tests
108108
```
109109

110110
## Best Practices from User

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
OBO = http://purl.obolibrary.org/obo
2-
RUN = poetry run
2+
RUN ?= uv run
33
VERSION = $(shell git tag | tail -1)
44
SRC_DIR = src/semsql/linkml
55
BUILDER_DIR = src/semsql/builder
@@ -228,7 +228,7 @@ $(SQLA_DIR)/%.py: $(YAML_DIR)/%.yaml
228228
# can be added to your $PATH that will execute the
229229
# version of semsql used in github
230230
bin/%:
231-
echo `poetry run which $*` '$$*' > $@ && chmod +x $@
231+
echo `uv run which $*` '$$*' > $@ && chmod +x $@
232232

233233
### DEPLOY
234234

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ Even if using OAK, it can be useful to access SQL tables directly to do complex
208208
## Optimization
209209

210210
```bash
211-
poetry run semsql view2table edge --full-index | sqlite3 $db/mydb.db
211+
uv run semsql view2table edge --full-index | sqlite3 $db/mydb.db
212212
```
213213

214214
See [indexes](indexes) for some ready-made indexes

pyproject.toml

Lines changed: 48 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,56 @@
1-
[tool.poetry]
1+
[build-system]
2+
requires = ["hatchling>=1.26.3"]
3+
build-backend = "hatchling.build"
4+
5+
[project]
26
name = "semsql"
37
version = "0.2.1"
4-
description = ""
5-
authors = ["cmungall <cjm@berkeleybop.org>"]
8+
description = "Transform OWL/RDF ontologies into SQLite databases with standardized SQL views."
9+
authors = [{ name = "cmungall", email = "cjm@berkeleybop.org" }]
610
readme = "README.md"
11+
requires-python = ">=3.10,<4.0"
12+
dependencies = [
13+
"click>=8.1.3,<9",
14+
"linkml-runtime>=1.2.15",
15+
"requests>=2.31.0",
16+
"SQLAlchemy>=1.4,<3",
17+
"SQLAlchemy-Utils>=0.38.2",
18+
"PyYAML>=6.0.1",
19+
"ruamel.yaml>=0.17.0",
20+
"rdflib>=6.3.2",
21+
]
722

8-
[tool.poetry.dependencies]
9-
python = "^3.8.1"
10-
linkml-runtime = "^1.2.15"
11-
SQLAlchemy-Utils = "^0.38.2"
12-
click = "^8.1.3"
13-
14-
[tool.poetry.dev-dependencies]
15-
mkdocs = "^1.3.0"
16-
linkml = ">=1.7.4"
17-
mkdocs-mermaid2-plugin = "^0.6.0"
18-
jupyter = "^1.0.0"
19-
ipython-sql = "^0.4.1"
20-
tox = "*"
21-
black = "*"
23+
[dependency-groups]
24+
dev = [
25+
"black",
26+
"tox",
27+
"pytest",
28+
"mkdocs>=1.3.0",
29+
"linkml>=1.7.4",
30+
"mkdocs-mermaid2-plugin>=0.6.0",
31+
"jupyter>=1.0.0",
32+
"ipython-sql>=0.4.1",
33+
]
2234

23-
[tool.poetry.scripts]
35+
[project.scripts]
2436
semsql = "semsql.builder.cli:main"
2537
gen-semsql-views = "semsql.sqlutils.viewgen:cli"
2638

27-
[build-system]
28-
requires = ["poetry-core>=1.0.0"]
29-
build-backend = "poetry.core.masonry.api"
39+
[tool.hatch.build]
40+
exclude = [
41+
"**/.#*",
42+
"**/#*#",
43+
"**/__pycache__/**",
44+
"**/*.pyc",
45+
]
46+
47+
[tool.hatch.build.targets.wheel]
48+
packages = ["src/semsql"]
49+
50+
[tool.hatch.build.targets.sdist]
51+
include = [
52+
"src/semsql",
53+
"README.md",
54+
"LICENSE",
55+
"pyproject.toml",
56+
]

tests/integration/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
RUN = poetry run
1+
RUN ?= uv run
22

33
input/%.owl:
44
robot merge -I http://purl.obolibrary.org/obo/$*.owl -o $@

tests/test_builder/test_cli.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
class TestCommandLineInterface(unittest.TestCase):
1919
def setUp(self) -> None:
20-
runner = CliRunner(mix_stderr=False)
20+
runner = CliRunner()
2121
self.runner = runner
2222

2323
def test_main_help(self):

0 commit comments

Comments
 (0)