We warmly welcome contributions from the community! Whether you're fixing bugs, adding features, improving documentation, or sharing examples, your contributions are valuable.
Found a bug or have a feature request? Please open an issue on GitHub.
When reporting issues, please include:
- A clear description of the problem
- Steps to reproduce the issue
- Expected vs. actual behavior
- Your environment (OS, Python version, FlixOpt version)
- Minimal code example if applicable
Help others learn FlixOpt by contributing examples:
- Real-world use cases
- Tutorial notebooks
- Integration examples with other tools
- Add them to the
examples/directory
Documentation improvements are always welcome:
- Fix typos or clarify existing docs
- Add missing documentation
- Translate documentation
- Improve code comments
Ready to contribute code? Great! See the sections below for setup and guidelines.
-
Fork and clone the repository:
git clone https://github.com/flixOpt/flixopt.git cd flixopt -
Install development dependencies:
pip install -e ".[full, dev]" -
Set up pre-commit hooks (one-time setup):
pre-commit install
-
Verify your setup:
pytest
FlixOpt uses mkdocs to generate documentation.
To work on documentation:
pip install -e ".[docs]"
mkdocs serveThen navigate to http://127.0.0.1:8000/
We use Ruff for linting and formatting. After the one-time setup above, code quality checks run automatically on every commit.
To run checks manually:
ruff check --fix .- Check and fix linting issuesruff format .- Format codepre-commit run --all-files- Run all pre-commit checks
All tests are located in the tests/ directory with a flat structure:
test_component.py- Component teststest_flow.py- Flow teststest_storage.py- Storage tests- etc.
pytest- Run the full test suite (excluding examples by default)pytest tests/test_component.py- Run a specific test filepytest tests/test_component.py::TestClassName- Run a specific test classpytest tests/test_component.py::TestClassName::test_method- Run a specific testpytest -m slow- Run only slow testspytest -m examples- Run example tests (normally skipped)pytest -k "keyword"- Run tests matching a keyword
The tests/conftest.py file provides shared fixtures:
solver_fixture- Parameterized solver fixture (HiGHS, Gurobi)highs_solver- HiGHS solver instance- Coordinate configuration fixtures for timesteps, periods, scenarios
Use these fixtures by adding them as function parameters:
def test_my_feature(solver_fixture):
# solver_fixture is automatically provided by pytest
model = fx.FlowSystem(...)
model.solve(solver_fixture)- Write tests for all new functionality
- Ensure all tests pass before submitting a PR
- Aim for 100% test coverage for new code
- Use descriptive test names that explain what's being tested
- Add the
@pytest.mark.slowdecorator for tests that take >5 seconds
- Follow PEP 8 style guidelines
- Write clear, self-documenting code with helpful comments
- Include type hints for function signatures
- Create or update tests for new functionality
- Aim for 100% test coverage for new code
-
Create a feature branch from
main:git checkout -b feature/your-feature-name
-
Make your changes and commit them with clear messages
-
Push your branch and open a Pull Request
-
Ensure all CI checks pass
- Features:
feature/feature-name - Bug fixes:
fix/bug-description - Documentation:
docs/what-changed
- Use clear, descriptive commit messages
- Start with a verb (Add, Fix, Update, Remove, etc.)
- Keep the first line under 72 characters
We follow Semantic Versioning (MAJOR.MINOR.PATCH). Releases are created manually from the main branch by maintainers.
If you have questions or need help, feel free to:
- Open a discussion on GitHub
- Ask in an issue
- Reach out to the maintainers
Thank you for contributing to FlixOpt!