Skip to content

Commit 07f9995

Browse files
authored
Merge pull request #39 from Medical-Event-Data-Standard/dev
Added uv, updated pre-commit
2 parents 3f0b880 + a55f28d commit 07f9995

9 files changed

Lines changed: 1677 additions & 63 deletions

File tree

.github/actions/setup/action.yaml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Setup Package
2+
description: This workflow sets up the package for other workflows.
3+
inputs:
4+
python-version:
5+
description: The Python version to use for the setup.
6+
required: true
7+
default: "3.11"
8+
group:
9+
description: The dependency group to install (benchmarks, dev, docs)
10+
required: false
11+
default: "dev"
12+
runs:
13+
using: "composite"
14+
steps:
15+
- uses: actions/setup-python@v5
16+
with:
17+
python-version: "${{ inputs.python-version }}"
18+
19+
- name: Install uv
20+
uses: astral-sh/setup-uv@v6
21+
with:
22+
enable-cache: true
23+
cache-suffix: "py${{ inputs.python-version }}"
24+
25+
- name: Install packages
26+
shell: bash
27+
run: |
28+
uv sync --locked --group ${{ inputs.group }}

.github/workflows/code-quality-main.yaml

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,12 @@ jobs:
1212
runs-on: ubuntu-latest
1313

1414
steps:
15-
- name: Checkout
16-
uses: actions/checkout@v4
15+
- uses: actions/checkout@v4
1716

18-
- name: Set up Python
19-
uses: actions/setup-python@v5
17+
- name: Setup package
18+
uses: ./.github/actions/setup
2019
with:
2120
python-version: "3.11"
2221

23-
- name: Install packages
24-
run: |
25-
pip install .[dev]
26-
2722
- name: Run pre-commits
28-
uses: pre-commit/action@v3.0.1
23+
run: uv run pre-commit run --all-files --show-diff-on-failure

.github/workflows/code-quality-pr.yaml

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,35 +8,27 @@ name: Code Quality PR
88

99
on:
1010
pull_request:
11-
branches: [main, "release/*", "dev"]
1211

1312
jobs:
1413
code-quality:
1514
runs-on: ubuntu-latest
1615

1716
steps:
18-
- name: Checkout
19-
uses: actions/checkout@v4
17+
- uses: actions/checkout@v4
2018

21-
- name: Set up Python
22-
uses: actions/setup-python@v5
19+
- name: Setup package
20+
uses: ./.github/actions/setup
2321
with:
2422
python-version: "3.11"
2523

26-
- name: Install packages
27-
run: |
28-
pip install .[dev]
29-
3024
- name: Find modified files
3125
id: file_changes
32-
uses: trilom/file-changes-action@v1.2.4
33-
with:
34-
output: " "
26+
uses: tj-actions/changed-files@v46.0.5
3527

36-
- name: List modified files
37-
run: echo '${{ steps.file_changes.outputs.files}}'
28+
- name: List all changed files
29+
run: echo '${{ steps.file_changes.outputs.all_changed_files }}'
3830

3931
- name: Run pre-commits
40-
uses: pre-commit/action@v3.0.1
41-
with:
42-
extra_args: --files ${{ steps.file_changes.outputs.files}}
32+
run: >
33+
uv run pre-commit run --show-diff-on-failure
34+
--files ${{ steps.file_changes.outputs.all_changed_files}}

.github/workflows/python-build.yaml

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,27 +13,28 @@ jobs:
1313

1414
steps:
1515
- uses: actions/checkout@v4
16+
1617
- name: Set up Python ${{ matrix.python-version }}
1718
uses: actions/setup-python@v5
1819
with:
1920
python-version: ${{ matrix.python-version }}
20-
- name: Install pypa/build
21-
run: >-
22-
python3 -m
23-
pip install
24-
build
25-
--user
26-
- name: Build a binary wheel and a source tarball
27-
run: python3 -m build
21+
22+
- name: Install uv
23+
uses: astral-sh/setup-uv@v6
24+
with:
25+
enable-cache: true
26+
27+
- name: Build
28+
run: uv build
29+
2830
- name: Store the distribution packages
2931
uses: actions/upload-artifact@v4
3032
with:
3133
name: python-package-distributions
3234
path: dist/
3335

3436
publish-to-pypi:
35-
name: >-
36-
Publish Python 🐍 distribution 📦 to PyPI
37+
name: Publish Python 🐍 distribution 📦 to PyPI
3738
if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
3839
needs:
3940
- build

.github/workflows/tests.yaml

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ on:
44
push:
55
branches: [main]
66
pull_request:
7-
branches: [main, "release/*", "dev"]
87

98
jobs:
109
run_tests_ubuntu:
@@ -16,25 +15,18 @@ jobs:
1615
fail-fast: false
1716

