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 17, 2025
1 parent e5ce324 commit 28b9677
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 31 deletions.
40 changes: 37 additions & 3 deletions .github/actions/bump_version/action.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,49 @@
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> /dev/null)
if [ $? -ne 0 ]; then
echo "No exact match tag found."
fi
echo "Tag: $tag"
if [ -n "$tag" ]; then
version="$tag"
else
latest_tag=$(git describe --tags --abbrev=0 2> /dev/null)
if [ -z "$latest_tag" ]; then
latest_tag="0.0.0"
fi
version="${latest_tag}.dev"
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 "${{ env.version }}"
shell: bash

# - name: Check Cargo.toml version matches Release tag
Expand Down
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 28b9677

Please sign in to comment.