diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml index d8fbc9c83..79ca2b0ac 100644 --- a/.github/workflows/ci_cd.yml +++ b/.github/workflows/ci_cd.yml @@ -10,7 +10,8 @@ on: env: MAIN_PYTHON_VERSION: '3.10' - PACKAGE_NAME: ansys-motorcad-core + LIBRARY_NAME: ansys-motorcad-core + LIBRARY_NAMESPACE: 'ansys.motorcad.core' CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} DOCUMENTATION_CNAME: 'motorcad.docs.pyansys.com' @@ -24,7 +25,7 @@ jobs: name: Code style runs-on: ubuntu-latest steps: - - name: PyAnsys code style checks + - name: Ansys code style checks uses: ansys/actions/code-style@v4 with: python-version: ${{ env.MAIN_PYTHON_VERSION }} @@ -33,7 +34,7 @@ jobs: name: Documentation Style Check runs-on: ubuntu-latest steps: - - name: PyAnsys documentation style checks + - name: Ansys documentation style checks uses: ansys/actions/doc-style@v4 with: token: ${{ secrets.GITHUB_TOKEN }} @@ -46,14 +47,16 @@ jobs: fail-fast: false matrix: os: [windows-latest] - python-version: ['3.7', '3.8', '3.9', '3.10'] + python-version: ['3.8', '3.9', '3.10', '3.11'] steps: - name: Build wheelhouse and perform smoke test uses: ansys/actions/build-wheelhouse@v4 with: - library-name: ${{ env.PACKAGE_NAME }} + library-name: ${{ env.LIBRARY_NAME }} + library-namespace: ${{ env.LIBRARY_NAMESPACE }} operating-system: ${{ matrix.os }} python-version: ${{ matrix.python-version }} + check-licenses: false tests: @@ -149,7 +152,7 @@ jobs: - name: Build library source and wheel artifacts uses: ansys/actions/build-library@v4 with: - library-name: ${{ env.PACKAGE_NAME }} + library-name: ${{ env.LIBRARY_NAME }} python-version: ${{ env.MAIN_PYTHON_VERSION }} release: @@ -161,7 +164,7 @@ jobs: - name: Release to PyPI repository uses: ansys/actions/release-pypi-public@v4 with: - library-name: ${{ env.PACKAGE_NAME }} + library-name: ${{ env.LIBRARY_NAME }} twine-username: __token__ twine-token: ${{ secrets.PYPI_TOKEN }} diff --git a/pyproject.toml b/pyproject.toml index 38c6ee186..498df3675 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,10 +4,10 @@ build-backend = "flit_core.buildapi" [project] name="ansys-motorcad-core" -dynamic = ["version"] +version = "0.2.dev0" description = "Pythonic interface to Ansys Motor-CAD." readme = "README.rst" -requires-python = ">=3.7" +requires-python = ">=3.8" license = {file = "LICENSE"} authors = [ {name = "Ansys, Inc.", email = "pyansys.core@ansys.com"}, @@ -30,6 +30,7 @@ dependencies = [ "psutil >= 5.9.0", "requests >= 2.27.1", "packaging >= 21.3", + "importlib-metadata>=4.0", ] [project.optional-dependencies] diff --git a/src/ansys/motorcad/core/__init__.py b/src/ansys/motorcad/core/__init__.py index b563354d0..dad7ed2e0 100644 --- a/src/ansys/motorcad/core/__init__.py +++ b/src/ansys/motorcad/core/__init__.py @@ -1,6 +1,8 @@ """PyMotorCAD is a Python RPC-JSON interface for Motor-CAD.""" - -__version__ = "0.2.dev0" +try: + import importlib.metadata as importlib_metadata +except ModuleNotFoundError: # pragma: no cover + import importlib_metadata import ansys.motorcad.core.geometry from ansys.motorcad.core.motorcad_methods import MotorCAD, MotorCADCompatibility @@ -10,3 +12,7 @@ set_motorcad_exe, set_server_ip, ) + +# Read from the pyproject.toml +# major, minor, patch +__version__ = importlib_metadata.version("ansys-motorcad-core")