Skip to content

Commit a4b071b

Browse files
authored
Rename the package (#3)
* Rename the package * Disable publishing * Target new package name with tools * Adjust test expected output
1 parent a3c9910 commit a4b071b

7 files changed

Lines changed: 31 additions & 30 deletions

File tree

.github/workflows/publish.yaml

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,17 +35,18 @@ jobs:
3535
echo "Python Module Version: $MODULE_VERSION"
3636
if [[ "$TAG_VERSION" != "$MODULE_VERSION" ]]; then exit 1; fi
3737
38-
- name: Publish to PyPi
39-
run: poetry publish --build
40-
env:
41-
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.POETRY_PYPI_TOKEN_PYPI }}
38+
# TODO: Enable this to push to PyPi.
39+
# - name: Publish to PyPi
40+
# run: poetry publish --build
41+
# env:
42+
# POETRY_PYPI_TOKEN_PYPI: ${{ secrets.POETRY_PYPI_TOKEN_PYPI }}
4243

4344
- name: Release
4445
uses: softprops/action-gh-release@v1
4546
with:
4647
discussion_category_name: announcements
4748
generate_release_notes: true
48-
token: ${{ secrets.RELEASE_GITHUB_TOKEN }}
49-
files: |
50-
dist/app-${{env.MODULE_VERSION}}.tar.gz
51-
dist/app-${{env.MODULE_VERSION}}-py3-none-any.whl
49+
# TODO: Update this to push PyPi package files to this release.
50+
# files: |
51+
# dist/app-${{env.MODULE_VERSION}}.tar.gz
52+
# dist/app-${{env.MODULE_VERSION}}-py3-none-any.whl

app/__main__.py

Lines changed: 0 additions & 6 deletions
This file was deleted.

pyproject.toml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
[tool.poetry]
22
name = "app"
33
version = "0.0.0"
4-
description = "This is an app"
4+
description = "This is a python template."
55
authors = ["Mark Beacom <m@beacom.dev>"]
66
readme = "README.md"
7-
packages = [{include = "app"}]
7+
packages = [{include = "python_template"}]
88
license = "MIT"
9-
keywords = ["app", "cli"]
9+
keywords = ["app", "cli", "python", "template"]
1010
classifiers = [
1111
"Programming Language :: Python",
1212
"Programming Language :: Python :: 3",
@@ -23,7 +23,7 @@ include = [
2323
]
2424

2525
[tool.poetry.scripts]
26-
app = "app.cli:app"
26+
python-template = "python_template.cli:app"
2727

2828
[tool.bandit]
2929
exclude_dirs = ["tests"]
@@ -47,14 +47,14 @@ black = "black ."
4747
check-black = {cmd = "black . --check --diff", help = "Validate styling with black"}
4848
check-isort = {cmd = "isort --check --profile=black .", help = "Validate import ordering with isort"}
4949
check-docstrings = "pydocstyle -e ."
50-
check-ruff = "ruff check app"
50+
check-ruff = "ruff check python_template"
5151
check = ["check-isort", "check-black"]
5252
lint = ["check-docstrings", "check-ruff"]
5353
fix = ["isort", "black", "ruff"]
54-
test = "pytest --cov=app --cov-report=xml --cov-report=term"
55-
ruff = "ruff check --fix app"
54+
test = "pytest --cov=python_template --cov-report=xml --cov-report=term"
55+
ruff = "ruff check --fix python_template"
5656
safety = "safety check"
57-
bandit = "bandit -r app"
57+
bandit = "bandit -r python_template"
5858
security = ["safety", "bandit"]
5959
# requires poethepoet outside of poetry.
6060
install = "poetry install"

python_template/__main__.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
"""Perform the core python template workflow."""
2+
from __future__ import annotations
3+
4+
from .cli import app
5+
6+
app(prog_name="python-template")

app/cli.py renamed to python_template/cli.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,28 +6,28 @@
66
import typer
77
from rich.console import Console
88

9-
from app import __version__
9+
from python_template import __version__
1010

11-
app = typer.Typer(help="This is an app")
11+
app = typer.Typer(help="This is a python template.")
1212
console = Console()
1313

1414

1515
def version_callback(value: bool) -> None:
1616
"""Handle the version callback."""
1717
if value:
18-
typer.secho(f"app version: {__version__}", fg=typer.colors.BRIGHT_BLUE, bold=True)
18+
typer.secho(f"python-template version: {__version__}", fg=typer.colors.BRIGHT_GREEN, bold=True)
1919
raise typer.Exit()
2020

2121

2222
@app.command()
2323
def main(
2424
version: Optional[bool] = typer.Option(
25-
None, "--version", callback=version_callback, is_eager=True, help="Display the current app version"
25+
None, "--version", callback=version_callback, is_eager=True, help="Display the current python template version"
2626
),
2727
) -> None:
28-
"""Handle the main entry logic."""
28+
"""Run the main python template logic."""
2929
pass
3030

3131

3232
if __name__ == "__main__": # pragma: no cover
33-
app(prog_name="app")
33+
app(prog_name="python-template")

tests/test_cli.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
from typer.testing import CliRunner
55

6-
from app.cli import app
6+
from python_template.cli import app
77

88
runner = CliRunner()
99

@@ -12,7 +12,7 @@ def test_entry_version_arg() -> None:
1212
"""Test the entry method with version argument."""
1313
result = runner.invoke(app, ["--version"])
1414
assert result.exit_code == 0
15-
assert "app version" in result.stdout
15+
assert "python-template version" in result.stdout
1616

1717

1818
def test_entry_no_arg() -> None:

0 commit comments

Comments
 (0)