Contribute#

Overall guidance on contributing to a PyAnsys library appears in the Contributing topic in the PyAnsys developer’s guide. Ensure that you are thoroughly familiar with this guide before attempting to contribute to PyConceptEV.

The following contribution information is specific to PyConceptEV.

Install in developer mode#

Installing PyConceptEV in developer mode allows you to modify and enhance the source.

  1. Clone the repository and move into it:

    git clone https://github.com/ansys/pyconceptpyconceptev
    cd pyconceptev
    
  2. Create a fresh-clean Python environment and activate it:

    # 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 that you have the latest required build system and documentation, testing, and CI tools:

    python -m pip install -U pip poetry tox
    
  4. Install the project in editable mode:

    poetry install
    
  5. Verify your development installation:

    tox
    

Testing#

This project takes advantage of tox. This tool lets you automate common development tasks (similar to Makefile), but it is oriented towards Python development.

Use tox#

As Makefile has rules, tox has environments. In fact, the tool creates its own virtual environment so that anything being tested is isolated from the project to guarantee the project’s integrity.

The following environment commands are provided:

  • tox -e style: Checks 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: Checks for the documentation-building process.

Perform raw testing#

If required, from the command line, you can always call style commands, such as Black, isort, and Flake8, or unit testing commands such as pytest. However, running these commands does not guarantee that your project is being tested in an isolated environment, which is the reason why tools like tox exist.

Use pre-commit#

The style checks take advantage of pre-commit. Developers are not forced but encouraged to install this tool by running this command:

python -m pip install pre-commit && pre-commit install

Documentation#

To build documentation, you can run the usual rules provided in the Sphinx Makefile:

# In Linux environment
make -C doc/ html && your_browser_name doc/html/index.html

# In Windows environment
.\doc\make.bat html && your_browser_name doc/html/index.html

However, the recommended way of checking documentation integrity is to use tox:

tox -e doc && your_browser_name .tox/doc_out/index.html

Distribution#

If you would like to create source or wheel files, run these commands to install the building requirements and then execute the build module:

poetry install --with build
python -m build
python -m twine check dist/*