From f409edf436caa01a50ac8cc94d0764ca868f6ef1 Mon Sep 17 00:00:00 2001 From: Mainak Kundu Date: Fri, 24 Jun 2022 08:27:19 +0530 Subject: [PATCH] Use readme from pyfluent --- .github/workflows/ci_cd.yml | 4 +- Makefile | 7 +- README.rst | 212 ++++++++++-------------------------- doc/source/contributing.rst | 25 +++-- tox.ini | 49 --------- 5 files changed, 75 insertions(+), 222 deletions(-) delete mode 100644 tox.ini diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml index c0a5ca03..c645e388 100644 --- a/.github/workflows/ci_cd.yml +++ b/.github/workflows/ci_cd.yml @@ -161,9 +161,9 @@ jobs: - name: Install dependencies and build the library run: | - python -m pip install --upgrade pip poetry + python -m pip install --upgrade pip python -m pip install -r requirements/requirements_build.txt - poetry build + python -m build python -m twine check dist/* - name: Upload package diff --git a/Makefile b/Makefile index 9c76bff7..07fefb0f 100644 --- a/Makefile +++ b/Makefile @@ -4,11 +4,10 @@ style: install: @pip uninstall ansys-api-fluent -y - @python -m pip install --upgrade pip poetry - @python -m pip install -r requirements/requirements_build.txt + @pip install -r requirements/requirements_build.txt @pip install install_data/ansys_api_fluent-0.1.0-py3-none-any.whl - @poetry build - @pip install dist/ansys*.whl --force-reinstall + @python -m build + @pip install dist/*.whl --force-reinstall docker-pull: @pip install docker diff --git a/README.rst b/README.rst index 2cbcf488..1c35e178 100644 --- a/README.rst +++ b/README.rst @@ -1,23 +1,15 @@ PyFluent Visualization ====================== -|pyansys| |python| |pypi| |GH-CI| |codecov| |MIT| |black| +|pyansys| |pypi| |GH-CI| |MIT| |black| .. |pyansys| image:: https://img.shields.io/badge/Py-Ansys-ffc107.svg?logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAABDklEQVQ4jWNgoDfg5mD8vE7q/3bpVyskbW0sMRUwofHD7Dh5OBkZGBgW7/3W2tZpa2tLQEOyOzeEsfumlK2tbVpaGj4N6jIs1lpsDAwMJ278sveMY2BgCA0NFRISwqkhyQ1q/Nyd3zg4OBgYGNjZ2ePi4rB5loGBhZnhxTLJ/9ulv26Q4uVk1NXV/f///////69du4Zdg78lx//t0v+3S88rFISInD59GqIH2esIJ8G9O2/XVwhjzpw5EAam1xkkBJn/bJX+v1365hxxuCAfH9+3b9/+////48cPuNehNsS7cDEzMTAwMMzb+Q2u4dOnT2vWrMHu9ZtzxP9vl/69RVpCkBlZ3N7enoDXBwEAAA+YYitOilMVAAAAAElFTkSuQmCC :target: https://docs.pyansys.com/ :alt: PyAnsys -.. |python| image:: https://img.shields.io/badge/Python-%3E%3D3.7-blue - :target: https://pypi.org/project/pyfluent-visualization/ - :alt: Python - .. |pypi| image:: https://img.shields.io/pypi/v/pyfluent-visualization.svg?logo=python&logoColor=white :target: https://pypi.org/project/pyfluent-visualization :alt: PyPI -.. |codecov| image:: https://codecov.io/gh/pyansys/pyfluent-visualization/branch/main/graph/badge.svg - :target: https://codecov.io/gh/pyansys/pyfluent-visualization - :alt: Codecov - .. |GH-CI| image:: https://github.com/pyansys/pyfluent-visualization/actions/workflows/ci_cd.yml/badge.svg :target: https://github.com/pyansys/pyfluent-visualization/actions/workflows/ci_cd.yml :alt: GH-CI @@ -30,167 +22,77 @@ PyFluent Visualization :target: https://github.com/psf/black :alt: Black +Overview +-------- +The PyFluent Visualization project provides post-processing and visualization +capabilities for PyFluent using `pyvista `_ and +`matplotlib `_. -A Python wrapper for Ansys Fluent visualization - - -How to install --------------- - -At least two installation modes are provided: user and developer. - -For users -^^^^^^^^^ - -In order to install Pyfluent visualization, make sure you -have the required build system tool. To do so, run: - -.. code:: bash - - python -m pip install -U pip poetry - -Then, you can simply execute: - -.. code:: bash - - poetry run python -m pip install ansys-fluent-visualization - -For developers -^^^^^^^^^^^^^^ - -Installing Pyfluent visualization in developer mode allows -you to modify the source and enhance it. - -Before contributing to the project, please refer to the `PyAnsys Developer's guide`_. You will -need to follow these steps: - -1. Start by cloning this repository: - - .. code:: bash - - git clone https://github.com/pyansys/pyfluent-visualization - -2. Create a fresh-clean Python environment and activate it: - - .. code:: bash - - # Create a virtual environment - python -m venv .venv - - # Activate it in a POSIX system - source .venv/bin/activate - - # Activate it in Windows CMD environment - .venv\Scripts\activate.bat - - # Activate it in Windows Powershell - .venv\Scripts\Activate.ps1 - -3. Make sure you have the latest required build system and doc, testing, and CI tools: +Documentation and Issues +------------------------ +Please see the latest release `documentation `_ +page for more details. - .. code:: bash +Please feel free to post issues and other questions at `PyFluent Visualization Issues +`_. This is the best place +to post questions and code. - python -m pip install -U pip poetry tox - python -m pip install -r requirements/requirements_build.txt - python -m pip install -r requirements/requirements_doc.txt - python -m pip install -r requirements/requirements_tests.txt - - -4. Install the project in editable mode: - - .. code:: bash - - cd pyfluent-visualization - pip install install_data/ansys_api_fluent-0.1.0-py3-none-any.whl - poetry run python -m pip install . - -5. Finally, verify your development installation by running: - - .. code:: bash - - tox - - -How to testing --------------- - -This project takes advantage of `tox`_. This tool allows to automate common -development tasks (similar to Makefile) but it is oriented towards Python -development. - -Using tox -^^^^^^^^^ - -As Makefile has rules, `tox`_ has environments. In fact, the tool creates its -own virtual environment so anything being tested is isolated from the project in -order to guarantee project's integrity. The following environments commands are provided: - -- **tox -e style**: will check for coding style quality. -- **tox -e py**: checks for unit tests. -- **tox -e py-coverage**: checks for unit testing and code coverage. -- **tox -e doc**: checs for documentation building process. - - -Raw testing -^^^^^^^^^^^ - -If required, you can always call the style commands (`black`_, `isort`_, -`flake8`_...) or unit testing ones (`pytest`_) from the command line. However, -this does not guarantee that your project is being tested in an isolated -environment, which is the reason why tools like `tox`_ exist. - - -A note on pre-commit -^^^^^^^^^^^^^^^^^^^^ - -The style checks take advantage of `pre-commit`_. Developers are not forced but -encouraged to install this tool via: - -.. code:: bash - - python -m pip install pre-commit && pre-commit install - - -Documentation -------------- - -For building documentation, you can either run the usual rules provided in the -`Sphinx`_ Makefile, such us: +Installation +------------ +The ``ansys-fluent-visualization`` package currently supports Python 3.7 through Python +3.10 on Windows and Linux. -.. code:: bash +If you want to use PyFluent visualization please install the latest from `PyFluent Visualization GitHub +`_ via: - make -C doc/ html && your_browser_name doc/html/index.html +.. code:: console -However, the recommended way of checking documentation integrity is using: + pip install git+https://github.com/pyansys/pyfluent-visualization.git -.. code:: bash +If you plan on doing local "development" of PyFluent with Git, then install +with: - tox -e doc && your_browser_name .tox/doc_out/html/index.html +.. code:: console + git clone https://github.com/pyansys/pyfluent-visualization.git + cd pyfluent-visualization + pip install pip -U + pip install install_data/ansys_api_fluent-0.1.0-py3-none-any.whl # till public release + pip install -e . -Distributing +Dependencies ------------ +You will need a locally installed licensed copy of ANSYS to run Fluent, with the +first supported version being Ansys 2022 R2. + +Getting Started +--------------- -If you would like to create either source or wheel files, start by installing -the building requirements: +Basic Usage +~~~~~~~~~~~ -.. code:: bash +.. code:: python - python -m pip install -r requirements/requirements_build.txt + from ansys.fluent.visualization.pyvista import Graphics + graphics = Graphics(session=session) + temperature_contour = graphics.Contours["contour-temperature"] + temperature_contour.field = "temperature" + temperature_contour.surfaces_list = ["in1", "in2", "out1"] + temperature_contour.display("window-1") -Then, you can execute: +Above code assumes that a PyFluent session has already been created and a Fluent case +with input parameters has been set up. The `Analyzing Your Results +`_ in +the user guide has a complete example. -.. code:: bash +License and Acknowledgments +--------------------------- +``PyFluent Visualization`` is licensed under the MIT license. - poetry build - python -m twine check dist/* +This module, ``ansys-fluent-visualization`` makes no commercial claim over Ansys +whatsoever. This tool extends the functionality of ``Fluent`` by adding a Python +interface to the Fluent without changing the core behavior or license of the original +software. The use of the interactive Fluent control of ``PyFluent Visualization`` requires +a legally licensed local copy of Ansys. -.. LINKS AND REFERENCES -.. _black: https://github.com/psf/black -.. _flake8: https://flake8.pycqa.org/en/latest/ -.. _isort: https://github.com/PyCQA/isort -.. _PyAnsys Developer's guide: https://dev.docs.pyansys.com/ -.. _pre-commit: https://pre-commit.com/ -.. _pytest: https://docs.pytest.org/en/stable/ -.. _Sphinx: https://www.sphinx-doc.org/en/master/ -.. _tox: https://tox.wiki/ +To get a copy of Ansys, please visit `Ansys `_. diff --git a/doc/source/contributing.rst b/doc/source/contributing.rst index 2271127d..a457e058 100644 --- a/doc/source/contributing.rst +++ b/doc/source/contributing.rst @@ -10,19 +10,20 @@ it and all `Guidelines and Best Practices `_ before attempting to contribute to PyFluent. -The following contribution information is specific to PyFluent. +The following contribution information is specific to PyFluent Visualization. -Cloning the PyFluent Repository -------------------------------- -Run this code to clone and install the latest version of PyFluent in development -mode: +Cloning the PyFluent Visualization Repository +--------------------------------------------- +Run this code to clone and install the latest version of PyFluent Visualization in +development mode: .. code:: - git clone https://github.com/pyansys/pyfluent.git - cd pyfluent - pip install pip -U - pip install -e . + git clone https://github.com/pyansys/pyfluent-visualization.git + cd pyfluent-visualization + pip install pip -U + pip install install_data/ansys_api_fluent-0.1.0-py3-none-any.whl # till public release + pip install -e . Building Documentation ---------------------- @@ -31,7 +32,7 @@ directory of the repository: .. code:: - pip install -r requirements_docs.txt + pip install -r requirements/requirements_doc.txt cd doc make html @@ -45,8 +46,8 @@ browser. To clean the documentation you can execute this command: Posting Issues -------------- -Use the `PyFluent Issues `_ page to -submit questions, report bugs, and request new features. +Use the `PyFluent Visualization Issues `_ +page to submit questions, report bugs, and request new features. Code Style diff --git a/tox.ini b/tox.ini deleted file mode 100644 index 3589bcaf..00000000 --- a/tox.ini +++ /dev/null @@ -1,49 +0,0 @@ -[tox] -description = Default tox environments list -envlist = - style,{py37,py38,py39,py310}{,-coverage},doc -skip_missing_interpreters = true -isolated_build = true - -[gh-actions] -description = The tox environment to be executed in gh-actions for a given python version -python = - 3.7: style,py37-coverage,doc - 3.8: style,py38-coverage,doc - 3.9: style,py39-coverage,doc - 3.10: style,py310-coverage,doc - -[testenv] -description = Checks for project unit tests and coverage (if desired) -basepython = - py37: python3.7 - py38: python3.8 - py39: python3.9 - py310: python3.10 - py: python3{style,reformat,doc}: python3 -skip_install = true -whitelist_externals = - poetry -setenv = - PYTHONUNBUFFERED = yes - coverage: PYTEST_EXTRA_ARGS = --cov=ansys.fluent --cov-report=term --cov-report=xml --cov-report=html -deps = - -r{toxinidir}/requirements/requirements_tests.txt -commands =poetry install - poetry run pytest {env:PYTEST_MARKERS:} {env:PYTEST_EXTRA_ARGS:} {posargs:-vv} - -[testenv:style] -description = Checks project code style -skip_install = true -deps = - pre-commit -commands = - pre-commit install - pre-commit run --all-files --show-diff-on-failure - -[testenv:doc] -description = Check if documentation generates properly -deps = - -r{toxinidir}/requirements/requirements_doc.txt -commands =poetry install - poetry run sphinx-build -d "{toxworkdir}/doc_doctree" doc/source "{toxworkdir}/doc_out" --color -vW -bhtml