Metadata-Version: 2.1
Name: python-coverage-comment
Version: 1.0
Summary: Create a Coverage report comment on Github PR
Maintainer-email: Pradeep Tammali <pradeeptammaliwork@gmail.com>
License: MIT License
        
        Copyright (c) 2024 Pradeep Tammali
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Project-URL: Homepage, https://github.com/PradeepTammali/python-coverage-comment
Project-URL: Issues, https://github.com/PradeepTammali/python-coverage-comment/issues
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.0
Classifier: Programming Language :: Python :: 3.1
Classifier: Programming Language :: Python :: 3.2
Classifier: Programming Language :: Python :: 3.3
Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Requires-Python: >=3.0
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: httpx
Requires-Dist: jinja2

# python-coverage-comment

Create a Coverage report comment on Github PR

run:

```bash
GITHUB_REPOSITORY=<repository_name> \
COVERAGE_PATH=<path_to_coverage_report> \
GITHUB_TOKEN=<github_token> \
GITHUB_PR_NUMBER=<pull_request_number> \
codecov
```

## Setting up Local Environment using Pipenv

To get started, follow these steps:

1. Clone the repository:

    ```bash
    git clone <repository_url>
    ```

2. Navigate to the cloned repository:

    ```bash
    cd <repository_directory>
    ```

3. Build the project:

    ```bash
    make all
    ```

4. **Export the required environment variables**:

    ```bash
    export GITHUB_REPOSITORY=<repository_name>
    export COVERAGE_PATH=<path_to_coverage_report>
    export GITHUB_TOKEN=<github_token>
    export GITHUB_PR_NUMBER=<pull_request_number>
    ```

5. **Run the action**:

    ```bash
    make run
    ```

## Required Environment Variables

- `GITHUB_REPOSITORY`: The name of the GitHub repository where the action is running.
- `COVERAGE_PATH`: The path to the coverage report file. (JSON format)
- `GITHUB_TOKEN`: The GitHub token used for authentication.
- `GITHUB_PR_NUMBER`: The number of the pull request where the action is running. (Optional)
- `GITHUB_REF`: The branch to run the action on. If not provided, it will be used to get the PR number. (Optional)

Note: Either `GITHUB_PR_NUMBER` or `GITHUB_REF` is required.

## Optional Environment Variables

- `GITHUB_BASE_REF`: The base branch for the pull request. Default is `main`.
- `SUBPROJECT_ID`: The ID of the subproject. (Optional)
- `MINIMUM_GREEN`: The minimum coverage percentage for green status. Default is 100.
- `MINIMUM_ORANGE`: The minimum coverage percentage for orange status. Default is 70.
- `ANNOTATE_MISSING_LINES`: Whether to annotate missing lines in the coverage report. Default is False.
- `ANNOTATION_TYPE`: The type of annotation to use for missing lines. Default is 'warning'.
- `MAX_FILES_IN_COMMENT`: The maximum number of files to include in the coverage report comment. Default is 25.
- `COMPLETE_PROJECT_REPORT`: Whether to include the complete project coverage report in the comment. Default is False.
- `DEBUG`: Whether to enable debug mode. Default is False.

That's it! You have successfully cloned the repository and built the project.

## Custom Installation

1. Install Python: Make sure you have Python installed on your system.
You can download and install Python from the official Python website.

2. Install Pipenv: Pipenv is a package manager that combines pip and virtualenv.
You can install Pipenv using pip, the Python package installer.
Open your terminal or command prompt and run the following command:

    ```bash
    pip install pipenv
    ```

3. Install project dependencies:
To install the project dependencies specified in the Pipfile, run the following command:

    ```bash
    pipenv install --dev
    ```

4. Activate the virtual environment:
To activate the virtual environment created by Pipenv, run the following command:

    ```bash
    pipenv shell
    ```

5. Run your project:
You can now run your project using the activated virtual environment.
For example, if your project has a run.py file, you can run it using the following command:

    ```bash
    python run.py
    ```

6. Install pre-commit hooks: To set up pre-commit hooks for your project, run the following command:

    ```bash
    pipenv run pre-commit install
    ```

    This will install and configure pre-commit hooks that will run before each commit to enforce code quality and style standards.

That's it! You have successfully set up your local environment using Pipenv.

This project is inspired by the concepts of [py-cov-action/python-coverage-comment-action](https://github.com/py-cov-action/python-coverage-comment-action.git).
