CodeEntropy is open-source, and we welcome contributions from the wider community to help improve and extend its functionality. This guide walks you through setting up a development environment, running tests, submitting contributions, and maintaining coding standards.
Create a virtual environment:
python -m venv codeentropy-dev source codeentropy-dev/bin/activate # Linux/macOS codeentropy-dev\Scripts\activate # Windows
Clone the repository:
git clone https://github.com/CCPBioSim/CodeEntropy.git cd CodeEntropy
Install development dependencies:
pip install -e ".[testing,docs,pre-commit]"
Run the full test suite:
pytest -v
Run tests with code coverage:
pytest --cov CodeEntropy --cov-report=term-missing
Run tests for a specific module:
pytest CodeEntropy/tests/test_CodeEntropy/test_levels.py
Run a specific test:
pytest CodeEntropy/tests/test_CodeEntropy/test_levels.py::test_select_levels
We use pre-commit hooks to maintain code quality and consistent style. To enable these hooks:
pre-commit install
This ensures:
- Formatting via
black(psf/black) - Import sorting via
isortwith theblackprofile - Linting via
flake8withflake8-pyproject - Basic checks via
pre-commit-hooks, including:- Detection of large added files
- AST validity checks
- Case conflict detection
- Executable shebang verification
- Merge conflict detection
- TOML and YAML syntax validation
To skip pre-commit checks for a commit:
git commit -n
Note
Pull requests must pass all pre-commit checks before being merged.
CodeEntropy uses GitHub Actions to automatically:
- Run all tests
- Check coding style
- Build documentation
- Validate versioning
Every pull request will trigger these checks to ensure quality and stability.
Build locally:
cd docs make html
The generated HTML files will be in docs/build/html/. Open index.html in your browser to view the documentation.
Edit docs in the following directories:
docs/user_guide/docs/developer_guide/
If you would to contribution to CodeEntropy please refer to our Contributing Guidelines
If you encounter bugs or want to request features:
- Open an issue on GitHub.
- Provide a clear description and input files if applicable.
Never commit directly to
main.Create a branch named after the issue:
git checkout -b 123-fix-levels
- Make your changes in a branch.
- Ensure tests and pre-commit checks pass.
- Submit a pull request.
- At least one core developer will review it.
- Include updated documentation and tests for new code.
Full developer setup:
git clone https://github.com/CCPBioSim/CodeEntropy.git cd CodeEntropy pip install -e .[testing,docs,pre-commit] pre-commit install pytest --cov CodeEntropy --cov-report=term-missing