diff --git a/.github/workflows/ci-build.yml b/.github/workflows/ci-build.yml index cca98115..ebf95801 100644 --- a/.github/workflows/ci-build.yml +++ b/.github/workflows/ci-build.yml @@ -1,41 +1,214 @@ -# Build documentation -name: Documentation Build +name: GitHub CI +on: + pull_request: + workflow_dispatch: + push: + tags: + - "*" + branches: + - main -on: [push, pull_request, workflow_dispatch] +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +env: + PACKAGE_NAME: pyansys + MAIN_PYTHON_VERSION: '3.9' jobs: - docs_build: - runs-on: ubuntu-20.04 + style: + name: Code Style Check + runs-on: ubuntu-latest steps: - # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - - name: Setup Python - uses: actions/setup-python@v2.1.4 + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: ${{ env.MAIN_PYTHON_VERSION }} + + - name: Install pre-commit + run: pip install pre-commit + + - name: Run pre-commit + run: pre-commit run --all-files --show-diff-on-failure + + docs-style: + name: Documentation Style Check + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Running Vale + uses: errata-ai/vale-action@reviewdog + env: + GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} + with: + files: '["doc", "README.rst"]' + reporter: github-pr-check + level: error + filter_mode: nofilter + fail_on_error: true + vale_flags: "--config=doc/.vale.ini" + + core-import: + name: Build core PyAnsys packages + runs-on: ${{ matrix.os }} + needs: [style] + strategy: + matrix: + os: [windows-latest, ubuntu-latest, macos-latest] + python-version: ['3.7', '3.8', '3.9'] + fail-fast: false + + steps: + - uses: actions/checkout@v3 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 with: - python-version: 3.8 + python-version: ${{ matrix.python-version }} - - name: Style Check + - name: Linux pip cache + uses: actions/cache@v3 + if: ${{ runner.os == 'Linux' }} + with: + path: ~/.cache/pip + key: Python-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('pyproject.toml') }}-core + restore-keys: | + Python-${{ runner.os }}-${{ matrix.python-version }} + + - name: Window pip cache + uses: actions/cache@v3 + if: ${{ runner.os == 'Windows' }} + with: + path: ~\AppData\Local\pip\Cache + key: Python-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('pyproject.toml') }}-core + restore-keys: | + Python-${{ runner.os }}-${{ matrix.python-version }} + + - name: MacOS pip cache + uses: actions/cache@v3 + if: ${{ runner.os == 'macOS' }} + with: + path: ~/Library/Caches/pip + key: Python-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('pyproject.toml') }}-core + restore-keys: | + Python-${{ runner.os }}-${{ matrix.python-version }} + + - name: Install core PyAnsys packages run: | - pip install -r requirements_style.txt --disable-pip-version-check - make + pip install . + + - name: Smoke test + run: python -c "from pyansys import __version__; print(__version__)" + + - name: Store version + run: | + echo "::set-output name=PYANSYS_VERSION::$(python -c "from pyansys import __version__; print(__version__)")" + id: version + + - name: Generate wheelhouse + run: | + pip install wheel + pip wheel . -w wheelhouse + + - name: Zip wheelhouse + uses: vimtor/action-zip@v1 + with: + files: wheelhouse + dest: ${{ env.PACKAGE_NAME }}-v${{ steps.version.outputs.PYANSYS_VERSION }}-wheelhouse-${{ runner.os }}-${{ matrix.python-version }}-core.zip + + - name: Upload Wheelhouse + uses: actions/upload-artifact@v3 + with: + name: ${{ env.PACKAGE_NAME }}-v${{ steps.version.outputs.PYANSYS_VERSION }}-wheelhouse-${{ runner.os }}-${{ matrix.python-version }}-core + path: '*.zip' + retention-days: 7 + + extras-import: + name: Build extras PyAnsys packages + runs-on: ${{ matrix.os }} + needs: [style, core-import] + strategy: + matrix: + os: [windows-latest, ubuntu-latest, macos-latest] + python-version: ['3.7', '3.8', '3.9'] + extras-version: ['fluent-all', 'mapdl-all', 'all'] + fail-fast: false + + steps: + - uses: actions/checkout@v3 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + + - name: Linux pip cache + uses: actions/cache@v3 + if: ${{ runner.os == 'Linux' }} + with: + path: ~/.cache/pip + key: Python-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('pyproject.toml') }}-${{ matrix.extras-version }} + restore-keys: | + Python-${{ runner.os }}-${{ matrix.python-version }} + + - name: Window pip cache + uses: actions/cache@v3 + if: ${{ runner.os == 'Windows' }} + with: + path: ~\AppData\Local\pip\Cache + key: Python-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('pyproject.toml') }}-${{ matrix.extras-version }} + restore-keys: | + Python-${{ runner.os }}-${{ matrix.python-version }} + + - name: MacOS pip cache + uses: actions/cache@v3 + if: ${{ runner.os == 'macOS' }} + with: + path: ~/Library/Caches/pip + key: Python-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('pyproject.toml') }}-${{ matrix.extras-version }} + restore-keys: | + Python-${{ runner.os }}-${{ matrix.python-version }} + + - name: Install ${{ matrix.extras-version }} PyAnsys packages + run: | + pip install .[${{ matrix.extras-version }}] + + - name: Smoke test + run: python -c "from pyansys import __version__; print(__version__)" + + docs-build: + name: Building Documentation + runs-on: ubuntu-latest + needs: [docs-style] + + steps: + - uses: actions/checkout@v3 + + - name: Setup Python + uses: actions/setup-python@v4 + with: + python-version: ${{ env.MAIN_PYTHON_VERSION }} - name: Build Documentation run: | - pip install -r requirements_docs.txt + pip install .[docs] make -C doc html touch doc/build/html/.nojekyll - name: Upload Documentation - uses: actions/upload-artifact@v2.2.1 + uses: actions/upload-artifact@v3 with: name: Documentation path: doc/build/html retention-days: 7 - name: Deploy Docs - uses: JamesIves/github-pages-deploy-action@4.1.0 + uses: JamesIves/github-pages-deploy-action@v4.4.0 if: startsWith(github.event.ref, 'refs/tags') with: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -43,17 +216,72 @@ jobs: FOLDER: doc/build/html CLEAN: true - - name: Lint package dist + package: + name: Package library + runs-on: ubuntu-latest + needs: [docs-build, core-import] + steps: + - uses: actions/checkout@v3 + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: ${{ env.MAIN_PYTHON_VERSION }} + + - name: Cache pip + uses: actions/cache@v3 + with: + path: ~/.cache/pip + key: Python-${{ runner.os }}-${{ env.MAIN_PYTHON_VERSION }}-${{ hashFiles('pyproject.toml') }}-core + restore-keys: | + Python-${{ runner.os }}-${{ env.MAIN_PYTHON_VERSION }} + + - name: Install dependencies and build the library run: | - pip install twine - python setup.py sdist - twine check dist/* + python -m pip install --upgrade pip poetry twine + python -m poetry build + python -m twine check dist/* - - name: Upload to PyPi - if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags') + - name: Install PyAnsys from wheel run: | - twine upload --skip-existing dist/* + pip install dist/*.whl + + - name: Upload wheel and binaries + uses: actions/upload-artifact@v3 + with: + name: PyAnsys-packages + path: dist/ + retention-days: 7 + + release: + name: Release project + if: github.event_name == 'push' && contains(github.ref, 'refs/tags') + needs: [docs-build, core-import, package] + runs-on: ubuntu-latest + steps: + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: ${{ env.MAIN_PYTHON_VERSION }} + + - uses: actions/download-artifact@v3 + + - name: Display structure of downloaded files + run: ls -R + + - name: Upload to Public PyPi + run: | + pip install twine + twine upload --skip-existing ./**/*.whl + twine upload --skip-existing ./**/*.tar.gz env: - TWINE_USERNAME: "__token__" - TWINE_PASSWORD: ${{ secrets.TWINE_TOKEN }} - TWINE_REPOSITORY_URL: "https://upload.pypi.org/legacy/" + TWINE_USERNAME: __token__ + TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} + + - name: Release + uses: softprops/action-gh-release@v1 + with: + files: | + ./**/*.zip + ./**/*.whl + ./**/*.tar.gz \ No newline at end of file diff --git a/.gitignore b/.gitignore index 4f548b17..86e810f6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,165 @@ -*~ -*.egg-info -dist/* -doc/build/* -.mypy_cache/* \ No newline at end of file +# Created by https://www.toptal.com/developers/gitignore/api/python +# Edit at https://www.toptal.com/developers/gitignore?templates=python + +### Python ### +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +wheelhouse/ +share/python-wheels/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.nox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +*.py,cover +.hypothesis/ +.pytest_cache/ +cover/ +.cov + +# Translations +*.mo +*.pot + +# Django stuff: +*.log +local_settings.py +db.sqlite3 +db.sqlite3-journal + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +doc/_build/ +doc/**/_autosummary +doc/source/examples/* + +# PyBuilder +.pybuilder/ +target/ + +# Jupyter Notebook +.ipynb_checkpoints + +# IPython +profile_default/ +ipython_config.py + +# pyenv +# For a library or package, you might want to ignore these files since the code is +# intended to run in multiple environments; otherwise, check them in: +# .python-version + +# pipenv +# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. +# However, in case of collaboration, if having platform-specific dependencies or dependencies +# having no cross-platform support, pipenv may install dependencies that don't work, or not +# install all needed dependencies. +#Pipfile.lock + +# poetry +# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. +# This is especially recommended for binary packages to ensure reproducibility, and is more +# commonly ignored for libraries. +# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control +#poetry.lock + +# PEP 582; used by e.g. github.com/David-OConnor/pyflow +__pypackages__/ + +# Celery stuff +celerybeat-schedule +celerybeat.pid + +# SageMath parsed files +*.sage.py + +# Environments +.env +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ + +# Spyder project settings +.spyderproject +.spyproject + +# Rope project settings +.ropeproject + +# mkdocs documentation +/site + +# mypy +.mypy_cache/ +.dmypy.json +dmypy.json + +# Pyre type checker +.pyre/ + +# pytype static type analyzer +.pytype/ + +# Cython debug symbols +cython_debug/ + +#VSCode +.vscode + +# PyCharm +# JetBrains specific template is maintainted in a separate JetBrains.gitignore that can +# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore +# and can be added to the global gitignore or merged into this file. For a more nuclear +# option (not recommended) you can uncomment the following to ignore the entire idea folder. +#.idea/ + +# End of https://www.toptal.com/developers/gitignore/api/python diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 00000000..6a235058 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,41 @@ +repos: + +- repo: https://github.com/psf/black + rev: 22.3.0 + hooks: + - id: black + +- repo: https://github.com/pycqa/isort + rev: 5.10.1 + hooks: + - id: isort + +- repo: https://gitlab.com/PyCQA/flake8 + rev: 4.0.1 + hooks: + - id: flake8 + +- repo: https://github.com/codespell-project/codespell + rev: v2.1.0 + hooks: + - id: codespell + args: ["--ignore-words=ignore_words.txt"] + +- repo: https://github.com/pycqa/pydocstyle + rev: 6.1.1 + hooks: + - id: pydocstyle + additional_dependencies: [toml] + exclude: "tests/" + +- repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.1.0 + hooks: + - id: check-merge-conflict + - id: debug-statements + +# this validates our github workflow files +- repo: https://github.com/python-jsonschema/check-jsonschema + rev: 0.14.0 + hooks: + - id: check-github-workflows \ No newline at end of file diff --git a/Makefile b/Makefile deleted file mode 100644 index 9608732f..00000000 --- a/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -# Simple makefile to simplify repetitive build env management tasks under posix - -CODESPELL_DIRS ?= ./ -CODESPELL_SKIP ?= "*.pyc,*.txt,*.gif,*.png,*.jpg,*.js,*.html,*.doctree,*.ttf,*.woff,*.woff2,*.eot,*.mp4,*.inv,*.pickle,*.ipynb,flycheck*,./.git/*,./.hypothesis/*,*.yml,./docs/build/*,./docs/images/*,./dist/*,*~,.hypothesis*,./docs/source/examples/*,*cover,*.dat,*.mac,\#*,build,*.mypy_cache/*" -CODESPELL_IGNORE ?= "ignore_words.txt" - -all: codespell - -codespell: - @echo "Running codespell" - @codespell $(CODESPELL_DIRS) -S $(CODESPELL_SKIP) -I $(CODESPELL_IGNORE) diff --git a/build/lib/pyansys/__init__.py b/build/lib/pyansys/__init__.py deleted file mode 100644 index d0a427ad..00000000 --- a/build/lib/pyansys/__init__.py +++ /dev/null @@ -1,2 +0,0 @@ - -# raise NotImplementedError(NOTIMPLEMENTED) diff --git a/build/lib/pyansys/_version.py b/build/lib/pyansys/_version.py deleted file mode 100644 index f034c671..00000000 --- a/build/lib/pyansys/_version.py +++ /dev/null @@ -1,11 +0,0 @@ -"""Version for pyansys landing package - -This needs to be incremented to build new notes on the PyPi page. - -""" - -# major, minor, patch -version_info = 0, 63, 'dev0' - -# Nice string for the version -__version__ = '.'.join(map(str, version_info)) diff --git a/doc/.vale.ini b/doc/.vale.ini new file mode 100644 index 00000000..617b6bea --- /dev/null +++ b/doc/.vale.ini @@ -0,0 +1,32 @@ +# Core settings +# ============= + +# Location of our `styles` +StylesPath = "styles" + +# The options are `suggestion`, `warning`, or `error` (defaults to “warning”). +MinAlertLevel = warning + +# By default, `code` and `tt` are ignored. +IgnoredScopes = code, tt + +# By default, `script`, `style`, `pre`, and `figure` are ignored. +SkippedScopes = script, style, pre, figure + +# WordTemplate specifies what Vale will consider to be an individual word. +WordTemplate = \b(?:%s)\b + +# List of Packages to be used for our guidelines +Packages = Google + +# Define the Ansys vocabulary +Vocab = ANSYS + +[*.{md,rst}] + +# Apply the following styles +BasedOnStyles = Vale, Google + +# Removing Google-specific rule - Not applicable under some circumstances +Google.WordList = NO +Google.Colons = NO \ No newline at end of file diff --git a/doc/source/conf.py b/doc/source/conf.py index 60167183..c223be6d 100755 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -1,26 +1,20 @@ """Configuration file for docs.pyansys.com landing page.""" from datetime import datetime -from io import open as io_open -import os from ansys_sphinx_theme import pyansys_logo_black -project = 'pyansys-landing' -copyright = f"(c) {datetime.now().year} ANSYS, Inc. All rights reserved" -author = 'ANSYS Inc.' +from pyansys import __version__ as pyansys_version -# Get version from version info: execute file from raw string -__version__ = None -this_file = os.path.dirname(__file__) -version_file = os.path.join(this_file, '..', '..', 'pyansys', '_version.py') -with io_open(version_file, mode='r') as fd: - exec(fd.read()) +project = "pyansys-landing" +copyright = f"(c) {datetime.now().year} ANSYS, Inc. All rights reserved" +author = "ANSYS Inc." -release = version = __version__ +# get the PyAnsys version +release = version = pyansys_version # use the default pyansys logo html_logo = pyansys_logo_black -html_theme = 'ansys_sphinx_theme' +html_theme = "ansys_sphinx_theme" # specify the location of your github repo html_theme_options = { @@ -35,7 +29,7 @@ extensions = [] # The suffix(es) of source filenames. -source_suffix = '.rst' +source_suffix = ".rst" # The master toctree document. -master_doc = 'index' +master_doc = "index" diff --git a/doc/styles/.gitignore b/doc/styles/.gitignore new file mode 100644 index 00000000..943db7cb --- /dev/null +++ b/doc/styles/.gitignore @@ -0,0 +1,4 @@ +* +!Vocab +!Vocab/** +!.gitignore \ No newline at end of file diff --git a/doc/styles/Vocab/ANSYS/accept.txt b/doc/styles/Vocab/ANSYS/accept.txt new file mode 100644 index 00000000..06d269c5 --- /dev/null +++ b/doc/styles/Vocab/ANSYS/accept.txt @@ -0,0 +1,16 @@ +ANSYS +Ansys +ansys +postprocessing +PyAnsys +Pythonic +PyAEDT +DPF +PyMAPDL +PyMAPDL Reader +PyDPF-Core +PyDPF-Post +PyDPF +PyFluent +PyPIM +Granta MI BoM Analytics \ No newline at end of file diff --git a/doc/styles/Vocab/ANSYS/reject.txt b/doc/styles/Vocab/ANSYS/reject.txt new file mode 100644 index 00000000..e69de29b diff --git a/pyansys/__init__.py b/pyansys/__init__.py deleted file mode 100644 index d0a427ad..00000000 --- a/pyansys/__init__.py +++ /dev/null @@ -1,2 +0,0 @@ - -# raise NotImplementedError(NOTIMPLEMENTED) diff --git a/pyansys/_version.py b/pyansys/_version.py deleted file mode 100644 index f034c671..00000000 --- a/pyansys/_version.py +++ /dev/null @@ -1,11 +0,0 @@ -"""Version for pyansys landing package - -This needs to be incremented to build new notes on the PyPi page. - -""" - -# major, minor, patch -version_info = 0, 63, 'dev0' - -# Nice string for the version -__version__ = '.'.join(map(str, version_info)) diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 00000000..d4277225 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,75 @@ +[build-system] +requires = ["poetry-core>=1.0.0"] +build-backend = "poetry.core.masonry.api" + +[tool.poetry] +# Check https://flit.readthedocs.io/en/latest/pyproject_toml.html for all available sections +name = "pyansys" +version = "2023.1.dev0" +description = "Pythonic interfaces to Ansys products" +readme = "README.rst" +license = "MIT" +homepage = "https://github.com/pyansys" +repository = "https://github.com/pyansys/pyansys_landing" +documentation = "https://docs.pyansys.com/" +authors = [ + "ANSYS, Inc. ", +] +maintainers = [ + "PyAnsys developers ", +] +classifiers = [ + 'Development Status :: 4 - Beta', + 'Intended Audience :: Science/Research', + 'Topic :: Scientific/Engineering :: Information Analysis', + 'License :: OSI Approved :: MIT License', + 'Operating System :: Microsoft :: Windows', + 'Operating System :: POSIX', + 'Operating System :: MacOS', + 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.8', + 'Programming Language :: Python :: 3.9', +] + +packages = [ + { include = "pyansys", from = "src" }, +] + +[tool.poetry.dependencies] +python = ">=3.7,<4.0" +importlib-metadata = {version = "^4.0", python = "<3.8"} +ansys-mapdl-core = "==0.63.1" + +ansys-dpf-core = "==0.4.2" +ansys-dpf-post = "==0.2.2" +ansys-fluent-core = "==0.10.1" +pyaedt = "==0.5.11" +ansys-platform-instancemanagement = "==1.0.2" +ansys-grantami-bomanalytics = "==1.0.1" +ansys-openapi-common = "==1.1.1" + +# Optional dependencies +ansys-mapdl-reader = {version = "==0.51.15", optional = true} +# ansys-fluent-visualization = {version = "==0.4.0", optional = true} +ansys-fluent-parametric = {version = "==0.4.1", optional = true} +Sphinx = {version = "==5.1.1", optional = true} +ansys-sphinx-theme = {version = "==0.4.2", optional = true} + +[tool.poetry.extras] +mapdl-all = ["ansys-mapdl-reader"] +# fluent-all = ["ansys-fluent-visualization","ansys-fluent-parametric",] +fluent-all = ["ansys-fluent-parametric",] +# all = ["ansys-mapdl-reader","ansys-fluent-visualization","ansys-fluent-parametric"] +all = ["ansys-mapdl-reader","ansys-fluent-parametric"] +docs = ["Sphinx", "ansys-sphinx-theme"] + + +[tool.black] +line-length = 100 + +[tool.isort] +profile = "black" +force_sort_within_sections = true +line_length = 100 +default_section = "THIRDPARTY" +src_paths = ["doc", "src"] diff --git a/requirements_docs.txt b/requirements_docs.txt deleted file mode 100644 index 97b8708e..00000000 --- a/requirements_docs.txt +++ /dev/null @@ -1,2 +0,0 @@ -Sphinx==5.1.1 -ansys-sphinx-theme==0.4.2 diff --git a/requirements_style.txt b/requirements_style.txt deleted file mode 100755 index f8512470..00000000 --- a/requirements_style.txt +++ /dev/null @@ -1,3 +0,0 @@ -codespell==2.1.0 - - diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 4e51572e..00000000 --- a/setup.cfg +++ /dev/null @@ -1,2 +0,0 @@ -[build_ext] -debug = 1 \ No newline at end of file diff --git a/setup.py b/setup.py deleted file mode 100644 index 1a909e9e..00000000 --- a/setup.py +++ /dev/null @@ -1,66 +0,0 @@ -"""Installation file for ansys-mapdl-core""" -import sys -import os -from io import open as io_open - -from setuptools import setup - -# Get version from version info: execute file from raw string -__version__ = None -this_file = os.path.dirname(__file__) -version_file = os.path.join(this_file, 'pyansys', '_version.py') -with io_open(version_file, mode='r') as fd: - exec(fd.read()) - -NOTIMPLEMENTED = """ -*** PyAnsys has moved (and expanded!) *** - -To use PyAnsys you need to install the applicable packages for your -product: - -MAPDL: - -- ``pip install ansys-mapdl-core`` - -MAPDL Post-Processing: - -- ``pip install ansys-mapdl-reader`` -- ``pip install ansys-dpf-core`` -- ``pip install ansys-dpf-reader`` - -PyAEDT - -- ``pip install pyaedt`` - -""" - -# raise an error when installing but not building -if 'sdist' not in sys.argv: - sys.exit(NOTIMPLEMENTED) - - -setup( - name='pyansys', - packages=['pyansys'], - author='Ansys', - maintainer_email='pyansys.maintainers@ansys.com', - version=__version__, - description='Pythonic interfaces to Ansys products', - long_description=open('README.rst').read(), - long_description_content_type='text/x-rst', - license='MIT', - classifiers=[ - 'Development Status :: 4 - Beta', - 'Intended Audience :: Science/Research', - 'Topic :: Scientific/Engineering :: Information Analysis', - 'License :: OSI Approved :: MIT License', - 'Operating System :: Microsoft :: Windows', - 'Operating System :: POSIX', - 'Operating System :: MacOS', - 'Programming Language :: Python :: 3.6', - 'Programming Language :: Python :: 3.7', - 'Programming Language :: Python :: 3.8', - ], - url='https://github.com/pyansys', - keywords='Ansys PyAnsys', -) diff --git a/src/pyansys/__init__.py b/src/pyansys/__init__.py new file mode 100644 index 00000000..1bff07a2 --- /dev/null +++ b/src/pyansys/__init__.py @@ -0,0 +1,10 @@ +"""PyAnsys general package __init__ file.""" + +try: + import importlib.metadata as importlib_metadata +except ModuleNotFoundError: # pragma: no cover + import importlib_metadata + +# Read from the pyproject.toml +# major, minor, patch +__version__ = importlib_metadata.version("pyansys")