Skip to content

Commit 640b411

Browse files
authored
Merge pull request #9 from devanshkv/feat/uv-subparsers-improvements
feat: Migrate to uv, add subparser support, and enhance tooling
2 parents fa86e89 + 312fa43 commit 640b411

File tree

13 files changed

+567
-198
lines changed

13 files changed

+567
-198
lines changed

.github/workflows/python-app.yml

Lines changed: 28 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,40 +4,50 @@ on: [push, pull_request]
44

55
jobs:
66
build:
7-
87
runs-on: ubuntu-latest
98
strategy:
109
max-parallel: 4
1110
matrix:
12-
python-version: [3.6, 3.7, 3.8]
11+
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12'] # Updated to versions compatible with uv
1312
steps:
14-
- uses: actions/checkout@v1
13+
- uses: actions/checkout@v4
1514
- name: Set up Python ${{ matrix.python-version }}
16-
uses: actions/setup-python@v1
15+
uses: actions/setup-python@v5
1716
with:
1817
python-version: ${{ matrix.python-version }}
18+
19+
- name: Install uv
20+
run: curl -LsSf https://astral.sh/uv/install.sh | sh
21+
shell: bash
22+
1923
- name: Install dependencies
2024
run: |
21-
python -m pip install --upgrade pip
22-
pip install -r requirements.txt
23-
- name: Install it
25+
source $HOME/.cargo/env # Ensure uv is in PATH for subsequent steps
26+
uv pip install --system -r requirements.txt
27+
uv pip install --system pytest pytest-cov # For running tests
28+
29+
- name: Install package
2430
run: |
25-
python setup.py install
26-
- name: Lint with flake8
31+
source $HOME/.cargo/env
32+
uv pip install --system .
33+
34+
- name: Lint with black
2735
run: |
28-
pip install flake8
29-
# stop the build if there are Python syntax errors or undefined names
30-
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
31-
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
32-
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
36+
source $HOME/.cargo/env
37+
uv run black --check .
38+
3339
- name: Run pytest and Generate coverage report
3440
run: |
35-
pip install pytest pytest-cov
36-
python -m pytest --cov=argmark --cov-report=xml
41+
source $HOME/.cargo/env
42+
uv run pytest --cov=argmark --cov-report=xml
43+
3744
- name: Upload coverage to Codecov
38-
uses: codecov/codecov-action@v1
45+
uses: codecov/codecov-action@v5
3946
with:
4047
token: ${{ secrets.CODECOV_TOKEN }}
4148
file: ./coverage.xml
42-
name: codecov-umbrella
49+
name: codecov-umbrella # Optional: can be removed if not specifically needed
4350
fail_ci_if_error: true
51+
env: # Ensure environment variables are available if action needs them
52+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
53+
```

.github/workflows/python-publish.yml

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,23 +9,33 @@ on:
99

1010
jobs:
1111
deploy:
12-
1312
runs-on: ubuntu-latest
14-
1513
steps:
16-
- uses: actions/checkout@v2
14+
- uses: actions/checkout@v4
1715
- name: Set up Python
18-
uses: actions/setup-python@v2
16+
uses: actions/setup-python@v5
1917
with:
20-
python-version: '3.x'
21-
- name: Install dependencies
18+
python-version: '3.x' # Use a recent Python 3.x, uv will be installed within it
19+
20+
- name: Install uv
21+
run: curl -LsSf https://astral.sh/uv/install.sh | sh
22+
shell: bash
23+
24+
- name: Install build dependencies
2225
run: |
23-
python -m pip install --upgrade pip
24-
pip install setuptools wheel twine
25-
- name: Build and publish
26+
source $HOME/.cargo/env # Ensure uv is in PATH
27+
uv pip install --system build twine
28+
29+
- name: Build package
30+
run: |
31+
source $HOME/.cargo/env
32+
uv run python -m build --sdist --wheel
33+
34+
- name: Publish package
2635
env:
2736
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
2837
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
2938
run: |
30-
python setup.py sdist bdist_wheel
39+
source $HOME/.cargo/env # Not strictly necessary for twine if twine is in system PATH after install
3140
twine upload dist/*
41+
```

app.md

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
2+
app
3+
===
4+
5+
# Description
6+
7+
8+
Main app with subparsers.
9+
# Usage:
10+
11+
12+
```bash
13+
usage: app [-h] [--verbose] {command1,command2} ...
14+
15+
```
16+
# Arguments
17+
18+
|short|long|default|help|
19+
| :--- | :--- | :--- | :--- |
20+
|`-h`|`--help`||show this help message and exit|
21+
||`--verbose`||Enable verbose output.|
22+
23+
# Subcommands
24+
25+
## Subcommand: `command1`
26+
27+
# Description
28+
29+
30+
Detailed desc for command1
31+
# Usage:
32+
33+
34+
```bash
35+
usage: app command1 [-h] [--opt1 OPT1] pos1
36+
37+
```
38+
## Arguments
39+
40+
|short|long|default|help|
41+
| :--- | :--- | :--- | :--- |
42+
|`-h`|`--help`||show this help message and exit|
43+
||`--opt1`|`10`|Option for command1.|
44+
||`pos1`||Positional arg for command1.|
45+
46+
47+
---
48+
## Subcommand: `command2`
49+
50+
# Epilog
51+
52+
53+
Epilog for command2
54+
# Usage:
55+
56+
57+
```bash
58+
usage: app command2 [-h] [--flag]
59+
60+
```
61+
## Arguments
62+
63+
|short|long|default|help|
64+
| :--- | :--- | :--- | :--- |
65+
|`-h`|`--help`||show this help message and exit|
66+
||`--flag`||A boolean flag for command2.|
67+
68+
69+
---

0 commit comments

Comments
 (0)