Skip to content

Commit

Permalink
Connect with python versions
Browse files Browse the repository at this point in the history
  • Loading branch information
torymur committed Feb 18, 2025
1 parent e5ce324 commit ccc52aa
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 38 deletions.
54 changes: 44 additions & 10 deletions .github/actions/bump_version/action.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,55 @@
name: 'Bump Versions'
description: 'This action bumps versions of Cargo.toml and _version.py file, matching release tag'
description: 'This action bumps versions of Cargo.toml file, matching release tag'

runs:
using: 'composite'
steps:
- uses: actions/checkout@v4
# To fetch all the tags and history
with:
fetch-depth: 0

# - name: Fetch all tags explicitly
# run: git fetch --tags
# shell: bash

# - name: Get all tags
# run: git tag
# shell: bash

# - name: Get latest
# run: git describe --tags --abbrev=0 2> /dev/null
# shell: bash
#
# - name: Get the exact Git tag or latest tag + dev
# run: |
# tag=$(git describe --exact-match --tags 2>&1) || {
# echo "Error: No exact match tag found."
# tag=""
# }
# # If no exact match tag found, get the latest tag or set default
# if [ -z "$tag" ]; then
# version="0.0.0"
# else
# version="$tag"
# fi
# echo "Version: $version"
# echo "version=$version" >> $GITHUB_ENV
# shell: bash

- name: Bump Cargo version
# python ./cargo_version_bumper.py --target Cargo.toml "${{ github.ref_name }}"
run: |
python .github/actions/bump_version/cargo_version_bumper.py --target Cargo.toml "0.0.1"
# python .github/actions/bump_version/cargo_version_bumper.py --target Cargo.toml "${{ github.ref_name }}"
python .github/actions/bump_version/cargo_version_bumper.py --target Cargo.toml "0.2.3"
shell: bash

# - name: Check Cargo.toml version matches Release tag
# run: |
# CARGO_VERSION=$(grep '^version =' Cargo.toml | sed 's/.*"\(.*\)".*/\1/')
# if [ "${GITHUB_REF#refs/tags/}" != "$CARGO_VERSION" ]; then
# echo "Version mismatch: Cargo.toml ($CARGO_VERSION) doesn't match Release tag (${GITHUB_REF#refs/tags/})"
# exit 1
# fi
- name: Check version in Cargo.toml matches Release tag
run: |
"VERSION=$(cargo metadata --format-version=1 --no-deps | jq -r '.packages[0].version')"
echo "Package version version is $VERSION"
echo "Tags: ${GITHUB_REF#refs/tags/}"
if [ "${GITHUB_REF#refs/tags/}" != "$VERSION" ]; then
echo "Version mismatch: Cargo.toml ($VERSION) doesn't match Release tag (${GITHUB_REF#refs/tags/})"
exit 1
fi
shell: bash
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ install-release:

# Build only the Rust Python extension (in debug mode)
build-extension-debug:
maturin build
maturin develop

# Build only the Rust Python extension (in release mode)
build-extension-release:
maturin build --release
maturin develop --release

# Watches changes in the rust bindings and updates the python extension in place.
watch-extension:
Expand Down
10 changes: 0 additions & 10 deletions python/outlines_core/__init__.py

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
"""This package provides core functionality for structured generation, formerly implemented in Outlines."""

from typing import Dict, List, Optional, Set, Tuple, Union

def build_regex_from_schema(
Expand Down
16 changes: 0 additions & 16 deletions python/outlines_core/json_schema.py

This file was deleted.

3 changes: 3 additions & 0 deletions src/python_bindings/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,9 @@ fn register_child_module(parent_module: &Bound<'_, PyModule>) -> PyResult<()> {

#[pymodule]
fn outlines_core(m: &Bound<'_, PyModule>) -> PyResult<()> {
let version = env!("CARGO_PKG_VERSION");
m.add("__version__", version)?;

m.add_class::<PyIndex>()?;
m.add_class::<PyVocabulary>()?;
m.add_class::<PyGuide>()?;
Expand Down

0 comments on commit ccc52aa

Please sign in to comment.