mycom-app 0.1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
mycom_app/__init__.py ADDED
@@ -0,0 +1,21 @@
1
+ """Lab package.
2
+
3
+ The version is read from installed distribution metadata so that stamping the
4
+ version into ``pyproject.toml`` at build time is the single source of truth.
5
+ """
6
+
7
+ from __future__ import annotations
8
+
9
+ from importlib.metadata import PackageNotFoundError, version
10
+
11
+ DISTRIBUTION = "mycom-app"
12
+
13
+
14
+ def __version__() -> str:
15
+ try:
16
+ return version(DISTRIBUTION)
17
+ except PackageNotFoundError: # running from a source checkout
18
+ return "0.0.0+unknown"
19
+
20
+
21
+ __all__ = ["DISTRIBUTION", "__version__"]
mycom_app/cli.py ADDED
@@ -0,0 +1,40 @@
1
+ """Tiny CLI used to give the pipeline something real to build, test and ship."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import argparse
6
+ import json
7
+ import sys
8
+
9
+ from mycom_app import __version__
10
+
11
+
12
+ def build_parser() -> argparse.ArgumentParser:
13
+ parser = argparse.ArgumentParser(prog="mycom-app", description="Lab CLI")
14
+ sub = parser.add_subparsers(dest="command", required=True)
15
+
16
+ greet = sub.add_parser("greet", help="print a greeting")
17
+ greet.add_argument("--name", default="world")
18
+
19
+ sub.add_parser("version", help="print the installed version")
20
+
21
+ return parser
22
+
23
+
24
+ def run(argv: list[str] | None = None) -> int:
25
+ args = build_parser().parse_args(argv)
26
+ if args.command == "version":
27
+ print(json.dumps({"name": "mycom-app", "version": __version__()}))
28
+ return 0
29
+ if args.command == "greet":
30
+ print(f"hello, {args.name}")
31
+ return 0
32
+ return 2
33
+
34
+
35
+ def main() -> None:
36
+ sys.exit(run())
37
+
38
+
39
+ if __name__ == "__main__":
40
+ main()
@@ -0,0 +1,48 @@
1
+ Metadata-Version: 2.3
2
+ Name: mycom-app
3
+ Version: 0.1.0
4
+ Summary: Lab package used to exercise a build-and-publish pipeline end to end.
5
+ Author: mycom lab
6
+ License: MIT
7
+ Keywords: lab,release-pipeline
8
+ Classifier: License :: OSI Approved :: MIT License
9
+ Classifier: Programming Language :: Python :: 3
10
+ Requires-Python: >=3.10
11
+ Provides-Extra: test
12
+ Requires-Dist: pytest>=8.0; extra == 'test'
13
+ Description-Content-Type: text/markdown
14
+
15
+ # mycom-app
16
+
17
+ Small, self-contained Python package used as the *source* side of a two-repository
18
+ release lab.
19
+
20
+ - The package itself does one harmless thing: a CLI with `greet` and `version`.
21
+ - It exists so that a separate pipeline repository has something real to build,
22
+ test, version-stamp, containerise and publish.
23
+
24
+ ## Layout
25
+
26
+ ```
27
+ pyproject.toml packaging metadata (the pipeline stamps `version`)
28
+ src/mycom_app/ the package
29
+ tests/ pytest suite
30
+ Dockerfile image used by the pipeline's container leg
31
+ ```
32
+
33
+ ## Local use
34
+
35
+ ```bash
36
+ python -m pip install -e '.[test]'
37
+ pytest
38
+ mycom-app greet --name lab
39
+ mycom-app version
40
+ ```
41
+
42
+ ## Notes for the pipeline
43
+
44
+ - The version lives only in `pyproject.toml`. The pipeline rewrites that field
45
+ before building; the package reads the installed distribution metadata, so the
46
+ two can never disagree.
47
+ - Everything here is throwaway test code. Nothing in this repository is intended
48
+ for real consumption.
@@ -0,0 +1,6 @@
1
+ mycom_app/__init__.py,sha256=_qb2lyN2q_dzMhEZJhcgHy9nTYMOKhP8xgKNNeIlQEU,518
2
+ mycom_app/cli.py,sha256=5h3CHgyEL79XtEw4gwPYoQ63NPVYflIYZejFctEw0ek,979
3
+ mycom_app-0.1.0.dist-info/METADATA,sha256=r6WZoeDMSxhzRjLJoA3f3XzgwCZk_gPtadPpKH9t1HU,1410
4
+ mycom_app-0.1.0.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
5
+ mycom_app-0.1.0.dist-info/entry_points.txt,sha256=FvIyDMTV-Q5drGRkwEm_i8EgX2a17dR6JA8eqiMgW_g,49
6
+ mycom_app-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.26.3
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ mycom-app = mycom_app.cli:main