Thank you for your interest in contributing to IDStools. We welcome contributions from the fusion community to help each other. Please take a moment to review the following guidelines to ensure a smooth and productive collaboration.
Please read and adhere to ITER Code of Conduct. We expect all contributors to create a welcoming and inclusive community.
Before you start, ensure you have met the following requirements:
- Python 3.8+ is installed and available
- IMAS-Core module is loaded (Optional)
Clone the repository to your local machine:
git clone https://github.com/iter-organization/IDStools.git
cd IDStoolsCreate a new branch for each contribution. Use a descriptive name for the branch. To create a new branch and switch to it:
git checkout -b feature/your-feature-name- Follow the coding style and conventions used in the project
- Follow SOLID principles while coding (read more)
- Code is organized in three main packages:
compute,view, anddomain - All calculation operations on IDS to get meaningful data are added to
compute - There is a distinct module in the
computeandviewpackages for every IDS - Each
Computeclass receives respective IDS object to operate on domainpackage is used when you have operations on 2 or more IDSs and need to return the result
- Define clear and meaningful function names (e.g.,
getBResonance,getActivePfCoils) - Write functions to be generalized and reusable by other code
- Follow the
single responsibility principlewhen writing functions - Type hints for parameters and return types are mandatory
- Docstrings with examples are helpful for others to understand what the code does
- Define clear and meaningful variable names (e.g.,
b_total,profile_2d_index) - Use PascalCase for class names
- Use snake_case for variables and function names (following Python conventions)
- Visualization scripts (console print or plots) start with
plotprefix (e.g.,plotequilibrium) - IDS-related operations like copy, performance, size are prefixed with
ids(e.g.,idscp,idsresample) - Database-related operations are prefixed with
db(e.g.,dblist)
We use the Black formatter for consistent code formatting.
To format your code:
black -l 120 idstoolsAppend formatting-related commits to the .git-blame-ignore-revs file in the root of the repository.
Configure git to ignore formatting-related commits:
git config blame.ignoreRevsFile .git-blame-ignore-revsPre-commit hooks are used in the repository. To configure them:
- Ensure pre-commit is installed:
pip install pre-commit- Install the hooks:
pre-commit installMore information:
Type checking is important to avoid runtime errors. Use mypy for static type checking:
pip install mypy
mypy idstools- Ensure your changes do not break existing functionality
- Write tests for new features or bug fixes, if applicable
- Run the project's test suite before submitting a pull request
pytest tests/Write clear and concise commit messages that describe the purpose of your changes.
Use the present tense (Add feature not Added feature).
Reference issue numbers (e.g., Fix IMAS-XXXX) if relevant.
- Create a pull request from your feature branch
- Provide a clear description of the changes and why they are necessary
- Reference any related issues
- Engage in discussions and address feedback promptly
- Be open to feedback and make necessary changes
- Respond to review comments in a timely manner
- Update your branch if requested
ITER has a Code of Conduct to maintain a respectful and inclusive community. Please follow it in all interactions.
- Check the issue tracker for open issues that need attention
- Create issues to report bugs or suggest enhancements
- Use appropriate labels and provide detailed descriptions
Join our community discussions to engage with other contributors:
- Participate in project-related discussions
- Share your insights and expertise
- Ask questions and help others
Thank you for your contributions to the IDStools project! Your involvement helps advance fusion research and supports the broader scientific community.