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
26 changes: 26 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ on:
push:
tags: ["v*"]
workflow_dispatch:
inputs:
version:
description: "Version to build (e.g. 1.2.3, without the v prefix)"
required: true

jobs:
build:
Expand All @@ -14,6 +18,17 @@ jobs:
python-version: ["3.10", "3.11", "3.12", "3.13"]
steps:
- uses: actions/checkout@v4
- name: Set version from tag
shell: bash
run: |
VERSION="${{ github.event.inputs.version || github.ref_name }}"
VERSION="${VERSION#v}"
if ! [[ "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "Invalid version: '$VERSION'. Provide a semver version via the workflow_dispatch input or push a v* tag."
exit 1
fi
sed -i.bak "s/^version = \".*\"/version = \"$VERSION\"/" Cargo.toml
rm -f Cargo.toml.bak
Comment thread
tingiskhan marked this conversation as resolved.
- uses: dtolnay/rust-toolchain@1.85.0
- uses: PyO3/maturin-action@v1
with:
Expand All @@ -28,6 +43,17 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set version from tag
shell: bash
run: |
VERSION="${{ github.event.inputs.version || github.ref_name }}"
VERSION="${VERSION#v}"
if ! [[ "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "Invalid version: '$VERSION'. Provide a semver version via the workflow_dispatch input or push a v* tag."
exit 1
fi
sed -i.bak "s/^version = \".*\"/version = \"$VERSION\"/" Cargo.toml
rm -f Cargo.toml.bak
Comment thread
tingiskhan marked this conversation as resolved.
- uses: PyO3/maturin-action@v1
with:
command: sdist
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "maturin"

[project]
name = "rustypca"
version = "0.1.0"
dynamic = ["version"]
description = "Probabilistic PCA with missing value support using Rust and PyO3"
readme = {file = "README.md", content-type = "text/markdown"}
license = {file = "LICENSE"}
Expand Down
8 changes: 7 additions & 1 deletion rustypca/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
"""Probabilistic Principal Component Analysis with missing value support."""

from importlib.metadata import PackageNotFoundError, version

from ._rustypca import PPCA

__all__ = ["PPCA"]
__version__ = "0.1.0"

try:
__version__ = version("rustypca")
except PackageNotFoundError:
__version__ = "unknown"
Loading