Contribute#

Follow the PyAnsys developer’s guide when contributing to PyLumerical-MCP.

You can contribute to PyLumerical-MCP in several ways:

  • Report bugs by opening an issue on GitHub.

  • Contribute to the documentation with text and examples.

Install PyLumerical-MCP in developer mode#

  1. Clone the repository:

    git clone https://github.com/ansys/pylumerical-mcp
    
  2. Create a clean Python virtual environment:

    # Create a virtual environment
    python -m venv .venv
    
  3. Activate the virtual environment:

    source .venv/bin/activate
    
    .venv\\Scripts\\activate.bat
    
    .venv\\Scripts\\Activate.ps1
    
  4. Install PyLumerical in editable mode:

    python -m pip install -U pip
    python -m pip install -e .
    
  5. Install additional requirements as needed for documentation and tests:

    python -m pip install .[tests]
    python -m pip install .[doc]
    

Follow code style guidelines#

Use pre-commit to ensure that your code meets the style requirements for PyLumerical before opening a pull request. The automatic CI/CD pipeline uses the same checks as pre-commit, so you should run pre-commit locally first.

To install pre-commit and check all your files, run these commands:

pip install pre-commit
pre-commit run --all-files

You can also set up pre-commit as a Git hook to automatically run before you commit changes.

pre-commit install

Run tests#

PyLumerical-MCP uses pytest for testing. To run the test suite, install the test requirements and then run this command from the repository root:

pytest

Build the documentation#

PyLumerical-MCP uses Sphinx for documentation.

To build the documentation, install the documentation requirements and then run this command from the /doc directory:

.\\make.bat html
make html

The documentation generated is in the doc/_build/html directory.

You can also clean the documentation build directory:

.\\make.bat clean
make clean