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
54 changes: 54 additions & 0 deletions .github/workflows/python-publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Publish Python packages to PyPI

on:
release:
types: [published]

jobs:
build:
name: Build distribution
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0 # required for setuptools_scm to determine version from git tags

- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.12"

- name: Install build
run: python -m pip install build

- name: Build package
run: |
cd packages/python/openproblems
python -m build

- name: Upload distribution artifacts
uses: actions/upload-artifact@v4
with:
name: python-package-distributions
path: packages/python/openproblems/dist/

publish-to-pypi:
name: Publish to PyPI
needs: build
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/openproblems
permissions:
id-token: write # required for OIDC trusted publishing

steps:
- name: Download distribution artifacts
uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/

- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
24 changes: 24 additions & 0 deletions packages/python/openproblems/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,27 @@
# openproblems core Python v0.2.0

## NEW FUNCTIONALITY

* `project`:
- `resolve_path`: Resolve a path relative to a parent path or project root.

* `project.component_tests`:
- `run_check_config` / `check_config`: Validate a component's Viash config (namespace, type, metadata, normalization, variants, Nextflow runner).
- `run_and_check_output`: Run a component executable and validate its output files against format specifications.

* `project.docs`:
- `read_task_config`: Read a task-level configuration file.
- `read_task_metadata`: Read and assemble full task metadata by traversing the task's component graph.
- `read_component_spec`: Read a component API specification.
- `read_file_format`: Read a file format specification.
- `render_task_readme_qmd`: Render a Quarto README document for a task.
- `render_component_spec`: Render a component specification as a Markdown section.
- `render_file_format`: Render a file format specification as a Markdown section.

## MINOR CHANGES

* Improve diagnostic print messages in `check_config` and `run_and_check_output` to be more descriptive.

# openproblems core Python v0.1.1

## NEW FUNCTIONALITY
Expand Down
56 changes: 56 additions & 0 deletions packages/python/openproblems/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# openproblems

[![PyPI](https://img.shields.io/pypi/v/openproblems)](https://pypi.org/project/openproblems/)
[![Python Versions](https://img.shields.io/pypi/pyversions/openproblems)](https://pypi.org/project/openproblems/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

Core Python helper functions for [OpenProblems](https://openproblems.bio) benchmarking tasks.

## Installation

```bash
pip install openproblems
```

## Modules

### `openproblems.project`

Utilities for working with Viash projects.

- `find_project_root`: Find the root of a Viash project.
- `read_nested_yaml`: Read a nested YAML file.
- `read_viash_config`: Read a Viash configuration file.
- `resolve_path`: Resolve a path relative to a parent or project path.

#### `openproblems.project.component_tests`

Helpers for writing component tests.

- `run_check_config` / `check_config`: Validate a component's Viash configuration.
- `run_and_check_output`: Run a component and validate its output files against format specs.

#### `openproblems.project.docs`

Utilities for generating task documentation.

- `read_task_config`: Read a task-level configuration file.
- `read_task_metadata`: Read and assemble full task metadata.
- `read_component_spec`: Read a component API specification.
- `read_file_format`: Read a file format specification.
- `render_task_readme_qmd`: Render a Quarto README for a task.
- `render_component_spec`: Render a component specification as Markdown.
- `render_file_format`: Render a file format specification as Markdown.

### `openproblems.utils`

General-purpose utilities.

- `strip_margin`: Strip leading margin characters from a multiline string.
- `deep_merge`: Recursively merge two dictionaries.

## Links

- **Documentation**: <https://openproblems.bio/documentation>
- **Repository**: <https://github.com/openproblems-bio/core>
- **Issue tracker**: <https://github.com/openproblems-bio/core/issues>
23 changes: 20 additions & 3 deletions packages/python/openproblems/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,23 @@ authors = [
license = { text = "MIT" }
readme = "README.md"
requires-python = ">= 3.9"
keywords = ["openproblems", "benchmarking", "bioinformatics", "viash"]
classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Topic :: Scientific/Engineering :: Bio-Informatics",
]
dependencies = [
'PyYAML'
'PyYAML',
'networkx',
]

[project.optional-dependencies]
Expand All @@ -22,8 +37,10 @@ test = [
]

[project.urls]
homepage = "https://openproblems.bio/documentation"
repository = "https://github.com/openproblems-bio/core"
Homepage = "https://openproblems.bio/documentation"
Repository = "https://github.com/openproblems-bio/core"
"Bug Tracker" = "https://github.com/openproblems-bio/core/issues"
Changelog = "https://github.com/openproblems-bio/core/blob/main/packages/python/openproblems/CHANGELOG.md"

[tool.setuptools.packages.find]
where = ["src"]
Expand Down
4 changes: 2 additions & 2 deletions packages/python/openproblems/src/openproblems/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
from . import utils

__all__ = [
"project",
"utils",
"project",
"utils",
]
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
from .find_project_root import find_project_root
from .read_viash_config import read_viash_config
from .read_nested_yaml import read_nested_yaml
from .component_tests.check_config import run_check_config as check_config
from .component_tests.run_and_check_output import run_and_check_output
from .docs.read_task_metadata import read_task_metadata
from .docs.render_task_readme_qmd import render_task_readme_qmd

__all__ = [
"find_project_root",
"read_viash_config",
"read_nested_yaml",
]
"check_config",
"run_and_check_output",
"read_task_metadata",
"render_task_readme_qmd",
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
from .check_config import (
check_info,
check_links,
check_references,
check_url,
run_check_config,
)
from .run_and_check_output import (
check_anndata,
check_dataframe,
check_dictionary,
check_format,
check_input_files,
check_output_files,
check_spatialdata,
generate_cmd_args,
get_argument_sets,
run_and_check_output,
run_component,
)

__all__ = [
# check_config
"check_info",
"check_links",
"check_references",
"check_url",
"run_check_config",
# run_and_check_output
"check_anndata",
"check_dataframe",
"check_dictionary",
"check_format",
"check_input_files",
"check_output_files",
"check_spatialdata",
"generate_cmd_args",
"get_argument_sets",
"run_and_check_output",
"run_component",
]
Loading