-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
170 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,25 @@ | ||
# See https://pre-commit.com for more information | ||
# See https://pre-commit.com/hooks.html for more hooks | ||
repos: | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v3.2.0 | ||
files: '*.py' | ||
hooks: | ||
- id: trailing-whitespace | ||
- id: end-of-file-fixer | ||
- id: check-added-large-files | ||
- repo: https://github.com/psf/black | ||
rev: 19.3b0 | ||
hooks: | ||
- id: black | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.0.1 | ||
hooks: | ||
- id: check-added-large-files | ||
- id: check-ast | ||
- id: check-case-conflict | ||
- id: check-docstring-first | ||
- id: check-merge-conflict | ||
- id: check-added-large-files | ||
- id: debug-statements | ||
- id: detect-aws-credentials | ||
- id: detect-private-key | ||
- id: end-of-file-fixer | ||
- id: trailing-whitespace | ||
- repo: https://github.com/psf/black | ||
rev: 21.5b2 | ||
hooks: | ||
- id: black | ||
- repo: https://github.com/pycqa/flake8 | ||
rev: 3.9.2 | ||
hooks: | ||
- id: flake8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
.PHONY: run install dev lint test coverage check | ||
|
||
PACKAGE_DIR:=python_template_project | ||
|
||
run: | ||
poetry run python main.py | ||
|
||
install: | ||
poetry install --no-dev | ||
|
||
dev: | ||
poetry install | ||
|
||
lint: | ||
poetry run flake8 $(PACKAGE_DIR) tests | ||
|
||
test: | ||
poetry run pytest | ||
|
||
coverage: | ||
poetry run pytest --cov=$(PACKAGE_DIR) tests | ||
|
||
check: | ||
poetry run pre-commit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
from python_template_project.demo import Demo | ||
|
||
|
||
if __name__ == "__main__": | ||
d: Demo = Demo() | ||
d.print_joke() |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
__version__ = '0.1.0' | ||
__version__ = "0.1.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import requests | ||
from requests import Response | ||
|
||
API_URL: str = "http://api.icndb.com/jokes/random" | ||
|
||
|
||
class Demo: | ||
""" | ||
This class is used to demo a templated Python project. | ||
""" | ||
|
||
def __init__(self) -> None: | ||
"""Class Constructor""" | ||
pass | ||
|
||
@staticmethod | ||
def _get_joke() -> dict: | ||
""" | ||
Get a random joke from the internet Chuck Norris database. | ||
return: dict | ||
""" | ||
response: Response = requests.get(API_URL) | ||
return response.json() | ||
|
||
def print_joke(self) -> None: | ||
"""Print the joke to standard out.""" | ||
joke: dict = self._get_joke() | ||
print(joke.get("value").get("joke")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,4 +2,4 @@ | |
|
||
|
||
def test_version(): | ||
assert __version__ == '0.1.0' | ||
assert __version__ == "0.1.0" |