Skip to content

Commit 2c1cb70

Browse files
authored
Merge pull request #387 from dalito/poetry2-upgrade-contd
Update pyproject.toml & actions to poetry 2.x / PEP 621
2 parents 7d213ee + cda25de commit 2c1cb70

File tree

8 files changed

+485
-464
lines changed

8 files changed

+485
-464
lines changed

.github/dependabot.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Please see the documentation for all configuration options:
2+
# https://docs.github.com/en/code-security/dependabot/working-with-dependabot/dependabot-options-reference
3+
4+
version: 2
5+
updates:
6+
- package-ecosystem: github-actions
7+
directory: "/"
8+
schedule:
9+
interval: monthly
10+
11+
# Activate after migration to uv as package manager
12+
# - package-ecosystem: "uv"
13+
# directories:
14+
# - "/"
15+
# schedule:
16+
# interval: "weekly"
17+
# day: "sunday"
18+
# groups:
19+
# # Individual pull requests for major/minor updates and grouped for patch updates
20+
# angular:
21+
# applies-to: version-updates
22+
# patterns:
23+
# - "*"
24+
# update-types:
25+
# - "patch"
26+
# open-pull-requests-limit: 10

.github/workflows/check-dependencies.yaml

Lines changed: 22 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -13,53 +13,45 @@ jobs:
1313
fail-fast: false
1414
matrix:
1515
os: [ubuntu-latest, windows-latest]
16-
python-version: ["3.8", "3.9", "3.10"]
16+
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
1717
exclude:
1818
- os: windows-latest
19-
python-version: "3.8"
19+
python-version: "3.10"
20+
- os: windows-latest
21+
python-version: "3.11"
22+
- os: windows-latest
23+
python-version: "3.12"
2024

2125
runs-on: ${{ matrix.os }}
2226

2327
steps:
24-
25-
#----------------------------------------------
26-
# install poetry
27-
#----------------------------------------------
2828
- name: Install Poetry
29-
# Pin to 1.3.2 to workaround https://github.com/python-poetry/poetry/issues/7611
30-
run: pipx install poetry==1.3.2
29+
run: |
30+
pipx install poetry
31+
pipx inject poetry poetry-dynamic-versioning
3132
32-
#----------------------------------------------
33-
# check-out repo and set-up python
34-
#----------------------------------------------
3533
- name: Check out repository
36-
uses: actions/checkout@v3
34+
uses: actions/checkout@v4.2.2
35+
with:
36+
# Fetch all history for all branches and all tags.
37+
# The tags are required for dynamic versioning.
38+
fetch-depth: 0
3739

3840
- name: Set up Python ${{ matrix.python-version }}
39-
uses: actions/setup-python@v4
41+
uses: actions/setup-python@v5.6.0
4042
with:
4143
python-version: ${{ matrix.python-version }}
4244
cache: 'poetry'
4345

44-
#----------------------------------------------
45-
# install your root project, if required
46-
#----------------------------------------------
4746
- name: Install library
4847
run: poetry install --no-interaction
4948

50-
# this step we remove and rebuild the poetry.lock file to ensure that the tests that follow can be run
51-
# with the latest dependencies
52-
53-
#----------------------------------------------
54-
# Remove and Rebuild the poetry.lock File
55-
#----------------------------------------------
56-
- name: Remove poetry.lock (Unix)
57-
if: runner.os != 'Windows'
58-
run: rm -rf poetry.lock
59-
60-
- name: Remove poetry.lock (Windows)
61-
if: runner.os == 'Windows'
62-
run: Remove-Item poetry.lock -Force
49+
- name: Regenerating poetry.lock file & install (sync) dependencies
50+
run: |
51+
poetry lock --regenerate
52+
poetry sync
6353
6454
- name: Run tests
65-
run: poetry run python -m unittest discover
55+
# Set bash shell to fail correctly on Windows https://github.com/actions/runner-images/issues/6668
56+
shell: bash
57+
run: poetry run python -m pytest --with-slow

