|
| 1 | +# Contributing to FlixOpt |
| 2 | + |
| 3 | +We warmly welcome contributions from the community! Whether you're fixing bugs, adding features, improving documentation, or sharing examples, your contributions are valuable. |
| 4 | + |
| 5 | +## Ways to Contribute |
| 6 | + |
| 7 | +### 🐛 Report Issues |
| 8 | +Found a bug or have a feature request? Please [open an issue](https://github.com/flixOpt/flixopt/issues) on GitHub. |
| 9 | + |
| 10 | +When reporting issues, please include: |
| 11 | +- A clear description of the problem |
| 12 | +- Steps to reproduce the issue |
| 13 | +- Expected vs. actual behavior |
| 14 | +- Your environment (OS, Python version, FlixOpt version) |
| 15 | +- Minimal code example if applicable |
| 16 | + |
| 17 | +### 💡 Share Examples |
| 18 | +Help others learn FlixOpt by contributing examples: |
| 19 | +- Real-world use cases |
| 20 | +- Tutorial notebooks |
| 21 | +- Integration examples with other tools |
| 22 | +- Add them to the `examples/` directory |
| 23 | + |
| 24 | +### 📖 Improve Documentation |
| 25 | +Documentation improvements are always welcome: |
| 26 | +- Fix typos or clarify existing docs |
| 27 | +- Add missing documentation |
| 28 | +- Translate documentation |
| 29 | +- Improve code comments |
| 30 | + |
| 31 | +### 🔧 Submit Code Contributions |
| 32 | +Ready to contribute code? Great! See the sections below for setup and guidelines. |
| 33 | + |
| 34 | +--- |
| 35 | + |
| 36 | +## Development Setup |
| 37 | + |
| 38 | +### Getting Started |
| 39 | +1. Fork and clone the repository: |
| 40 | + ```bash |
| 41 | + git clone https://github.com/flixOpt/flixopt.git |
| 42 | + cd flixopt |
| 43 | + ``` |
| 44 | + |
| 45 | +2. Install development dependencies: |
| 46 | + ```bash |
| 47 | + pip install -e ".[full, dev]" |
| 48 | + ``` |
| 49 | + |
| 50 | +3. Set up pre-commit hooks (one-time setup): |
| 51 | + ```bash |
| 52 | + pre-commit install |
| 53 | + ``` |
| 54 | + |
| 55 | +4. Verify your setup: |
| 56 | + ```bash |
| 57 | + pytest |
| 58 | + ``` |
| 59 | + |
| 60 | +### Working with Documentation |
| 61 | +FlixOpt uses [mkdocs](https://www.mkdocs.org/) to generate documentation. |
| 62 | + |
| 63 | +To work on documentation: |
| 64 | +```bash |
| 65 | +pip install -e ".[docs]" |
| 66 | +mkdocs serve |
| 67 | +``` |
| 68 | +Then navigate to http://127.0.0.1:8000/ |
| 69 | + |
| 70 | +--- |
| 71 | + |
| 72 | +## Code Quality Standards |
| 73 | + |
| 74 | +### Automated Checks |
| 75 | +We use [Ruff](https://github.com/astral-sh/ruff) for linting and formatting. After the one-time setup above, **code quality checks run automatically on every commit**. |
| 76 | + |
| 77 | +### Manual Checks |
| 78 | +To run checks manually: |
| 79 | +- `ruff check --fix .` - Check and fix linting issues |
| 80 | +- `ruff format .` - Format code |
| 81 | +- `pre-commit run --all-files` - Run all pre-commit checks |
| 82 | + |
| 83 | +### Testing |
| 84 | +- `pytest` - Run the test suite |
| 85 | +- Ensure all tests pass before submitting a PR |
| 86 | + |
| 87 | +### Coding Guidelines |
| 88 | +- Follow [PEP 8](https://pep8.org/) style guidelines |
| 89 | +- Write clear, self-documenting code with helpful comments |
| 90 | +- Include type hints for function signatures |
| 91 | +- Create or update tests for new functionality |
| 92 | +- Aim for 100% test coverage for new code |
| 93 | + |
| 94 | +--- |
| 95 | + |
| 96 | +## Workflow |
| 97 | + |
| 98 | +### Branches & Pull Requests |
| 99 | +1. Create a feature branch from `main`: |
| 100 | + ```bash |
| 101 | + git checkout -b feature/your-feature-name |
| 102 | + ``` |
| 103 | + |
| 104 | +2. Make your changes and commit them with clear messages |
| 105 | + |
| 106 | +3. Push your branch and open a Pull Request |
| 107 | + |
| 108 | +4. Ensure all CI checks pass |
| 109 | + |
| 110 | +### Branch Naming |
| 111 | +- Features: `feature/feature-name` |
| 112 | +- Bug fixes: `fix/bug-description` |
| 113 | +- Documentation: `docs/what-changed` |
| 114 | + |
| 115 | +### Commit Messages |
| 116 | +- Use clear, descriptive commit messages |
| 117 | +- Start with a verb (Add, Fix, Update, Remove, etc.) |
| 118 | +- Keep the first line under 72 characters |
| 119 | + |
| 120 | +--- |
| 121 | + |
| 122 | +## Releases |
| 123 | + |
| 124 | +We follow **Semantic Versioning** (MAJOR.MINOR.PATCH). Releases are created manually from the `main` branch by maintainers. |
| 125 | + |
| 126 | +--- |
| 127 | + |
| 128 | +## Questions? |
| 129 | + |
| 130 | +If you have questions or need help, feel free to: |
| 131 | +- Open a discussion on GitHub |
| 132 | +- Ask in an issue |
| 133 | +- Reach out to the maintainers |
| 134 | + |
| 135 | +Thank you for contributing to FlixOpt! |
0 commit comments