Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions .github/actions/setup/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Setup Package
description: This workflow sets up the package for other workflows.
inputs:
python-version:
description: The Python version to use for the setup.
required: true
default: "3.11"
group:
description: The dependency group to install (benchmarks, dev, docs)
required: false
default: "dev"
runs:
using: "composite"
steps:
- uses: actions/setup-python@v5
with:
python-version: "${{ inputs.python-version }}"

- name: Install uv
uses: astral-sh/setup-uv@v6
with:
enable-cache: true
cache-suffix: "py${{ inputs.python-version }}"

- name: Install packages
shell: bash
run: |
uv sync --locked --group ${{ inputs.group }}
15 changes: 5 additions & 10 deletions .github/workflows/code-quality-main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,12 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4
- uses: actions/checkout@v4

- name: Set up Python 3.11
uses: actions/setup-python@v5
- name: Setup package
uses: ./.github/actions/setup
with:
python-version: "3.11"

- name: Install packages
run: |
pip install .[dev]
python-version: "3.12"

- name: Run pre-commits
uses: pre-commit/action@v3.0.1
run: uv run pre-commit run --all-files --show-diff-on-failure
27 changes: 10 additions & 17 deletions .github/workflows/code-quality-pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,28 +14,21 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4
- uses: actions/checkout@v4

- name: Set up Python 3.11
uses: actions/setup-python@v5
- name: Setup package
uses: ./.github/actions/setup
with:
python-version: "3.11"

- name: Install packages
run: |
pip install .[dev]
python-version: "3.12"

- name: Find modified files
id: file_changes
uses: trilom/file-changes-action@v1.2.4
with:
output: " "
uses: tj-actions/changed-files@v46.0.5

- name: List modified files
run: echo '${{ steps.file_changes.outputs.files}}'
- name: List all changed files
run: echo '${{ steps.file_changes.outputs.all_changed_files }}'

- name: Run pre-commits
uses: pre-commit/action@v3.0.1
with:
extra_args: --all-files
run: >
uv run pre-commit run --show-diff-on-failure
--files ${{ steps.file_changes.outputs.all_changed_files}}
23 changes: 12 additions & 11 deletions .github/workflows/python-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,34 +9,35 @@ jobs:

steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: Install pypa/build
run: >-
python3 -m
pip install
build
--user
- name: Build a binary wheel and a source tarball
run: python3 -m build

- name: Install uv
uses: astral-sh/setup-uv@v6
with:
enable-cache: true

- name: Build
run: uv build

- name: Store the distribution packages
uses: actions/upload-artifact@v4
with:
name: python-package-distributions
path: dist/

publish-to-pypi:
name: >-
Publish Python 🐍 distribution 📦 to PyPI
name: Publish Python 🐍 distribution 📦 to PyPI
if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
needs:
- build
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/flexible_schema # Replace <package-name> with your PyPI project name
url: https://pypi.org/p/flexible_schema
permissions:
id-token: write # IMPORTANT: mandatory for trusted publishing

Expand Down
26 changes: 12 additions & 14 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
@@ -1,35 +1,33 @@
name: Run tests
name: Tests

on:
push:
branches: ["main"]
branches: [main]
pull_request:
branches: ["main", "dev"]

jobs:
build:
run_tests_ubuntu:
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.11", "3.12"]

timeout-minutes: 30

steps:
- name: Checkout
uses: actions/checkout@v4
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
- name: Setup package @ python ${{ matrix.python-version }}
uses: ./.github/actions/setup
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
pip install -e .[tests]

- name: Run tests
run: |
pytest -v --cov=src
run: >
uv run pytest -v --cov=src -m "not parallelized and not lightning"
--ignore="benchmark" --ignore="src/meds_torchdata/extensions"

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4.0.1
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
[![Documentation Status](https://readthedocs.org/projects/flexible-schema/badge/?version=latest)](https://flexible-schema.readthedocs.io/en/latest/?badge=latest)
![python](https://img.shields.io/badge/-Python_3.10-blue?logo=python&logoColor=white)
[![codecov](https://codecov.io/gh/Medical-Event-Data-Standard/flexible_schema/graph/badge.svg?token=89SKXPKVRA)](https://codecov.io/gh/Medical-Event-Data-Standard/flexible_schema)
[![tests](https://github.com/Medical-Event-Data-Standard/flexible_schema/actions/workflows/tests.yaml/badge.svg)](https://github.com/Medical-Event-Data-Standard/flexible_schema/actions/workflows/tests.yml)
[![tests](https://github.com/Medical-Event-Data-Standard/flexible_schema/actions/workflows/tests.yaml/badge.svg)](https://github.com/Medical-Event-Data-Standard/flexible_schema/actions/workflows/tests.yaml)
[![code-quality](https://github.com/Medical-Event-Data-Standard/flexible_schema/actions/workflows/code-quality-main.yaml/badge.svg)](https://github.com/Medical-Event-Data-Standard/flexible_schema/actions/workflows/code-quality-main.yaml)
[![license](https://img.shields.io/badge/License-MIT-green.svg?labelColor=gray)](https://github.com/Medical-Event-Data-Standard/flexible_schema#license)
[![PRs](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://github.com/Medical-Event-Data-Standard/flexible_schema/pulls)
Expand Down
9 changes: 4 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,16 @@ dependencies = [
"typing_extensions >= 4.0",
]

[tool.setuptools_scm]

[project.optional-dependencies]
dev = ["pre-commit<4", "ruff"]
tests = ["pytest", "pytest-cov[toml]"]
[dependency-groups]
dev = ["pre-commit<4", "ruff", "pytest", "pytest-cov[toml]"]
docs = [
"mkdocs==1.6.1", "mkdocs-material==9.6.7", "mkdocstrings[python,shell]==0.28.2", "mkdocs-gen-files==0.5.0",
"mkdocs-literate-nav==0.6.1", "mkdocs-section-index==0.3.9", "mkdocs-git-authors-plugin==0.9.2",
"mkdocs-git-revision-date-localized-plugin==1.3.0", "markdown-callouts",
]

[tool.setuptools_scm]

[project.urls]
Homepage = "https://github.com/mmcdermott/flexible_schema"
Issues = "https://github.com/mmcdermott/flexible_schema/issues"
Expand Down
Loading
Loading