mirror of
https://github.com/zama-ai/concrete.git
synced 2026-02-10 04:35:03 -05:00
feat(python): version python package from git tag
automatic detection of version from git tag and update of the python version file
This commit is contained in:
4
.github/workflows/release.yml
vendored
4
.github/workflows/release.yml
vendored
@@ -113,6 +113,9 @@ jobs:
|
||||
cd ${{ github.workspace }}/concrete/concrete-ffi
|
||||
RUSTFLAGS="-C target-cpu=native" cargo build --release
|
||||
|
||||
- name: Update Python Version
|
||||
run: cd compiler && make update_python_version
|
||||
|
||||
- name: Build
|
||||
id: build-wheel-macos
|
||||
run: |
|
||||
@@ -156,4 +159,3 @@ jobs:
|
||||
asset_path: ${{ github.workspace }}/compiler/tarballs/${{ steps.build-mac-tarball.outputs.ASSET_NAME }}
|
||||
asset_name: ${{ steps.build-mac-tarball.outputs.ASSET_NAME }}
|
||||
asset_content_type: application/tar+gzip
|
||||
# TODO: version python
|
||||
|
||||
@@ -111,19 +111,22 @@ define build_image_and_copy_wheels
|
||||
docker container run --rm -v ${PWD}/../wheels:/wheels_volume concretefhe-compiler-manylinux:$(1) cp -r /wheels/. /wheels_volume/.
|
||||
endef
|
||||
|
||||
package_py38:
|
||||
package_py38: update_python_version
|
||||
$(call build_image_and_copy_wheels,cp38-cp38)
|
||||
|
||||
package_py39:
|
||||
package_py39: update_python_version
|
||||
$(call build_image_and_copy_wheels,cp39-cp39)
|
||||
|
||||
package_py310:
|
||||
package_py310: update_python_version
|
||||
$(call build_image_and_copy_wheels,cp310-cp310)
|
||||
|
||||
release_tarballs:
|
||||
docker image build -t concretefhe-compiler-manylinux:linux_x86_64_tarball -f ../builders/Dockerfile.release_tarball_linux_x86_64 ..
|
||||
docker container run --rm -v ${PWD}/../tarballs:/tarballs_volume concretefhe-compiler-manylinux:linux_x86_64_tarball cp -r /tarballs/. /tarballs_volume/.
|
||||
|
||||
update_python_version:
|
||||
echo "__version__ = \"`git describe --tags --abbrev=0 | grep -e '[0-9].*' -o`\"" > lib/Bindings/Python/zamalang/version.py
|
||||
|
||||
.PHONY: build-initialized \
|
||||
build-end-to-end-jit \
|
||||
zamacompiler \
|
||||
@@ -142,4 +145,5 @@ release_tarballs:
|
||||
package_py38 \
|
||||
package_py39 \
|
||||
package_py310 \
|
||||
release_tarballs
|
||||
release_tarballs \
|
||||
update_python_version
|
||||
|
||||
@@ -28,6 +28,7 @@ declare_mlir_python_sources(ZamalangBindingsPythonSources
|
||||
SOURCES
|
||||
zamalang/__init__.py
|
||||
zamalang/compiler.py
|
||||
zamalang/version.py
|
||||
zamalang/dialects/__init__.py
|
||||
zamalang/dialects/_ods_common.py)
|
||||
|
||||
|
||||
1
compiler/lib/Bindings/Python/zamalang/version.py
Normal file
1
compiler/lib/Bindings/Python/zamalang/version.py
Normal file
@@ -0,0 +1 @@
|
||||
__version__ = "0.1.0-rc1"
|
||||
@@ -1,6 +1,7 @@
|
||||
import os
|
||||
import subprocess
|
||||
import setuptools
|
||||
import re
|
||||
|
||||
from setuptools import Extension
|
||||
from setuptools.command.build_ext import build_ext
|
||||
@@ -10,6 +11,13 @@ def read(fname):
|
||||
return open(os.path.join(os.path.dirname(__file__), fname)).read()
|
||||
|
||||
|
||||
def find_version():
|
||||
return re.match(
|
||||
r"__version__ = \"(?P<version>.+)\"",
|
||||
read("lib/Bindings/Python/zamalang/version.py"),
|
||||
).group("version")
|
||||
|
||||
|
||||
class MakeExtension(Extension):
|
||||
def __init__(self, name, sourcedir=""):
|
||||
Extension.__init__(self, name, sources=[])
|
||||
@@ -39,7 +47,7 @@ class MakeBuild(build_ext):
|
||||
|
||||
setuptools.setup(
|
||||
name="concretefhe-compiler",
|
||||
version="0.1.0",
|
||||
version=find_version(),
|
||||
author="Zama Team",
|
||||
author_email="hello@zama.ai",
|
||||
description="Concrete Compiler",
|
||||
|
||||
Reference in New Issue
Block a user