.github/workflows/main.yaml

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Built from:
2-
# https://docs.github.com/en/actions/guides/building-and-testing-python
2+
# https://github.com/actions/checkout/
33
# https://github.com/actions/setup-python/
4+
# https://github.com/codecov/codecov-action
45

56
name: Build and test linkml-runtime
67

@@ -17,31 +18,37 @@ jobs:
1718
fail-fast: false
1819
matrix:
1920
os: [ubuntu-latest, windows-latest]
20-
python-version: ["3.9", "3.10", "3.12", "3.13"]
21+
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
2122
exclude:
2223
- os: windows-latest
2324
python-version: "3.10"
25+
- os: windows-latest
26+
python-version: "3.11"
2427
- os: windows-latest
2528
python-version: "3.12"
2629

2730
runs-on: ${{ matrix.os }}
28-
31+
2932
steps:
3033

3134
#----------------------------------------------
3235
# install poetry
3336
#----------------------------------------------
3437
- name: Install Poetry
35-
run: pipx install poetry==1.4.0
36-
38+
run: |
39+
pipx install poetry
40+
pipx inject poetry poetry-dynamic-versioning
41+
3742
#----------------------------------------------
3843
# check-out repo and set-up python
3944
#----------------------------------------------
4045
- name: Check out repository
41-
uses: actions/checkout@v3
46+
uses: actions/checkout@v4.2.2
47+
with:
48+
fetch-depth: 0
4249

4350
- name: Set up Python ${{ matrix.python-version }}
44-
uses: actions/setup-python@v5
51+
uses: actions/setup-python@v5.6.0
4552
with:
4653
python-version: ${{ matrix.python-version }}
4754
cache: 'poetry'
@@ -50,13 +57,14 @@ jobs:
5057
# install your root project, if required
5158
#----------------------------------------------
5259
- name: Install library
53-
run: poetry install --no-interaction
60+
run: |
61+
poetry install --no-interaction
5462
5563
#----------------------------------------------
5664
# coverage report
5765
#----------------------------------------------
5866
- name: Generate coverage results
59-
# Set bash shell to fail correctly on Windows https://github.com/actions/runner-images/issues/6668
67+
# Set bash shell to fail correctly on Windows https://github.com/actions/runner-images/issues/6668
6068
shell: bash
6169
run: |
6270
poetry run coverage run -m pytest
@@ -67,7 +75,7 @@ jobs:
6775
# upload coverage results
6876
#----------------------------------------------
6977
- name: Upload coverage report
70-
uses: codecov/codecov-action@v3
78+
uses: codecov/codecov-action@v5
7179
with:
7280
name: codecov-results-${{ matrix.os }}-${{ matrix.python-version }}
7381
token: ${{ secrets.CODECOV_TOKEN }}
Lines changed: 41 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,61 @@
11
name: Publish Python Package
2+
# Upload to PyPI is triggered by creating & publishing a release in GitHub UI
23

34
on:
45
release:
6+
# Trigger the workflow only for real releases but not for draft releases
57
types: [created]
68

79
jobs:
8-
build-n-publish:
9-
name: Build and publish Python 🐍 distributions 📦 to PyPI
10+
build:
11+
name: Build Python 🐍 distributions 📦 for publishing to PyPI
1012
runs-on: ubuntu-latest
11-
1213
steps:
13-
- uses: actions/checkout@v2
14+
- uses: actions/checkout@v4.2.2
15+
with:
16+
# Checkout the code including tags required for dynamic versioning
17+
fetch-depth: 0
1418

1519
- name: Set up Python
16-
uses: actions/setup-python@v2.2.2
20+
uses: actions/setup-python@v5.6.0
1721
with:
18-
python-version: 3.12
22+
python-version: 3.13
1923

