diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml index d00ebb0..7facbcc 100644 --- a/.github/workflows/python-publish.yml +++ b/.github/workflows/python-publish.yml @@ -2,7 +2,7 @@ name: Upload xyzcad Python Package on: release: - types: [published] + types: [created] permissions: contents: read @@ -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 }} diff --git a/Makefile b/Makefile index 338fbf8..1c7cc81 100644 --- a/Makefile +++ b/Makefile @@ -4,6 +4,7 @@ PROJ_SLUG = xyzcad SHELL = bash build: + poetry version $(shell git describe --tags --abbrev=0) poetry build lint: @@ -25,6 +26,7 @@ publish: poetry publish clean: + poetry version 0.0.0+devel rm -rf .pytest_cache \ rm -rf dist \ rm -rf build \ diff --git a/demo.py b/demo.py index d364351..2ce0239 100644 --- a/demo.py +++ b/demo.py @@ -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) diff --git a/pyproject.toml b/pyproject.toml index 3ee4a66..3aa5f92 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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 "] license = "AGPLv3" diff --git a/xyzcad/render.py b/xyzcad/render.py index c73d6a9..18f376e 100644 --- a/xyzcad/render.py +++ b/xyzcad/render.py @@ -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]] @@ -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) @@ -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))