Skip to content

Commit aaede8e

Browse files
authored
Pyproject.toml Update to python standard/UV Update For Oak (#849)
Standardized pyproject.toml to PEP 621. Allowing UV to build/run oak. Currently maintaining previous poetry functionality (which all tested to work). Added job to github workflows to have some also run test using UV (make minor changes to get all workflows functional). Version restricted any pyproject.toml files which led to errors in executing tests.
1 parent 1b99d04 commit aaede8e

8 files changed

Lines changed: 193 additions & 7838 deletions

File tree

.github/workflows/doc_pages.yaml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
name: Sphinx Documentation
22
on:
3+
workflow_dispatch:
34
push:
45
branches: [ main ]
56

@@ -13,12 +14,17 @@ jobs:
1314
fetch-depth: 0 # otherwise, you will failed to push refs to dest repo
1415

1516
- name: Set up Python 3.
16-
uses: actions/setup-python@v3
17+
uses: actions/setup-python@v6.2.0
1718
with:
18-
python-version: 3.9
19+
python-version: 3.12
20+
21+
# - name: Install Poetry.
22+
# uses: snok/install-poetry@v1.3
23+
- name: Install Poetry
24+
run: |
25+
pip install --upgrade pip
26+
pip install poetry
1927
20-
- name: Install Poetry.
21-
uses: snok/install-poetry@v1.3
2228
2329
- name: install
2430
run: poetry install -E docs

.github/workflows/main.yaml

Lines changed: 45 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
name: Build and test
66

77
on:
8+
workflow_dispatch:
89
push:
910
branches: [ main ]
1011
pull_request:
@@ -15,7 +16,7 @@ jobs:
1516
runs-on: ubuntu-latest
1617
strategy:
1718
matrix:
18-
python-version: [ '3.9', '3.10', '3.12' ]
19+
python-version: [ '3.9', '3.10', '3.11', '3.12' ]
1920
steps:
2021
- uses: actions/checkout@v3
2122
- name: Set up Python ${{ matrix.python-version }}
@@ -33,7 +34,7 @@ jobs:
3334
fail-fast: false
3435
matrix:
3536
os: [ ubuntu-latest, windows-latest ]
36-
python-version: [ "3.9", "3.10", "3.11" ]
37+
python-version: [ "3.9", "3.10", "3.11", "3.12" ]
3738
exclude:
3839
- os: windows-latest
3940
python-version: "3.9"
@@ -46,10 +47,10 @@ jobs:
4647
# check-out repo and set-up python
4748
#----------------------------------------------
4849
- name: Check out repository
49-
uses: actions/checkout@v3
50+
uses: actions/checkout@v6.0.2
5051

5152
- name: Set up Python ${{ matrix.python-version }}
52-
uses: actions/setup-python@v4
53+
uses: actions/setup-python@v6.2.0
5354
with:
5455
python-version: ${{ matrix.python-version }}
5556

@@ -80,8 +81,8 @@ jobs:
8081
#----------------------------------------------
8182
- name: Install dependencies
8283
# if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
83-
run: |
84-
poetry add setuptools@latest
84+
run:
85+
# poetry add setuptools@latest
8586
poetry install --no-interaction --no-root
8687

8788
#----------------------------------------------
@@ -119,3 +120,41 @@ jobs:
119120
token: ${{ secrets.CODECOV_TOKEN }}
120121
file: ./coverage.xml
121122
fail_ci_if_error: false
123+
124+
test_with_uv:
125+
strategy:
126+
matrix:
127+
os: [ ubuntu-latest, windows-latest ]
128+
python-version: [ "3.9", "3.10", "3.11", "3.12" ]
129+
exclude:
130+
- os: windows-latest
131+
python-version: "3.9"
132+
133+
runs-on: ${{ matrix.os }}
134+
135+
136+
# Steps represent a sequence of tasks that will be executed as part of the job
137+
steps:
138+
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
139+
- uses: actions/checkout@v6
140+
141+
- name: Install uv
142+
uses: astral-sh/setup-uv@v7.3.0
143+
144+
- name: setup python environment
145+
uses: actions/setup-python@v6
146+
with:
147+
python-version: ${{ matrix.python-version }}
148+
149+
- name: Install dependencies
150+
run: |
151+
uv sync --extra "semsimian" --extra "gilda"
152+
uv run python -c 'import nltk; nltk.download("stopwords"); nltk.download("punkt_tab")' #TODO; directly put this into our GildaImplementation class/in function _gilda_annotate
153+
154+
- name: Run tests
155+
run: |
156+
uv run pytest tests/*
157+
shell: bash
158+
env:
159+
BIOPORTAL_API_KEY: ${{ secrets.BIOPORTAL_API_KEY }}
160+
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Publish Python Package (Dry Run)
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches: [ main ]
7+
pull_request:
8+
branches: [ main ]
9+
10+
jobs:
11+
build-n-publish-dry-run:
12+
name: Build and publish Python 🐍 distributions 📦 to PyPI (DRY RUN)
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- uses: actions/checkout@v3
17+
18+
- name: Set up Python
19+
uses: actions/setup-python@v3
20+
with:
21+
python-version: 3.12
22+
23+
- name: Install Poetry
24+
run: |
25+
pip install --upgrade pip
26+
pip install poetry
27+
28+
- name: Install dependencies
29+
run: poetry install --no-interaction
30+
31+
- name: Build source and wheel archives
32+
run: |
33+
poetry version $(git describe --tags --abbrev=0)
34+
poetry build
35+
36+
37+
# - name: Publish package to TestPyPI
38+
# uses: pypa/gh-action-pypi-publish@release/v1
39+
# with:
40+
# password: "TEST_PASSWORD"
41+
# repository-url: https://test.pypi.org/legacy/
42+

.github/workflows/pypi-publish.yaml

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,18 @@ jobs:
1515
- name: Set up Python
1616
uses: actions/setup-python@v3
1717
with:
18-
python-version: 3.9
18+
python-version: 3.12
19+
20+
# - name: Install Poetry
21+
# uses: snok/install-poetry@v1.3.1
22+
# with:
23+
# virtualenvs-create: true
24+
# virtualenvs-in-project: true
1925

2026
- name: Install Poetry
21-
uses: snok/install-poetry@v1.3.1
22-
with:
23-
virtualenvs-create: true
24-
virtualenvs-in-project: true
27+
run: |
28+
pip install --upgrade pip
29+
pip install poetry
2530
2631
- name: Install dependencies
2732
run: poetry install --no-interaction

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,6 @@ oak_semsimian_hp.profile
3232
notebooks/demo.tsv
3333
tests/input/obo_conf.yaml
3434
tests/input/obojson_conf.yaml
35+
uv.lock
36+
poetry.lock
37+
.panther_requests_cache.sqlite

0 commit comments

Comments
 (0)