Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ RUN apt-get update && apt-get upgrade -y && apt-get install -y git
COPY Pipfile* /
RUN pipenv install

ENTRYPOINT ["pipenv", "run", "app"]
ENTRYPOINT ["pipenv", "run", "my_app"]
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ update: install ## Update all Python dependencies
### Test commands ###

test: ## Run tests and print a coverage report
pipenv run coverage run --source=app -m pytest -vv
pipenv run coverage run --source=my_app -m pytest -vv
pipenv run coverage report -m

coveralls: test
Expand All @@ -24,13 +24,13 @@ coveralls: test
lint: bandit black mypy pylama safety ## Run linting, code quality, and safety checks

bandit:
pipenv run bandit -r app
pipenv run bandit -r my_app

black:
pipenv run black --check --diff .

mypy:
pipenv run mypy app
pipenv run mypy my_app

pylama:
pipenv run pylama --options setup.cfg
Expand Down
3 changes: 2 additions & 1 deletion Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@ coveralls = "*"
mypy = "*"
pylama = {extras = ["all"], version = "*"}
pytest = "*"
pyflakes = "==2.4.0"

[requires]
python_version = "3.10"

[scripts]
app = "python -c \"from app.cli import main; main()\""
my_app = "python -c \"from my_app.cli import main; main()\""
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ A template repository for creating Python CLI applications.

## App setup (delete this section and above after initial application setup)

1. Rename "app" to the desired app name across the repo. (May be helpful to do a project-wide find-and-replace).
1. Rename "my_app" to the desired app name across the repo. (May be helpful to do a project-wide find-and-replace).
2. Update Python version if needed.
3. Install all dependencies with `make install` to create initial Pipfile.lock with latest dependency versions.
4. Add initial app description to README and update initial required ENV variable documentation as needed.
Expand All @@ -20,7 +20,7 @@ A template repository for creating Python CLI applications.
- Create an alert for the prod environment only, with notifications sent to the appropriate team(s).
- If *not* using Sentry, delete Sentry configuration from config.py and test_config.py, and remove sentry_sdk from project dependencies.

# app
# my_app

Description of the app

Expand All @@ -30,7 +30,7 @@ Description of the app
- To update dependencies: `make update`
- To run unit tests: `make test`
- To lint the repo: `make lint`
- To run the app: `pipenv run app --help`
- To run the app: `pipenv run my_app --help`

## Required ENV

Expand Down
1 change: 0 additions & 1 deletion app/__init__.py

This file was deleted.

1 change: 1 addition & 0 deletions my_app/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""my_app package."""
2 changes: 1 addition & 1 deletion app/cli.py → my_app/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import click

from app.config import configure_logger, configure_sentry
from my_app.config import configure_logger, configure_sentry

logger = logging.getLogger(__name__)

Expand Down
2 changes: 1 addition & 1 deletion app/config.py → my_app/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def configure_logger(logger: logging.Logger, verbose: bool) -> str:
)
logger.setLevel(logging.DEBUG)
for handler in logging.root.handlers:
handler.addFilter(logging.Filter("app"))
handler.addFilter(logging.Filter("my_app"))
else:
logging.basicConfig(
format="%(asctime)s %(levelname)s %(name)s.%(funcName)s(): %(message)s"
Expand Down
6 changes: 6 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ ignore = C0114,C0116,D100,D103,W0012
linters = eradicate,isort,mccabe,pycodestyle,pydocstyle,pyflakes,pylint
max_line_length = 90

[pylama:isort]
profile = black

[pylama:pydocstyle]
convention = pep257

[tool:pytest]
log_level = DEBUG

2 changes: 1 addition & 1 deletion tests/test_cli.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from app.cli import main
from my_app.cli import main


def test_cli_no_options(caplog, runner):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_config.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import logging

from app.config import configure_logger, configure_sentry
from my_app.config import configure_logger, configure_sentry


def test_configure_logger_not_verbose():
Expand Down