diff --git a/Dockerfile b/Dockerfile index de5553f..b9420a2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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"] diff --git a/Makefile b/Makefile index c1348f9..fa0a50f 100644 --- a/Makefile +++ b/Makefile @@ -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 @@ -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 diff --git a/Pipfile b/Pipfile index 3cba513..66b2156 100644 --- a/Pipfile +++ b/Pipfile @@ -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()\"" diff --git a/README.md b/README.md index 721dc37..00cfdbc 100644 --- a/README.md +++ b/README.md @@ -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. @@ -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 @@ -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 diff --git a/app/__init__.py b/app/__init__.py deleted file mode 100644 index d2a0a87..0000000 --- a/app/__init__.py +++ /dev/null @@ -1 +0,0 @@ -"""app package.""" diff --git a/my_app/__init__.py b/my_app/__init__.py new file mode 100644 index 0000000..470cdfb --- /dev/null +++ b/my_app/__init__.py @@ -0,0 +1 @@ +"""my_app package.""" diff --git a/app/cli.py b/my_app/cli.py similarity index 91% rename from app/cli.py rename to my_app/cli.py index 1d06d48..55e54a5 100644 --- a/app/cli.py +++ b/my_app/cli.py @@ -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__) diff --git a/app/config.py b/my_app/config.py similarity index 94% rename from app/config.py rename to my_app/config.py index 61bec1d..533df61 100644 --- a/app/config.py +++ b/my_app/config.py @@ -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" diff --git a/setup.cfg b/setup.cfg index 1a2a98f..cc8b645 100644 --- a/setup.cfg +++ b/setup.cfg @@ -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 diff --git a/tests/test_cli.py b/tests/test_cli.py index 6c40eed..9975759 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -1,4 +1,4 @@ -from app.cli import main +from my_app.cli import main def test_cli_no_options(caplog, runner): diff --git a/tests/test_config.py b/tests/test_config.py index 8de42cb..69f28d1 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -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():