Skip to content

Latest commit

 

History

History
129 lines (79 loc) · 5.28 KB

File metadata and controls

129 lines (79 loc) · 5.28 KB

Contributing to Model API

We welcome your input! 👐

We want to make it as simple and straightforward as possible to contribute to this project, whether it is a:

  • Bug Report
  • Discussion
  • Feature Request
  • Creating a Pull Request (PR)
  • Becoming a maintainer

Bug Report

We use GitHub issues to track the bugs. Report a bug by using Issues page.

Feature Request

We utilize GitHub issues to track the feature requests as well. If you are certain regarding the feature you are interested and have a solid proposal, you could then create the feature request by Issues page.

Development & PRs

We actively welcome your pull requests:

Getting Started

1. Fork and Clone the Repository

First, fork the Model API repository by following the GitHub documentation on forking a repo. Then, clone your forked repository to your local machine and create a new branch from master.

2. Set Up Your Development Environment

Set up your development environment to start contributing. This involves installing the required dependencies and setting up pre-commit hooks for code quality checks. Note that this guide assumes you are using Venv for python environments management. However, the steps are similar for other env managers.

Development Environment Setup Instructions
  1. Create a new python environment and install the development requirements:

    uv sync --all-extras

Making Changes

  1. Write Code: Follow the project's coding standards and write your code with clear intent. Ensure your code is well-documented and includes examples where appropriate. For code quality we use ruff, whose configuration is in pyproject.toml file.

  2. Add Tests: If your code includes new functionality, add corresponding tests using pytest to maintain coverage and reliability.

  3. Update Documentation: If you've changed APIs or added new features, update the documentation accordingly. Ensure your docstrings are clear and follow Google's docstring guide.

  4. Pass Tests and Quality Checks: Ensure the test suite passes and that your code meets quality standards by running:

    uvx pre-commit run --all-files
    uv run pytest tests/unit
    uv run python tests/accuracy/download_models.py -d data -j tests/precommit/public_scope.json -l
    uv run pytest --data=./data tests/functional
    uv run python tests/accuracy/download_models.py -d data -j tests/accuracy/public_scope.json -l
    uv run pytest --data=./data tests/accuracy/test_accuracy.py
  5. Update the Changelog: For significant changes, add a summary to the CHANGELOG.

  6. Check Licensing: Ensure you own the code or have rights to use it, adhering to appropriate licensing.

  7. Sign Your Commits: Use signed commits to certify that you have the right to submit the code under the project's license:

    git commit -S -m "Your detailed commit message"

    For more on signing commits, see GitHub's guide on signing commits.

Suppressing False Positives

If necessary, to suppress false positives from security scanning tools, add inline comment with specific syntax. Please also add a comment explaining why you decided to disable a rule or provide a risk-acceptance reason.

Bandit

Findings can be ignored inline with # nosec BXXX comments.

import subprocess # nosec B404 # this is actually fine

Details in Bandit docs.

Zizmor

Findings can be ignored inline with # zizmor: ignore[rulename] comments.

uses: actions/checkout@v3 # zizmor: ignore[artipacked] this is actually fine

Details in Zizmor docs.

Semgrep

Findings can be ignored inline with # nosemgrep: rule-id comments.

    # nosemgrep: python.lang.security.audit.dangerous-system-call.dangerous-system-call # this is actually fine
    r = os.system(' '.join(command))

Details in Semgrep docs.

Submitting Pull Requests

Once you've followed the above steps and are satisfied with your changes:

  1. Push your changes to your forked repository.
  2. Go to the original Model API repository you forked and click "New pull request".
  3. Choose your fork and the branch with your changes to open a pull request.
  4. Fill in the pull request template with the necessary details about your changes.

We look forward to your contributions!

License

You accept that your contributions will be licensed under the Apache-2.0 License if you contribute to this repository. If this is a concern, please notify the maintainers.