Skip to content

Commit 1da0f59

Browse files
committed
Add minimal initial code
0 parents  commit 1da0f59

File tree

6 files changed

+142
-0
lines changed

6 files changed

+142
-0
lines changed

.github/workflows/packaging.yml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: Packaging
2+
3+
on:
4+
- push
5+
6+
jobs:
7+
build_source_dist:
8+
name: Build source distribution
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v4
12+
13+
- uses: actions/setup-python@v5
14+
with:
15+
python-version: "3.12"
16+
17+
- name: Install build
18+
run: python -m pip install build
19+
20+
- name: Run build
21+
run: python -m build --sdist
22+
23+
- uses: actions/upload-artifact@v4
24+
with:
25+
path: dist/*.tar.gz
26+
27+
publish:
28+
if: startsWith(github.ref, 'refs/tags')
29+
runs-on: ubuntu-latest
30+
environment: release
31+
permissions:
32+
id-token: write
33+
contents: write
34+
steps:
35+
- uses: actions/checkout@v4
36+
37+
- name: Set up Python
38+
uses: actions/setup-python@v5
39+
with:
40+
python-version: "3.12"
41+
42+
- name: Install pypa/build
43+
run: python -m pip install build
44+
45+
- name: Build distribution
46+
run: python -m build --outdir dist/
47+
48+
- name: Publish distribution to Test PyPI
49+
uses: pypa/gh-action-pypi-publish@release/v1
50+
with:
51+
repository_url: https://test.pypi.org/legacy/
52+
53+
- name: Publish distribution to PyPI
54+
uses: pypa/gh-action-pypi-publish@release/v1
55+
56+
- name: Publish distribution to GitHub release
57+
uses: softprops/action-gh-release@v2
58+
with:
59+
files: |
60+
dist/minimal-pba-cli-*.whl
61+
dist/minimal_pba_cli-*.tar.gz
62+
env:
63+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
*.py[cod]
2+
*.egg-info/
3+
build/

MANIFEST.in

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
graft src
2+
recursive-exclude __pycache__ *.py[cod]

pyproject.toml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
[build-system]
2+
requires = ["setuptools", "wheel"]
3+
build-backend = "setuptools.build_meta"
4+
5+
[project]
6+
requires-python = ">=3.9"
7+
name = "minimal-pba-cli-plugin-example"
8+
version = "0.0.1"
9+
description = "A minimal command-line interface plugin for minimal-pba-cli"
10+
authors = [
11+
{ name = "Dane Hillard", email = "[email protected]" }
12+
]
13+
classifiers = [
14+
"Development Status :: 2 - Pre-Alpha",
15+
"Intended Audience :: Developers",
16+
"Programming Language :: Python",
17+
"Programming Language :: Python :: 3.9",
18+
"Programming Language :: Python :: 3.10",
19+
"Programming Language :: Python :: 3.11",
20+
"Programming Language :: Python :: 3.12",
21+
"Programming Language :: Python :: 3.13",
22+
"Programming Language :: Python :: 3",
23+
"Programming Language :: Python :: 3 :: Only",
24+
"License :: OSI Approved :: MIT License",
25+
]
26+
dependencies = [
27+
"rich>=14.0.0",
28+
"typer>=0.12.5",
29+
]
30+
31+
[project.urls]
32+
Repository = "https://github.com/easy-as-python/minimal-pba-cli-plugin-example"
33+
Issues = "https://github.com/easy-as-python/minimal-pba-cli-plugin-example/issues"
34+
35+
[tool.setuptools.packages.find]
36+
where = ["src"]
37+
38+
[project.entry-points.minimal_pba_cli]
39+
example = "minimal_pba_cli_plugin_example.plugin"

src/minimal_pba_cli_plugin_example/__init__.py

Whitespace-only changes.
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
from typing import Annotated
2+
3+
import typer
4+
5+
6+
greet = typer.Typer()
7+
8+
9+
@greet.command()
10+
def morning(name: Annotated[str, typer.Argument()] = "world"):
11+
"""Say good morning to NAME."""
12+
13+
typer.echo(f"Good morning {name}!")
14+
15+
16+
@greet.command()
17+
def evening(name: Annotated[str, typer.Argument()] = "world"):
18+
"""Say good evening to NAME."""
19+
20+
typer.echo(f"Good evening {name}!")
21+
22+
23+
def salute(name: Annotated[str, typer.Argument()] = "world"):
24+
"""Say salutations to NAME."""
25+
26+
typer.echo(f"Salutations {name}!")
27+
28+
29+
groups = {
30+
"greet": greet,
31+
}
32+
33+
commands = {
34+
"salute": salute,
35+
}

0 commit comments

Comments
 (0)