randpal 0.1.0__tar.gz

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.
@@ -0,0 +1,68 @@
1
+ name: Publish new package version
2
+
3
+ on:
4
+ push:
5
+ # On version pushes
6
+ tags:
7
+ - 'v[0-9]+.[0-9]+.[0-9]+'
8
+
9
+ workflow_dispatch:
10
+
11
+ permissions:
12
+ contents: write
13
+
14
+ jobs:
15
+ verify-checks:
16
+ uses: ./.github/workflows/quality-assurance.yaml
17
+
18
+ publish:
19
+ name: Build and publish Python Package
20
+ needs: verify-checks
21
+ runs-on: ubuntu-latest
22
+
23
+ steps:
24
+ - uses: actions/checkout@v4
25
+
26
+ - uses: actions/setup-python@v4
27
+ with:
28
+ python-version-file: "pyproject.toml"
29
+
30
+ - name: Setup uv
31
+ uses: astral-sh/setup-uv@v6
32
+ with:
33
+ activate-environment: true
34
+ enable-cache: true
35
+
36
+ - name: Synchronise dependencies
37
+ run: |
38
+ uv pip install hatchling hatch-vcs
39
+
40
+ - name: Verify release version
41
+ shell: bash
42
+ run: |
43
+ VERSION="$(hatchling version)"
44
+ if [[ ! "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
45
+ echo "::error::Expected a pure release version, got: $VERSION"
46
+ exit 1
47
+ fi
48
+ echo "VERSION=$VERSION" >> $GITHUB_ENV
49
+
50
+ - name: Build package
51
+ run: |
52
+ uv build
53
+
54
+ - name: Publish package to PyPI
55
+ env:
56
+ # TIP: Create PYPI_TOKEN secret in your GitHub repository
57
+ UV_PUBLISH_TOKEN: ${{ secrets.PYPI_TOKEN }}
58
+ run: |
59
+ uv publish
60
+
61
+ - name: Create GitHub release
62
+ env:
63
+ GH_TOKEN: ${{ github.token }}
64
+ VERSION: ${{ env.VERSION }}
65
+ run: |
66
+ gh release create "v$VERSION" \
67
+ --generate-notes \
68
+ --verify-tag
@@ -0,0 +1,107 @@
1
+ name: Run quality assurance checks
2
+
3
+ on:
4
+ pull_request:
5
+ types:
6
+ - opened
7
+ - reopened
8
+ - synchronize
9
+ - ready_for_review
10
+
11
+ push:
12
+ branches:
13
+ - master
14
+
15
+ workflow_call:
16
+
17
+ jobs:
18
+ lint-and-format:
19
+ name: Lint and check formatting
20
+ if: github.event.pull_request.draft == false
21
+ runs-on: ubuntu-latest
22
+ steps:
23
+ - uses: actions/checkout@v4
24
+
25
+ - name: Check formatting
26
+ uses: astral-sh/ruff-action@v4.1.0
27
+ with:
28
+ version-file: uv.lock
29
+ args: format --check --diff
30
+
31
+ - name: Check linting
32
+ run: |
33
+ ruff check --output-format=github
34
+
35
+ type-checking:
36
+ name: Static type checking
37
+ runs-on: ubuntu-latest
38
+
39
+ if: github.event.pull_request.draft == false
40
+ strategy:
41
+ fail-fast: true
42
+ matrix:
43
+ python-version:
44
+ - "3.10"
45
+ - "3.11"
46
+ - "3.12"
47
+ - "3.13"
48
+ - "3.14"
49
+
50
+ steps:
51
+ - uses: actions/checkout@v4
52
+
53
+ - uses: actions/setup-python@v4
54
+ with:
55
+ python-version: ${{ matrix.python-version }}
56
+
57
+ - name: Setup uv
58
+ uses: astral-sh/setup-uv@v6
59
+ with:
60
+ activate-environment: true
61
+ enable-cache: true
62
+
63
+ - name: Synchronise dependencies
64
+ run: |
65
+ uv sync --locked --all-extras --all-groups --dev
66
+
67
+ - name: Check with Pyright
68
+ uses: jakebailey/pyright-action@v2
69
+ with:
70
+ version: latest
71
+ annotate: all
72
+
73
+ runtime-tests:
74
+ name: Run tests
75
+ runs-on: ubuntu-latest
76
+
77
+ if: github.event.pull_request.draft == false
78
+ strategy:
79
+ fail-fast: true
80
+ matrix:
81
+ python-version:
82
+ - "3.10"
83
+ - "3.11"
84
+ - "3.12"
85
+ - "3.13"
86
+ - "3.14"
87
+
88
+ steps:
89
+ - uses: actions/checkout@v4
90
+
91
+ - uses: actions/setup-python@v4
92
+ with:
93
+ python-version: ${{ matrix.python-version }}
94
+
95
+ - name: Setup uv
96
+ uses: astral-sh/setup-uv@v6
97
+ with:
98
+ activate-environment: true
99
+ enable-cache: true
100
+
101
+ - name: Synchronise dependencies
102
+ run: |
103
+ uv sync --locked --all-extras --no-dev --group tests
104
+
105
+ - name: Run Pytest
106
+ run: |
107
+ pytest --doctest-modules
@@ -0,0 +1,10 @@
1
+ # Python-generated files
2
+ __pycache__/
3
+ *.py[oc]
4
+ build/
5
+ dist/
6
+ wheels/
7
+ *.egg-info
8
+
9
+ # Virtual environments
10
+ .venv
@@ -0,0 +1 @@
1
+ 3.14
randpal-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,6 @@
1
+ Metadata-Version: 2.4
2
+ Name: randpal
3
+ Version: 0.1.0
4
+ Summary: Convenient CLI wrapper around Python random module.
5
+ Author-email: Soucelover <mr.ktotov@gmail.com>
6
+ Requires-Python: >=3.14
File without changes
@@ -0,0 +1,27 @@
1
+ [project]
2
+ name = "randpal"
3
+ description = "Convenient CLI wrapper around Python random module."
4
+ readme = "README.md"
5
+ authors = [
6
+ { name = "Soucelover", email = "mr.ktotov@gmail.com" }
7
+ ]
8
+ dynamic = ["version"]
9
+
10
+ # ===================
11
+ # Requirements (deps)
12
+ # ===================
13
+ requires-python = ">=3.14"
14
+ dependencies = []
15
+
16
+ # ============
17
+ # Build System
18
+ # ============
19
+ [project.scripts]
20
+ randpal = "randpal.__main__:main"
21
+
22
+ [build-system]
23
+ requires = ["hatchling", "hatch-vcs"]
24
+ build-backend = "hatchling.build"
25
+
26
+ [tool.hatch.version]
27
+ source = "vcs"
@@ -0,0 +1,2 @@
1
+ def main() -> None:
2
+ print("Hello from randpal!")
@@ -0,0 +1,43 @@
1
+ import argparse
2
+ import random
3
+
4
+ VERBOSE_MODE = True
5
+
6
+
7
+ def command_int(args: argparse.Namespace) -> None:
8
+ if VERBOSE_MODE:
9
+ print("Random number is ", end="") # noqa: T201
10
+
11
+ print(random.randint(args.a, args.b), end="\n\n") # noqa: T201
12
+
13
+
14
+ def command_choose(args: argparse.Namespace) -> None:
15
+ if VERBOSE_MODE:
16
+ print("Random chosen item is ", end="") # noqa: T201
17
+
18
+ print(random.choice(args.item), end="\n\n") # noqa: T201
19
+
20
+
21
+ def parse_args() -> argparse.Namespace:
22
+ parser = argparse.ArgumentParser()
23
+ commands = parser.add_subparsers(required=True)
24
+
25
+ com_int = commands.add_parser("int")
26
+ com_int.add_argument("a", type=int)
27
+ com_int.add_argument("b", type=int)
28
+ com_int.set_defaults(command=command_int)
29
+
30
+ com_choose = commands.add_parser("choose")
31
+ com_choose.add_argument("item", nargs="+")
32
+ com_choose.set_defaults(command=command_choose)
33
+
34
+ return parser.parse_args()
35
+
36
+
37
+ def main() -> None:
38
+ args = parse_args()
39
+ args.command(args)
40
+
41
+
42
+ if __name__ == "__main__":
43
+ main()
randpal-0.1.0/uv.lock ADDED
@@ -0,0 +1,7 @@
1
+ version = 1
2
+ revision = 3
3
+ requires-python = ">=3.14"
4
+
5
+ [[package]]
6
+ name = "randpal"
7
+ source = { editable = "." }