1817
timeout-minutes: 30
18+
1919
steps:
20-
- name: Checkout
21-
uses: actions/checkout@v4
20+
- uses: actions/checkout@v4
2221

23-
- name: Set up Python ${{ matrix.python-version }}
24-
uses: actions/setup-python@v5
22+
- name: Setup package
23+
uses: ./.github/actions/setup
2524
with:
2625
python-version: ${{ matrix.python-version }}
2726

28-
- name: Install packages
29-
run: |
30-
pip install -e .[tests]
31-
32-
#----------------------------------------------
33-
# run test suite
34-
#----------------------------------------------
3527
- name: Run tests
36-
run: |
37-
pytest -v --doctest-modules --cov=src --junitxml=junit.xml -s --ignore=docs
28+
run: >
29+
uv run pytest -v --cov=src
3830
3931
- name: Upload coverage to Codecov
4032
uses: codecov/codecov-action@v4.0.1
@@ -46,7 +38,3 @@ jobs:
4638
uses: codecov/test-results-action@v1
4739
with:
4840
token: ${{ secrets.CODECOV_TOKEN }}
49-
50-
- name: Check README code snippets
51-
run: |
52-
python -m doctest README.md

.pre-commit-config.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ exclude: "docs/index.md"
55

66
repos:
77
- repo: https://github.com/pre-commit/pre-commit-hooks
8-
rev: v5.0.0
8+
rev: v6.0.0
99
hooks:
1010
# list of supported hooks: https://pre-commit.com/hooks.html
1111
- id: trailing-whitespace
@@ -22,7 +22,7 @@ repos:
2222

2323
# python code formatting, linting, and import sorting using ruff
2424
- repo: https://github.com/astral-sh/ruff-pre-commit
25-
rev: v0.11.5
25+
rev: v0.14.5
2626
hooks:
2727
# Run the formatter
2828
- id: ruff-format
@@ -32,7 +32,7 @@ repos:
3232

3333
# python docstring formatting
3434
- repo: https://github.com/myint/docformatter
35-
rev: v1.7.5
35+
rev: v1.7.7
3636
hooks:
3737
- id: docformatter
3838
args: [--in-place, --wrap-summaries=110, --wrap-descriptions=110]
@@ -47,7 +47,7 @@ repos:
4747

4848
# shell scripts linter
4949
- repo: https://github.com/shellcheck-py/shellcheck-py
50-
rev: v0.10.0.1
50+
rev: v0.11.0.1
5151
hooks:
5252
- id: shellcheck
5353

@@ -62,7 +62,7 @@ repos:
6262
- mdformat-gfm-alerts
6363
- mdformat-tables
6464
- mdformat_frontmatter
65-
- mdformat-black
65+
- mdformat-ruff
6666
- mdformat-config
6767
- mdformat-shfmt
6868
- mdformat-mkdocs
@@ -79,7 +79,7 @@ repos:
7979

8080
# jupyter notebook cell output clearing
8181
- repo: https://github.com/kynan/nbstripout
82-
rev: 0.8.1
82+
rev: 0.8.2
8383
hooks:
8484
- id: nbstripout
8585

pyproject.toml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,11 @@ dependencies = [
2828
"pytimeparse"
2929
]
3030

31+
[dependency-groups]
32+
dev = ["pre-commit<4", "ruff", "pytest-cov"]
33+
3134
[project.optional-dependencies]
32-
dev = ["pre-commit<4", "ruff"]
33-
tests = ["pytest-cov"]
35+
3436
docs = [
3537
"mkdocs==1.6.1", "mkdocs-material==9.6.7", "mkdocstrings[python,shell]==0.28.2", "mkdocs-gen-files==0.5.0",
3638
"mkdocs-literate-nav==0.6.1", "mkdocs-section-index==0.3.9", "mkdocs-git-authors-plugin==0.9.2",
@@ -53,6 +55,8 @@ addopts = [
5355
"--doctest-modules",
5456
"--ignore=docs",
5557
"--ignore=AGENTS.md",
58+
"--ignore=CONTRIBUTORS.md",
59+
"--doctest-glob=*.md",
5660
]
5761
doctest_optionflags = ["NORMALIZE_WHITESPACE", "ELLIPSIS"]
5862

src/meds_testing_helpers/dataset_generator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -470,7 +470,7 @@ class MEDSDatasetGenerator:
470470
dataset_version: 0.0.1
471471
etl_name: meds_testing_helpers
472472
etl_version: ...
473-
meds_version: 0.4.0
473+
meds_version: 0.4.1
474474
created_at: ...
475475
extension_columns: []
476476
>>> dataset._pl_code_metadata # This is always empty for now as these codes are meaningless.

0 commit comments

Comments
 (0)