From 10f7930a2a28f770f2ebc7cca1a4ebb1b45ffbb7 Mon Sep 17 00:00:00 2001 From: apoclyps Date: Sat, 17 Apr 2021 09:52:08 +0100 Subject: [PATCH 1/5] updates pypy classifiers --- setup.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 17042df..08538c7 100644 --- a/setup.py +++ b/setup.py @@ -25,11 +25,14 @@ def _requires_from_file(filename): install_requires=_requires_from_file("requirements.txt"), entry_points={"console_scripts": ["reviews = cli:main"]}, classifiers=[ - "Development Status :: 5 - Production/Stable", + "Development Status :: 3 - Alpha", + "Environment :: Console", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", + "Natural Language :: English", "Operating System :: MacOS", "Operating System :: Microsoft :: Windows :: Windows 10", "Programming Language :: Python :: 3.9", + "Topic :: Terminals", ], ) From 8b798a281d4df676d29e41b8df67298132f4ce1a Mon Sep 17 00:00:00 2001 From: apoclyps Date: Sat, 17 Apr 2021 09:53:24 +0100 Subject: [PATCH 2/5] relocates license and code of conduct to repository root for auto-detection --- .github/CODE_OF_CONDUCT.md => CODE_OF_CONDUCT.md | 0 .github/LICENSE.md => LICENSE.md | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename .github/CODE_OF_CONDUCT.md => CODE_OF_CONDUCT.md (100%) rename .github/LICENSE.md => LICENSE.md (100%) diff --git a/.github/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md similarity index 100% rename from .github/CODE_OF_CONDUCT.md rename to CODE_OF_CONDUCT.md diff --git a/.github/LICENSE.md b/LICENSE.md similarity index 100% rename from .github/LICENSE.md rename to LICENSE.md From 7b139735d0f26984a409ebb8979c7102dac33854 Mon Sep 17 00:00:00 2001 From: apoclyps Date: Sat, 17 Apr 2021 10:20:40 +0100 Subject: [PATCH 3/5] handle installation on windows --- requirements.txt | 1 + reviews/config.py | 2 +- reviews/controller.py | 2 ++ reviews/tasks.py | 2 +- 4 files changed, 5 insertions(+), 2 deletions(-) diff --git a/requirements.txt b/requirements.txt index 1a6cc47..ac440c4 100644 --- a/requirements.txt +++ b/requirements.txt @@ -5,3 +5,4 @@ notify-py==0.3.1 PyGithub==1.54.1 python-decouple==3.4 rich==10.1.0 +idna==2.10 \ No newline at end of file diff --git a/reviews/config.py b/reviews/config.py index f19fe09..973131f 100644 --- a/reviews/config.py +++ b/reviews/config.py @@ -4,7 +4,7 @@ from decouple import Csv, config # Github Config -GITHUB_TOKEN = config("GITHUB_TOKEN", cast=str, default="") +GITHUB_TOKEN = config("GITHUB_TOKEN", cast=str) DEFAULT_PAGE_SIZE = config("DEFAULT_PAGE_SIZE", cast=int, default=100) # Database Config diff --git a/reviews/controller.py b/reviews/controller.py index b4bf8db..01208c4 100644 --- a/reviews/controller.py +++ b/reviews/controller.py @@ -15,6 +15,8 @@ def __init__(self) -> None: self.client = GithubAPI() self.manager = PullRequestManager( client=SQLClient(path=config.DATA_PATH, filename=config.FILENAME) + if config.ENABLE_PERSISTED_DATA + else None ) def retrieve_pull_requests(self, org: str, repository: str) -> Union[Table, None]: diff --git a/reviews/tasks.py b/reviews/tasks.py index 58e0f9a..5e36d3e 100644 --- a/reviews/tasks.py +++ b/reviews/tasks.py @@ -80,7 +80,7 @@ def render(): log_component=generate_log_table(logs=logs), ) - with Live(layout_manager.layout, refresh_per_second=10, screen=True): + with Live(layout_manager.layout, refresh_per_second=5, screen=True): while True: if not overall_progress or overall_progress.finished: ( From 62cd0edf78ad4a97754eca87360009f8931ec2ea Mon Sep 17 00:00:00 2001 From: apoclyps Date: Sat, 17 Apr 2021 10:25:00 +0100 Subject: [PATCH 4/5] adds CONTRIBUTING.md --- CONTRIBUTING.md | 73 +++++++++++++++++++++++++++++++++++++++++++++++++ README.md | 2 +- 2 files changed, 74 insertions(+), 1 deletion(-) create mode 100644 CONTRIBUTING.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..3e52bf3 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,73 @@ +# Contributor Code of Conduct + +## Our Pledge + +In the interest of fostering an open and welcoming environment, we as +contributors and maintainers pledge to making participation in our project and +our community a harassment-free experience for everyone, regardless of age, body +size, disability, ethnicity, gender identity and expression, level of experience, +education, socio-economic status, nationality, personal appearance, race, +religion, or sexual identity and orientation. + +## Our Standards + +Examples of behavior that contributes to creating a positive environment +include: + +* Using welcoming and inclusive language +* Being respectful of differing viewpoints and experiences +* Gracefully accepting constructive criticism +* Focusing on what is best for the community +* Showing empathy towards other community members + +Examples of unacceptable behavior by participants include: + +* The use of sexualized language or imagery and unwelcome sexual attention or + advances +* Trolling, insulting/derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or electronic + address, without explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Our Responsibilities + +Project maintainers are responsible for clarifying the standards of acceptable +behavior and are expected to take appropriate and fair corrective action in +response to any instances of unacceptable behavior. + +Project maintainers have the right and responsibility to remove, edit, or +reject comments, commits, code, wiki edits, issues, and other contributions +that are not aligned to this Code of Conduct, or to ban temporarily or +permanently any contributor for other behaviors that they deem inappropriate, +threatening, offensive, or harmful. + +## Scope + +This Code of Conduct applies both within project spaces and in public spaces +when an individual is representing the project or its community. Examples of +representing a project or community include using an official project e-mail +address, posting via an official social media account, or acting as an appointed +representative at an online or offline event. Representation of a project may be +further defined and clarified by project maintainers. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported by contacting the project team at [INSERT EMAIL ADDRESS]. All +complaints will be reviewed and investigated and will result in a response that +is deemed necessary and appropriate to the circumstances. The project team is +obligated to maintain confidentiality with regard to the reporter of an incident. +Further details of specific enforcement policies may be posted separately. + +Project maintainers who do not follow or enforce the Code of Conduct in good +faith may face temporary or permanent repercussions as determined by other +members of the project's leadership. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, +available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html + +[homepage]: https://www.contributor-covenant.org \ No newline at end of file diff --git a/README.md b/README.md index 197094a..b33464b 100644 --- a/README.md +++ b/README.md @@ -91,4 +91,4 @@ docker-compose run --rm pylint # Contributions -Please read [CONTRIBUTING.md](.github/CONTRIBUTING.md) for details on our code of conduct, and the process for submitting pull requests to us. +Please read [CONTRIBUTING.md](CONTRIBUTING.md) for details on our code of conduct, and the process for submitting pull requests to us. From c997e007ced890d7fa86ad8b0ad9381331aa5d98 Mon Sep 17 00:00:00 2001 From: apoclyps Date: Sat, 17 Apr 2021 10:33:17 +0100 Subject: [PATCH 5/5] removes dependancy on PullRequestManager within PullRequestController --- docker-compose.yml | 3 +++ reviews/config.py | 2 +- reviews/controller.py | 11 +---------- 3 files changed, 5 insertions(+), 11 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index a3cce69..f0ae15d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -6,6 +6,7 @@ services: working_dir: /usr/src/app/ environment: - DEBUG=true + - GITHUB_TOKEN=${GITHUB_TOKEN} volumes: - "./:/usr/src/app/" stdin_open: true @@ -33,4 +34,6 @@ services: test: <<: *cli + environment: + - GITHUB_TOKEN=${GITHUB_TOKEN-"token"} command: pytest -cov=reviews -cov-report -vvv diff --git a/reviews/config.py b/reviews/config.py index 973131f..f19fe09 100644 --- a/reviews/config.py +++ b/reviews/config.py @@ -4,7 +4,7 @@ from decouple import Csv, config # Github Config -GITHUB_TOKEN = config("GITHUB_TOKEN", cast=str) +GITHUB_TOKEN = config("GITHUB_TOKEN", cast=str, default="") DEFAULT_PAGE_SIZE = config("DEFAULT_PAGE_SIZE", cast=int, default=100) # Database Config diff --git a/reviews/controller.py b/reviews/controller.py index 01208c4..05ab45d 100644 --- a/reviews/controller.py +++ b/reviews/controller.py @@ -2,8 +2,7 @@ from rich.table import Table -from reviews import config -from reviews.datasource import Label, PullRequest, PullRequestManager, SQLClient +from reviews.datasource import Label, PullRequest from reviews.layout import render_pull_request_table from reviews.source_control import GithubAPI @@ -13,11 +12,6 @@ class PullRequestController: def __init__(self) -> None: self.client = GithubAPI() - self.manager = PullRequestManager( - client=SQLClient(path=config.DATA_PATH, filename=config.FILENAME) - if config.ENABLE_PERSISTED_DATA - else None - ) def retrieve_pull_requests(self, org: str, repository: str) -> Union[Table, None]: """Renders Terminal UI Dashboard""" @@ -28,9 +22,6 @@ def retrieve_pull_requests(self, org: str, repository: str) -> Union[Table, None if not pull_requests: return None - if config.ENABLE_PERSISTED_DATA: - self.manager.insert_all(models=pull_requests) - return render_pull_request_table(title=title, pull_requests=pull_requests) def update_pull_requests(self, org: str, repository: str) -> List[PullRequest]: