Contributing and Extending PyMAD-NG
This guide is for developers who want to contribute to PyMAD-NG or extend its capabilities. It outlines the structure of the codebase, how to develop new features, and best practices for writing and testing code.
Overview of Repository Structure
File / Module |
Purpose |
|---|---|
|
Contains the main |
|
Manages subprocess communication and type handling |
|
Defines reference object wrappers ( |
|
Manages temporary variables like |
|
Utility for quoting and formatting MAD-compatible text |
|
Contains working scripts and tutorials |
|
Contains unit tests for the codebase |
|
Documentation files |
Getting Started
Prerequisites
Python 3.7+
numpy,pandas, and optionallytfs-pandasA valid MAD-NG executable (either system or bundled)
Install PyMAD-NG in Editable Mode
To contribute to PyMAD-NG, clone the repository and install it in editable mode. This allows you to make changes and test them without reinstalling. In specific cases, you may be allowed write access to the MAD-NG.py repository. If so, you only need to clone the repository and install it in editable mode.
git clone https://github.com/<your-org>/MAD-NG.py.git
cd pymadng
pip install -e .
Development Workflow
Create a Branch
git checkout -b your-feature-name
Write Code
Test Code
All tests are located in the
tests/directory, currentlyunittestsare used.
Run Tests
python -m unittest tests/*.py
Submit a Pull Request
Include a clear description of the change
Reference any related issues
Best Practices
Code Style
Use descriptive names for everything
Keep high-level user APIs separate from internal helpers
Use Ruff for code and import formatting.
Documentation
Update or extend
.mdor.rstfiles as appropriateDocument new examples in the
examples/directoryEnsure all new features are at least in the API reference
Questions or Issues?
Open a GitHub Issue
Tag maintainers in your Pull Request
See the [Debugging Guide] or [Architecture Overview] for internals
Thanks for contributing to PyMAD-NG!