Skip to content

Commit 970cf71

Browse files
committed
Connect with python versions
1 parent 8754268 commit 970cf71

File tree

6 files changed

+48
-38
lines changed

6 files changed

+48
-38
lines changed
Lines changed: 41 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,52 @@
11
name: 'Bump Versions'
2-
description: 'This action bumps versions of Cargo.toml and _version.py file, matching release tag'
2+
description: 'This action bumps versions of Cargo.toml file, matching release tag'
33

44
runs:
55
using: 'composite'
66
steps:
77
- uses: actions/checkout@v4
8+
# To fetch all the tags and history
9+
with:
10+
fetch-depth: 0
11+
12+
# - name: Fetch all tags explicitly
13+
# run: git fetch --tags
14+
# shell: bash
15+
16+
# - name: Get all tags
17+
# run: git tag
18+
# shell: bash
19+
20+
# - name: Get latest
21+
# run: git describe --tags --abbrev=0 2> /dev/null
22+
# shell: bash
23+
#
24+
# - name: Get the exact Git tag or latest tag + dev
25+
# run: |
26+
# tag=$(git describe --exact-match --tags 2>&1) || {
27+
# echo "Error: No exact match tag found."
28+
# tag=""
29+
# }
30+
# # If no exact match tag found, get the latest tag or set default
31+
# if [ -z "$tag" ]; then
32+
# version="0.0.0"
33+
# else
34+
# version="$tag"
35+
# fi
36+
# echo "Version: $version"
37+
# echo "version=$version" >> $GITHUB_ENV
38+
# shell: bash
839

940
- name: Bump Cargo version
10-
# python ./cargo_version_bumper.py --target Cargo.toml "${{ github.ref_name }}"
1141
run: |
12-
python .github/actions/bump_version/cargo_version_bumper.py --target Cargo.toml "0.0.1"
42+
# python .github/actions/bump_version/cargo_version_bumper.py --target Cargo.toml "${{ github.ref_name }}"
43+
python .github/actions/bump_version/cargo_version_bumper.py --target Cargo.toml "0.2.3"
1344
shell: bash
1445

15-
# - name: Check Cargo.toml version matches Release tag
16-
# run: |
17-
# CARGO_VERSION=$(grep '^version =' Cargo.toml | sed 's/.*"\(.*\)".*/\1/')
18-
# if [ "${GITHUB_REF#refs/tags/}" != "$CARGO_VERSION" ]; then
19-
# echo "Version mismatch: Cargo.toml ($CARGO_VERSION) doesn't match Release tag (${GITHUB_REF#refs/tags/})"
20-
# exit 1
21-
# fi
46+
# - name: Check Cargo.toml version matches Release tag
47+
# run: |
48+
# CARGO_VERSION=$(grep '^version =' Cargo.toml | sed 's/.*"\(.*\)".*/\1/')
49+
# if [ "${GITHUB_REF#refs/tags/}" != "$CARGO_VERSION" ]; then
50+
# echo "Version mismatch: Cargo.toml ($CARGO_VERSION) doesn't match Release tag (${GITHUB_REF#refs/tags/})"
51+
# exit 1
52+
# fi

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@ install-release:
3030

3131
# Build only the Rust Python extension (in debug mode)
3232
build-extension-debug:
33-
maturin build
33+
maturin develop
3434

3535
# Build only the Rust Python extension (in release mode)
3636
build-extension-release:
37-
maturin build --release
37+
maturin develop --release
3838

3939
# Watches changes in the rust bindings and updates the python extension in place.
4040
watch-extension:

python/outlines_core/__init__.py

Lines changed: 0 additions & 10 deletions
This file was deleted.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
"""This package provides core functionality for structured generation, formerly implemented in Outlines."""
2+
13
from typing import Dict, List, Optional, Set, Tuple, Union
24

35
def build_regex_from_schema(

python/outlines_core/json_schema.py

Lines changed: 0 additions & 16 deletions
This file was deleted.

src/python_bindings/mod.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,9 @@ fn register_child_module(parent_module: &Bound<'_, PyModule>) -> PyResult<()> {
365365

366366
#[pymodule]
367367
fn outlines_core(m: &Bound<'_, PyModule>) -> PyResult<()> {
368+
let version = env!("CARGO_PKG_VERSION");
369+
m.add("__version__", version)?;
370+
368371
m.add_class::<PyIndex>()?;
369372
m.add_class::<PyVocabulary>()?;
370373
m.add_class::<PyGuide>()?;

0 commit comments

Comments
 (0)