Skip to content

Commit ba85f85

Browse files
committed
Update initial app name across the repo
Why these changes are being introduced: "app" was too generic a term to use as the initial app name. It meant a find-and-replace across the repo would change many more things than the actual app name (for example, documentation including the words "app" or "application"). A better initial name is one that is not part of other words and would *only* be used in places where the app name matters in the code, making it easy to find and replace. How this addresses that need: * Replaces the app name "app" with "my_app" across the repo to ensure future users of this template can easily update the app name when first creating it.
1 parent d735129 commit ba85f85

File tree

10 files changed

+13
-13
lines changed

10 files changed

+13
-13
lines changed

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ RUN apt-get update && apt-get upgrade -y && apt-get install -y git
99
COPY Pipfile* /
1010
RUN pipenv install
1111

12-
ENTRYPOINT ["pipenv", "run", "app"]
12+
ENTRYPOINT ["pipenv", "run", "my_app"]

Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ update: install ## Update all Python dependencies
1313
### Test commands ###
1414

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

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

2626
bandit:
27-
pipenv run bandit -r app
27+
pipenv run bandit -r my_app
2828

2929
black:
3030
pipenv run black --check --diff .
3131

3232
mypy:
33-
pipenv run mypy app
33+
pipenv run mypy my_app
3434

3535
pylama:
3636
pipenv run pylama --options setup.cfg

Pipfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,4 @@ pytest = "*"
2020
python_version = "3.10"
2121

2222
[scripts]
23-
app = "python -c \"from app.cli import main; main()\""
23+
my_app = "python -c \"from my_app.cli import main; main()\""

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ A template repository for creating Python CLI applications.
44

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

7-
1. Rename "app" to the desired app name across the repo. (May be helpful to do a project-wide find-and-replace).
7+
1. Rename "my_app" to the desired app name across the repo. (May be helpful to do a project-wide find-and-replace).
88
2. Update Python version if needed.
99
3. Install all dependencies with `make install` to create initial Pipfile.lock with latest dependency versions.
1010
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.
2020
- Create an alert for the prod environment only, with notifications sent to the appropriate team(s).
2121
- If *not* using Sentry, delete Sentry configuration from config.py and test_config.py, and remove sentry_sdk from project dependencies.
2222

23-
# app
23+
# my_app
2424

2525
Description of the app
2626

@@ -30,7 +30,7 @@ Description of the app
3030
- To update dependencies: `make update`
3131
- To run unit tests: `make test`
3232
- To lint the repo: `make lint`
33-
- To run the app: `pipenv run app --help`
33+
- To run the app: `pipenv run my_app --help`
3434

3535
## Required ENV
3636

app/__init__.py

Lines changed: 0 additions & 1 deletion
This file was deleted.

my_app/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"""my_app package."""

app/cli.py renamed to my_app/cli.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
import click
66

7-
from app.config import configure_logger, configure_sentry
7+
from my_app.config import configure_logger, configure_sentry
88

99
logger = logging.getLogger(__name__)
1010

app/config.py renamed to my_app/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ def configure_logger(logger: logging.Logger, verbose: bool) -> str:
1212
)
1313
logger.setLevel(logging.DEBUG)
1414
for handler in logging.root.handlers:
15-
handler.addFilter(logging.Filter("app"))
15+
handler.addFilter(logging.Filter("my_app"))
1616
else:
1717
logging.basicConfig(
1818
format="%(asctime)s %(levelname)s %(name)s.%(funcName)s(): %(message)s"

tests/test_cli.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from app.cli import main
1+
from my_app.cli import main
22

33

44
def test_cli_no_options(caplog, runner):

tests/test_config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import logging
22

3-
from app.config import configure_logger, configure_sentry
3+
from my_app.config import configure_logger, configure_sentry
44

55

66
def test_configure_logger_not_verbose():

0 commit comments

Comments
 (0)