Thank you for considering contributing to this project! We welcome contributions from the community and are grateful for your support.
When contributing to this repository, please first discuss the change you wish to make via issue, email, or any other method with the owners before making a change.
- Be respectful and inclusive in all interactions.
- Provide constructive feedback and be open to receiving it.
- Help others in the community when possible.
- Follow the Contributor Covenant Code of Conduct.
If you find a bug or have a feature request, please open an issue on GitHub. When reporting an issue, please include:
- A clear and descriptive title
- A detailed description of the problem or suggestion
- Steps to reproduce the issue (if applicable)
- Any relevant logs, screenshots, or code snippets
- We follow Python style guide - The GDS Way
- Use meaningful variable and function names.
- We name variables using few nouns in lowercase, e.g.
mapping_namesorincrement. - We name functions using verbs in lowercase, e.g.
map_variables_to_namesorchange_values. - Follow PEP 8 style guidelines for Python code.
- Write clear, concise, and well-documented code. Include comments where necessary to explain complex logic.
- We use the Google format for documenting features using docstrings.
We welcome pull requests! To submit a pull request:
- Branch from the
devbranch. - Update the README.md and other documentation with details of major changes to the interface, this includes new environment variables, useful file locations and container parameters.
- Ensure your code follows the coding standards outlined below.
- Write or update tests as needed.
- Ensure all tests pass.
- Ensure all pre-commit checks pass. See the instructions for installing and using pre-commit below
- Once you are ready for review please open a pull/merge request to the
devbranch with a clear description of your changes and a title following the conventional-commit format (see below). - You may merge the Pull/Merge Request in once you have the sign-off of two maintainers.
When you raise a pull request (PR), please ensure the PR title follows the Conventional Commits format (see guidance gist).
The PR Conventional Commit Semantic Title Check github workflow check will fail at the bottom of your PR if the title doesn't meet the requirements.
Using conventional commit commit PR titles just involves structuring your title in the format:
<type>(<optional scope>): <description>
where:
<type>is one of the specific phases given below describing the type of change(<optional scope>)provides additional contextual information about the area of the codebase affected. If omitted also leave out the brackets.<description>contains a concise description of the change (in the imperative, present tense: "change" not "changed" nor "changes").
- Changes relevant to the API or UI:
featCommits that add, adjust or remove a new feature to the codebasefixCommits that fix a codebase bug of a precededfeatcommittestCommits that add missing tests or correct existing onesdocsCommits that exclusively affect documentationstyleCommits that address code style (e.g., white-space, formatting, missing semi-colons) and do not affect application behaviourrefactorCommits that rewrite or restructure code without altering codebase behaviourbuildCommits that affect build-related components such as build tools, dependencies, project version, CI/CD pipelines, ...choreMiscellaneous commits e.g. modifying.gitignore, ...
afcharts-py/
│
├── .github/ # Github templates and workflows
│
├── docs/
│ └── images/ # Image files
│
├── src/
│ └── afcharts/ # Main package folder
│ ├── __init__.py
│ ├── pio_template.py # Plotly template
│ ├── afcharts.mplstyle # Matplotlib stylesheet
│ └── cookbook/
│ ├── _quarto.yml
│ └── index.qmd
│ └── getting-started.qmd
|
├── tests/ # Unit tests
│
├── README.md
├── CONTRIBUTING.md
├── LICENSE.md
├── pyproject.toml
└── .gitignore
└── .pre-commit-config.yaml
uv is a powerful python package and virtual environement management tool that can be used as a stand in replacement for pip. It can be installed with python -m pip install uv. Familiar pip commands can be run with uv pip <pip command> e.g. uv pip install matplotlib, uv pip list.
To create a virtual environment (in ./.venv), install the recommended version of python and install the afcharts package and all it's dependencies run:
uv syncActivate the virtual environment on linux with
source .venv/bin/activateor on Windows with
.venv\Scripts\activateThis should display (afcharts) at the start of your terminal prompt, showing the venv is active.
afcharts will be installed in editable mode (like pip install -e .) so that changes to the code will take effect without reinstalling the package.
If you don't want to use uv, the package can be installed in developer (editable) mode from the root directory of the repository with:
pip install -e . --group test --group devThis assumes you already have a python virtual environment set up with your preferred tool (conda/virtualenv/uv etc.).
To test your installation, run pytest to confirm all unit tests pass successfully in your environment:
pytestSee docs/pytest_intro.md for guidance on adding unit tests with pytest.
Details
You can now reproduce the book (requires quarto to be installed):quarto preview ./src/afcharts/cookbook/Details
Pre-commit hooks (configured in `.pre-commit-config.yaml`) run automated checks against your changes whenever you commit code. This will:- Format your code according to agreed formatting guidelines.
- Check for common coding mistakes or deviations from best practices
To activate the pre-commit hooks run (you only have to do this once):
pre-commit installYou can test it on demand by running the following command:
pre-commit run --all-filesNow, whenever you try to make a commit, the pre-commit hooks will run to lint and format the staged files.
If your files are formatted or auto-fixed, stage (git add .) the automated formatting corrections and try committing again. If there are linting errors you may
need to manually resolve these before committing again. In some rare circumstances you may need to make a commit that bypasses/fails the pre-commit hooks, in which case you can use:
git commit --no-verify -m 'feat(SCP-___): my commit message'Details
Github actions automatically formats code using ruff.If you are using 'VS Code' IDE ensure that you change your formater in order to reduce style conflicts.
# Open the preferences
'Ctrl+,'
Search for 'Default Formatter' and change it to 'ruff'