2024
- name: Install Poetry
21-
run: pipx install poetry
22-
23-
- name: Install dependencies
24-
run: poetry install --no-interaction
25+
run: |
26+
pipx install poetry
27+
pipx inject poetry poetry-dynamic-versioning
2528
2629
- name: Build source and wheel archives
2730
run: |
28-
poetry version $(git describe --tags --abbrev=0)
2931
poetry build
3032
31-
- name: Publish distribution 📦 to PyPI
32-
uses: pypa/gh-action-pypi-publish@v1.2.2
33+
- name: Store built distribution
34+
uses: actions/upload-artifact@v4.6.2
3335
with:
34-
user: __token__
35-
password: ${{ secrets.pypi_password }}
36+
name: distribution-files
37+
path: dist/
38+
39+
pypi-publish:
40+
name: Build and publish Python 🐍 package 📦 to PyPI
41+
needs: build
42+
runs-on: ubuntu-latest
43+
# Next 5 lines prepare for trusted publishing: https://docs.pypi.org/trusted-publishers/adding-a-publisher/
44+
# environment:
45+
# name: pypi-release
46+
# url: https://pypi.org/p/linkml-runtime
47+
# permissions:
48+
# id-token: write # this permission is mandatory for trusted publishing
49+
steps:
50+
- name: Download built distribution
51+
uses: actions/download-artifact@v4.3.0
52+
with:
53+
name: distribution-files
54+
path: dist
55+
56+
- name: Publish package 📦 to PyPI
57+
if: github.event_name == 'release'
58+
uses: pypa/gh-action-pypi-publish@v1.12
59+
with:
60+
password: ${{ secrets.pypi_password }}
61+
# verbose: true

.github/workflows/test-upstream.yaml

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# Test linkml-runtime with upstream linkml and run linkml tests
12
name: Test with upstream linkml
23
on:
34
pull_request:
@@ -83,18 +84,16 @@ jobs:
8384
echo "upstream_repo=${{ inputs.upstream_repo }}" >> "$GITHUB_ENV"
8485
8586
- name: checkout upstream
86-
uses: actions/checkout@v4
87+
uses: actions/checkout@v4.2.2
8788
with:
8889
repository: "${{ env.upstream_repo }}"
8990
path: linkml
9091
ref: "${{ env.upstream_branch }}"
9192
fetch-depth: 0
9293

9394
- name: checkout linkml-runtime
94-
uses: actions/checkout@v4
95+
uses: actions/checkout@v4.2.2
9596
with:
96-
# don't specify repository like this or else we won't get pull request branches correctly
97-
# repository: linkml/linkml-runtime
9897
path: linkml-runtime
9998
fetch-depth: 0
10099

@@ -113,22 +112,18 @@ jobs:
113112
git fetch upstream --tags
114113
115114
- name: set up python
116-
uses: actions/setup-python@v5
115+
uses: actions/setup-python@v5.6.0
117116
with:
118117
python-version: ${{ matrix.python-version }}
119118

120119
- name: Install poetry
121-
run: pipx install poetry==1.*
122-
123-
- name: Check Poetry version
124-
run: poetry --version
125-
126-
- name: Install dynamic versioning plugin
127-
run: poetry self add "poetry-dynamic-versioning[plugin]"
120+
run: |
121+
pipx install poetry
122+
pipx inject poetry poetry-dynamic-versioning
128123
129124
- name: Load cached venv
130125
id: cached-poetry-dependencies
131-
uses: actions/cache@v3
126+
uses: actions/cache@v4.2.3
132127
with:
133128
path: linkml/.venv
134129
key: venv-${{ matrix.python-version }}-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}
@@ -156,9 +151,8 @@ jobs:
156151
working-directory: linkml
157152
run: poetry run python -c 'import linkml_runtime; from importlib.metadata import version; print(linkml_runtime.__file__); print(version("linkml_runtime"))'
158153

159-
- name: run tests
154+
- name: run linkml tests
155+
# Set bash shell to fail correctly on Windows https://github.com/actions/runner-images/issues/6668
156+
shell: bash
160157
working-directory: linkml
161158
run: poetry run python -m pytest --with-slow
162-
163-
164-

0 commit comments

Comments
 (0)