Skip to content

Commit

Permalink
automatic version update and publish in github action
Browse files Browse the repository at this point in the history
  • Loading branch information
TheTesla committed Aug 2, 2024
1 parent 79d50be commit 3407cad
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 11 deletions.
11 changes: 3 additions & 8 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Upload xyzcad Python Package

on:
release:
types: [published]
types: [created]

permissions:
contents: read
Expand All @@ -22,14 +22,9 @@ jobs:
run: |
python3 -m pip install poetry
poetry install --only main
- name: Set Version
run: |
poetry version ${{ github.event.release.tag_name }}
- name: Build package
run: make build
- name: Publish package
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
run:
poetry publish --username ${{ __token__ }} --password ${{ secrets.PYPI_API_TOKEN }}

2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ PROJ_SLUG = xyzcad
SHELL = bash

build:
poetry version $(shell git describe --tags --abbrev=0)
poetry build

lint:
Expand All @@ -25,6 +26,7 @@ publish:
poetry publish

clean:
poetry version 0.0.0+devel
rm -rf .pytest_cache \
rm -rf dist \
rm -rf build \
Expand Down
2 changes: 1 addition & 1 deletion demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,6 @@ def cube(x, y, z):


# render.renderAndSave(cube, 'demo.stl', 1)
render.renderAndSave(f, "demo.stl", 0.5)
render.renderAndSave(f, "demo.stl", 0.05)

print(time.time() - t0)
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "xyzcad"
version = "0.4.6"
version = "0.0.0+devel"
description = "An implicit surface based functional CAD system"
authors = ["Stefan Helmert <[email protected]>"]
license = "AGPLv3"
Expand Down
9 changes: 8 additions & 1 deletion xyzcad/render.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
from numba import njit, objmode, prange, types
from numba.typed import Dict, List
from stl import mesh
import importlib.metadata

tlt = [[[0]]] * 256
tlt[1] = [[0, 1, 2]]
Expand Down Expand Up @@ -553,7 +554,7 @@ def convert_corners2pts(cubeCornerValsDict, r):
ptsResDict[(xh, yh, z)] = 0 < (v & 64) # v110
ptsResDict[(xh, yh, zh)] = 0 < (v & 128) # v111

cubesList = list(cubeCornerValsDict.keys())
cubesList = list(set(cubeCornerValsDict.keys()))

print(f"len(cubesList)={len(cubesList)}")
cubesArray = np.asarray(cubesList)
Expand Down Expand Up @@ -829,6 +830,12 @@ def all_njit_func(func, res, tlt):

def renderAndSave(func, filename, res=1):
t0 = time.time()
#version = importlib.metadata.version('xyzcad')
print(__package__)
print(__name__)
version = importlib.metadata.version(__package__ or __name__)
print(f"running xyzcad version {version}")

tlt_L = [List(e) for e in tlt]
verticesArray = all_njit_func(func, res, tlt_L)
print("all_njit_func time: {}".format(time.time() - t0))
Expand Down

0 comments on commit 3407cad

Please sign in to comment.