From 1c9883abab29f86798ff9b4dca28c5b19cfb852b Mon Sep 17 00:00:00 2001 From: Michael Gale Date: Wed, 11 Jan 2023 22:38:31 -0500 Subject: [PATCH] Update to support newer version of CadQuery + OCP v.7.6+ which also requires python 3.8+ --- .travis.yml | 6 +++--- README.md | 5 +++-- cqkit/__init__.py | 2 +- cqkit/cq_discrete.py | 10 +++++----- environment.yml | 11 +++++++---- setup.py | 12 ++---------- 6 files changed, 21 insertions(+), 25 deletions(-) diff --git a/.travis.yml b/.travis.yml index 55e5f46..14148fb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,15 +9,15 @@ branches: matrix: include: - - name: "Python 3.7 - linux" - env: PYTHON_VERSION=3.7 - os: linux - name: "Python 3.8 - linux" env: PYTHON_VERSION=3.8 os: linux - name: "Python 3.9 - linux" env: PYTHON_VERSION=3.9 os: linux + - name: "Python 3.10 - linux" + env: PYTHON_VERSION=3.10 + os: linux - name: "Lint" env: PYTHON_VERSION=3.8 os: linux diff --git a/README.md b/README.md index 5ff312f..a08e520 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ # CQ-Kit ![https://pypi.org/project/cqkit/](https://img.shields.io/pypi/v/cqkit.svg) -![python version](https://img.shields.io/static/v1?label=python&message=3.6%2B&color=blue&style=flat&logo=python) +![python version](https://img.shields.io/static/v1?label=python&message=3.8%2B&color=blue&style=flat&logo=python) ![https://github.com/CadQuery/cadquery](https://img.shields.io/static/v1?label=dependencies&message=CadQuery%202.0%2B&color=blue&style=flat) ![https://github.com/michaelgale/cq-kit/blob/master/LICENSE](https://img.shields.io/badge/license-MIT-blue.svg) Code style: black @@ -48,7 +48,7 @@ If you want to create a fresh anaconda environment with **CadQuery** and **CQ-Ki $ python setup.py install ``` - Substitute your desired python `$VERSION` with 3.6, 3.7, or 3.8 and optionally replace `$MY_NAME` with a different desired environment name than the default of `cadquery` specified in `environment.yml`. + Substitute your desired python `$VERSION` with 3.8, 3.9, or 3.10 and optionally replace `$MY_NAME` with a different desired environment name than the default of `cadquery` specified in `environment.yml`. ## Basic Usage @@ -417,6 +417,7 @@ es = SharedVerticesWithObjectSelector(face1) ## Releases v.0.4.0 - First release on PyPI +v.0.5.0 - Update requires python v.3.8+ and OCP v.7.6+ CadQuery 2.1+ ## Authors diff --git a/cqkit/__init__.py b/cqkit/__init__.py index 133efd5..89b40ff 100644 --- a/cqkit/__init__.py +++ b/cqkit/__init__.py @@ -4,7 +4,7 @@ # fmt: off __project__ = 'cqkit' -__version__ = '0.4.1' +__version__ = '0.5.0' # fmt: on VERSION = __project__ + "-" + __version__ diff --git a/cqkit/cq_discrete.py b/cqkit/cq_discrete.py index 5c9ab6e..f31fb14 100644 --- a/cqkit/cq_discrete.py +++ b/cqkit/cq_discrete.py @@ -126,9 +126,9 @@ def triangle_mesh_solid(solid, lin_tol=1e-2, ang_tol=0.5): face = mesh_face.wrapped location = TopLoc_Location() facing = bt.Triangulation(face, location) - tri = facing.Triangles() + tri = facing.InternalTriangles() num_tri = facing.NbTriangles() - vtx = facing.Nodes() + vtx = facing.InternalNodes() txf = face.Location().Transformation() rev = ( True @@ -140,9 +140,9 @@ def triangle_mesh_solid(solid, lin_tol=1e-2, ang_tol=0.5): ci = [0, 2, 1] if rev else [0, 1, 2] for j in ci: pt = [ - vtx.Value(idx[j]).Transformed(txf).X(), - vtx.Value(idx[j]).Transformed(txf).Y(), - vtx.Value(idx[j]).Transformed(txf).Z(), + vtx.Value(idx[j] - 1).Transformed(txf).X(), + vtx.Value(idx[j] - 1).Transformed(txf).Y(), + vtx.Value(idx[j] - 1).Transformed(txf).Z(), ] if pt not in vertices: vertices.append(pt) diff --git a/environment.yml b/environment.yml index f37df05..1b89b4f 100644 --- a/environment.yml +++ b/environment.yml @@ -4,22 +4,25 @@ channels: - conda-forge - defaults dependencies: - - python>=3.6 + - python>=3.8 - ipython - - ocp>=7.5.1 + - numpy=1.23 + - ocp>=7.6.* - pyparsing>=2.1.9 - - sphinx=3.2.1 + - sphinx=5.0.1 - sphinx_rtd_theme - sphinx-autodoc-typehints - black=19.10b0 - codecov + - click=8.0.4 - pytest - pytest-cov - ezdxf - ipython - typing_extensions - - nptyping + - nptyping=2.0.1 - pip - pip: - "--editable=." - sphinxcadquery + - multimethod>=1.7,<2.0 diff --git a/setup.py b/setup.py index 06c2a9e..45ccb03 100644 --- a/setup.py +++ b/setup.py @@ -8,7 +8,6 @@ import setuptools PACKAGE_NAME = "cqkit" -MINIMUM_PYTHON_VERSION = "3.6" loc = os.path.abspath(os.path.dirname(__file__)) @@ -37,12 +36,6 @@ required.append(line) -def check_python_version(): - """Exit when the Python version is too low.""" - if sys.version < MINIMUM_PYTHON_VERSION: - sys.exit("Python {0}+ is required.".format(MINIMUM_PYTHON_VERSION)) - - def read_package_variable(key, filename="__init__.py"): """Read the value of a variable from the package without importing.""" module_path = os.path.join(PACKAGE_NAME, filename) @@ -65,8 +58,6 @@ def build_description(): return readme + "\n" + changelog -check_python_version() - setuptools.setup( name=read_package_variable("__project__"), version=read_package_variable("__version__"), @@ -74,6 +65,7 @@ def build_description(): url="https://github.com/michaelgale/cq-kit", author="Michael Gale", author_email="michael@fxbricks.com", + python_requires=">=3.8", packages=setuptools.find_packages(), long_description=build_description(), long_description_content_type="text/markdown", @@ -82,7 +74,7 @@ def build_description(): "Development Status :: 3 - Alpha", "Natural Language :: English", "Operating System :: OS Independent", - "Programming Language :: Python :: 3.6", + "Programming Language :: Python :: 3.8", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", ],