Skip to content

Commit

Permalink
Merge pull request #23 from ghinks/feat/distribution
Browse files Browse the repository at this point in the history
feat: poetry pypi testing
  • Loading branch information
ghinks authored Jan 15, 2025
2 parents 476add0 + 509e647 commit d169e8b
Show file tree
Hide file tree
Showing 20 changed files with 34 additions and 31 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,7 @@ jobs:
poetry run ruff check
- name: run unit tests
run: |
poetry run pytest
poetry run pytest
- name: build package
run: |
poetry build
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -160,5 +160,5 @@ cython_debug/
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
.idea/
/pr_reviews/queries/graphql.config.yml
/reviewtally/queries/graphql.config.yml
TODOS.md
20 changes: 8 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# pr-reviews
# review-tally

This tool is intended to retrieve basic statics about the reviews of pull
This tool is intended to retrieve a basic review count for the pull
requests for a GitHub organization in a given time frame. The default time
from is 2 weeks. The tool will retrieve statistics only on repositories that
have specific languages when specified.
from is 2 weeks. The tool will retrieve statistics only on all repositories in
the specified organization unless there are specific languages specified.

basic usage:
```bash
pr_reviews -o kubernetes -l python
review-tally -o expressjs -l javascript
```

which would produce the following output
Expand All @@ -22,27 +22,23 @@ user3 15
This output shows the number of reviews that each user has carried out in the
time period for the repositories that have python as a language specified.

The authors intent is to provide basic statistics about who is carrying out
reviews over a period of time so that the organization can better understand
who is contributing to the review process.

A comma separated list of languages can be provided to filter the repositories
that are included in the statistics. If no languages are provided then all of
the repositories will be included in the statistics.

multiple languages:
```bash
pr_reviews -o kubernetes -l python,go
review-tally -o kubernetes -l python,go
```

All languages:
```bash
pr_reviews -o kubernetes
review-tally -o kubernetes
```

Specifying the time frame:
```bash
pr_reviews -o kubernetes -l python -s 2021-01-01 -e 2021-01-31
review-tally -o kubernetes -l python -s 2021-01-01 -e 2021-01-31
```

## Options
Expand Down
1 change: 0 additions & 1 deletion pr_reviews/queries/__init__.py

This file was deleted.

10 changes: 5 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
[tool.poetry]
name = "pr-reviews"
name = "review_tally"
version = "0.1.0"
description = "A tool to discover who is reviewing your organization's PRs"
authors = ["ghinks <[email protected]>"]
license = "Apache"
repository = "https://github.com/ghinks/pr-reviews"
repository = "https://github.com/ghinks/github-pr-review-counter"
readme = "README.md"
packages = [
{ include = "pr_reviews/**/*" }
{ include = "reviewtally/**/*" }
]

[tool.poetry.dependencies]
Expand All @@ -31,13 +31,13 @@ requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"

[tool.poetry.scripts]
pr-reviews = "pr_reviews.main:main"
review-tally = "reviewtally.main:main"

[tool.ruff]
line-length = 79
exclude = [
"venv",
"pr_reviews/**/__init__.py",
"reviewtally/**/__init__.py",
"tests/__init__.py",
"tests/get_reviewers/__init__.py"
]
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion pr_reviews/main.py → reviewtally/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from tabulate import tabulate

from pr_reviews.queries.local_exceptions import (
from reviewtally.queries.local_exceptions import (
GitHubTokenNotDefinedError,
LoginNotFoundError,
)
Expand Down
1 change: 1 addition & 0 deletions reviewtally/queries/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
TIMEOUT = 10
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import requests

from pr_reviews.queries import TIMEOUT
from reviewtally.queries import TIMEOUT

GITHUB_TOKEN = os.getenv("GITHUB_TOKEN")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@

import requests

from pr_reviews.queries import TIMEOUT
from pr_reviews.queries.local_exceptions import GitHubTokenNotDefinedError
from reviewtally.queries import TIMEOUT
from reviewtally.queries.local_exceptions import (
GitHubTokenNotDefinedError,
)

# exceptions.py

Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion tests/get_reviewers/test_get_reviewers_rest.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import pytest
from aioresponses import aioresponses

from pr_reviews.queries.get_reviewers_rest import fetch
from reviewtally.queries.get_reviewers_rest import fetch


@pytest.fixture
Expand Down
2 changes: 1 addition & 1 deletion tests/get_reviewers/test_get_reviewers_rest_fetch.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import aiohttp
from aioresponses import aioresponses

from pr_reviews.queries.get_reviewers_rest import fetch
from reviewtally.queries.get_reviewers_rest import fetch
from tests.utils import get_reviews_url, read_reviews_file


Expand Down
2 changes: 1 addition & 1 deletion tests/get_reviewers/test_get_reviewers_rest_fetch_batch.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

from aioresponses import aioresponses

from pr_reviews.queries.get_reviewers_rest import fetch_batch
from reviewtally.queries.get_reviewers_rest import fetch_batch
from tests.utils import get_reviews_url, read_reviews_file


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from aioresponses import aioresponses

from pr_reviews.queries.get_reviewers_rest import (
from reviewtally.queries.get_reviewers_rest import (
get_reviewers_for_pull_requests,
)
from tests.utils import get_reviews_url, read_reviews_file
Expand Down
4 changes: 3 additions & 1 deletion tests/test_get_prs.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
from datetime import datetime, timezone
from unittest.mock import Mock, patch

from pr_reviews.queries.get_prs import get_pull_requests_between_dates
from reviewtally.queries.get_prs import (
get_pull_requests_between_dates,
)


class TestGetPullRequestsBetweenDates(unittest.TestCase):
Expand Down
4 changes: 2 additions & 2 deletions tests/test_get_repos_gql.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
import unittest
from unittest.mock import Mock, patch

from pr_reviews.queries.get_repos_gql import get_repos_by_language
from reviewtally.queries.get_repos_gql import get_repos_by_language


class TestGetReposByLanguage(unittest.TestCase):
@patch("pr_reviews.queries.get_repos_gql.requests.post")
@patch("reviewtally.queries.get_repos_gql.requests.post")
@patch.dict(os.environ, {"GITHUB_TOKEN": "test_token"})
def test_get_repos_by_language(self, mock_post) -> None: # noqa: ANN001
# Mock the response from the GitHub API
Expand Down

0 comments on commit d169e8b

Please sign in to comment.