Skip to content

Commit b2eda83

Browse files
committed
feature: migrate from pipenv to uv
1 parent 93e04c4 commit b2eda83

File tree

8 files changed

+694
-129
lines changed

8 files changed

+694
-129
lines changed

.github/workflows/python-package.yml

Lines changed: 23 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ on:
1111
- 'WORKSPACE'
1212
- 'src/**'
1313
pull_request:
14-
branches: [ main ]
1514
paths-ignore:
1615
- 'WORKSPACE'
1716
- 'src/**'
@@ -34,63 +33,44 @@ jobs:
3433
runs-on: ${{ matrix.os }}
3534
strategy:
3635
matrix:
37-
# Python 3.6 is not supported on Ubuntu 22.04.
3836
os: [ubuntu-22.04, windows-latest]
39-
python-version: [3.7, 3.8, 3.9, "3.10", "3.11", "3.12"]
40-
include:
41-
- os: windows-latest
42-
python-version: 3.6
37+
python-version: ["3.13"]
4338

4439
steps:
45-
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
40+
- uses: actions/checkout@v4
4641
with:
4742
fetch-depth: 0
48-
- name: Set up Python ${{ matrix.python-version }}
49-
uses: actions/setup-python@v5
43+
44+
- name: Install uv
45+
uses: astral-sh/setup-uv@v3
5046
with:
51-
python-version: ${{ matrix.python-version }}
47+
enable-cache: true
48+
cache-dependency-glob: "uv.lock"
49+
50+
- name: Set up Python ${{ matrix.python-version }}
51+
run: uv python install ${{ matrix.python-version }}
5252
- name: Set up JDK 1.8
5353
uses: actions/setup-java@c5195efecf7bdfc987ee8bae7a71cb8b11521c00 # v4.7.1
5454
with:
5555
java-version: 8
56-
distribution: 'temurin'
57-
- name: Install specific dependencies in 3.6
58-
if: matrix.python-version == '3.6'
59-
uses: nick-fields/retry@ce71cc2ab81d554ebbe88c79ab5975992d79ba08 # v3.0.2
60-
with:
61-
max_attempts: 3
62-
timeout_minutes: 5
63-
retry_on: error
64-
command: |
65-
python -m pip install --upgrade pip
66-
pip install pipenv==2021.11.5
67-
pipenv install --dev --python ${{ matrix.python-version }}
56+
distribution: 'temurin'
57+
6858
- name: Install dependencies
69-
if: matrix.python-version != '3.6'
70-
uses: nick-fields/retry@ce71cc2ab81d554ebbe88c79ab5975992d79ba08 # v3.0.2
71-
with:
72-
max_attempts: 3
73-
timeout_minutes: 5
74-
retry_on: error
75-
command: |
76-
python -m pip install --upgrade pip
77-
pip install pipenv
78-
pipenv install --dev --python ${{ matrix.python-version }}
59+
run: uv sync --dev
7960
- name: Build
8061
run: |
81-
pipenv run pip list
82-
pipenv run build
83-
pipenv run install
62+
uv pip list
63+
uv run poe build
64+
8465
- name: Type check
85-
run: pipenv run type
66+
run: uv run poe type
67+
8668
- name: Lint with flake8
87-
run: |
88-
# stop the build if there are Python syntax errors or undefined names
89-
pipenv run lint
69+
run: uv run poe lint
9070
- name: Pull request validation
9171
run: |
92-
# Install Launchable CLI from this repos's code
93-
pip3 install . > /dev/null
72+
# Install Launchable CLI from this repo's code as a global tool
73+
uv tool install .
9474
9575
set -x
9676
@@ -112,8 +92,8 @@ jobs:
11292
trap record EXIT
11393
11494
# Test subset of tests
115-
pipenv run test-xml $(tr '\r\n' '\n' < subset.txt)
95+
uv run poe test-xml $(tr '\r\n' '\n' < subset.txt)
11696
11797
# Test rest of tests
118-
pipenv run test-xml $(tr '\r\n' '\n' < launchable-remainder.txt)
98+
uv run poe test-xml $(tr '\r\n' '\n' < launchable-remainder.txt)
11999
shell: bash

.github/workflows/python-publish.yml

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -38,26 +38,14 @@ jobs:
3838
- uses: actions/checkout@v4
3939
with:
4040
fetch-depth: 0
41+
- name: Install uv
42+
uses: astral-sh/setup-uv@v3
43+
4144
- name: Set up Python
42-
uses: actions/setup-python@v5
43-
with:
44-
python-version: '3.x'
45-
# build and publish package using GitHub Actions workflow
46-
# https://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/
47-
- name: Install pypa/build
48-
run: >-
49-
python -m
50-
pip install
51-
build
52-
--user
53-
- name: Build a binary wheel and a source tarball
54-
run: >-
55-
python -m
56-
build
57-
--sdist
58-
--wheel
59-
--outdir dist/
60-
.
45+
run: uv python install 3.13
46+
47+
- name: Build package
48+
run: uv build
6149
# actual publish
6250
- name: Publish to PyPI
6351
uses: pypa/gh-action-pypi-publish@76f52bc884231f62b9a034ebfe128415bbaabdfc # v1.12.4

.python-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.6.15
1+
3.13

Pipfile

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

README.md

Lines changed: 64 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,27 +7,37 @@ https://www.launchableinc.com/docs/getting-started/.
77

88
## Preparation
99

10-
We recommend Pipenv
10+
We recommend uv for dependency management:
1111

1212
```shell
13-
pip install pipenv==2021.5.29
14-
pipenv install --dev
13+
# Install uv
14+
curl -LsSf https://astral.sh/uv/install.sh | sh
15+
16+
# Install dependencies
17+
uv sync --dev
1518
```
1619

1720
In order to automatically format files with autopep8, this repository contains a
1821
configuration for [pre-commit](https://pre-commit.com). Install the hook with
19-
`pipenv run pre-commit install`.
22+
`uv run pre-commit install`.
2023

2124
## Load development environment
2225

2326
```shell
24-
pipenv shell
27+
# Activate virtual environment
28+
source .venv/bin/activate
29+
# or use uv run for individual commands
30+
uv run <command>
2531
```
2632

2733
## Run tests cli
2834

2935
```shell
30-
pipenv run test
36+
# Using poethepoet (recommended)
37+
uv run poe test
38+
39+
# Direct command
40+
uv run python -m unittest
3141
```
3242

3343
## Run tests exe_deploy.jar
@@ -36,12 +46,58 @@ pipenv run test
3646
bazel test ...
3747
```
3848

49+
## Available Development Tasks
50+
51+
This project uses [poethepoet](https://poethepoet.natn.io/) for task management. Available tasks:
52+
53+
```shell
54+
# Show all available tasks
55+
uv run poe --help
56+
57+
# Run tests
58+
uv run poe test
59+
60+
# Run tests with XML output
61+
uv run poe test-xml
62+
63+
# Run linting
64+
uv run poe lint
65+
66+
# Run type checking
67+
uv run poe type
68+
69+
# Format code
70+
uv run poe format
71+
72+
# Build package
73+
uv run poe build
74+
75+
# Install package locally
76+
uv run poe install
77+
```
78+
3979
## Add dependency
4080

4181
```shell
42-
pipenv install --dev some-what-module
82+
# Add runtime dependency
83+
uv add some-package
84+
85+
# Add development dependency
86+
uv add --dev some-dev-package
4387
```
4488

89+
## Updating Python Version
90+
91+
When updating the Python version requirement, update the following files:
92+
93+
1. **`.python-version`** - Used by pyenv, uv, and local development
94+
2. **`pyproject.toml`** - Update `requires-python = ">=X.Y"`
95+
3. **`setup.cfg`** - Update `python_requires = >=X.Y`
96+
4. **`.github/workflows/python-package.yml`** - Update `python-version: ["X.Y"]`
97+
5. **`.github/workflows/python-publish.yml`** - Update `uv python install X.Y`
98+
6. **`README.md`** - Update prerequisite section
99+
7. **`CLAUDE.md`** - Update development notes
100+
45101
# How to release
46102

47103
Create new release on Github, then Github Actions automatically uploads the
@@ -59,7 +115,7 @@ You can install the `launchable` command from either source or [pypi](https://py
59115

60116
## Prerequisite
61117

62-
- \>= Python 3.6
118+
- \>= Python 3.13
63119
- \>= Java 8
64120

65121
## Install from source

pyproject.toml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,63 @@
1+
[project]
2+
name = "launchable"
3+
authors = [
4+
{name = "Launchable, Inc.", email = "[email protected]"}
5+
]
6+
description = "Launchable CLI"
7+
readme = "README.md"
8+
license = {text = "Apache Software License v2"}
9+
requires-python = ">=3.13"
10+
classifiers = [
11+
"Programming Language :: Python :: 3",
12+
"License :: OSI Approved :: Apache Software License",
13+
"Operating System :: OS Independent",
14+
]
15+
dependencies = [
16+
"click>=8.1,<8.2",
17+
"requests>=2.25",
18+
"urllib3>=1.26",
19+
"junitparser>=2.0.0",
20+
"setuptools",
21+
"more-itertools>=7.1.0",
22+
"python-dateutil",
23+
"tabulate",
24+
]
25+
dynamic = ["version"]
26+
27+
[project.urls]
28+
Homepage = "https://launchableinc.com/"
29+
Repository = "https://github.com/launchableinc/cli"
30+
31+
[project.scripts]
32+
launchable = "launchable.__main__:main"
33+
34+
[tool.uv]
35+
dev-dependencies = [
36+
"flake8",
37+
"autopep8<=1.7.0",
38+
"isort",
39+
"mypy<1.16.0",
40+
"pre-commit",
41+
"responses",
42+
"types-click",
43+
"types-pkg_resources==0.1.3",
44+
"types-python-dateutil",
45+
"types-requests",
46+
"types-tabulate",
47+
"lxml",
48+
"unittest-xml-reporting",
49+
"poethepoet",
50+
]
51+
52+
[tool.poe.tasks]
53+
build = "python setup.py sdist bdist_wheel"
54+
format = "/bin/bash -c 'isort -l 130 --balanced launchable/*.py tests/*.py && autopep8 --in-place --recursive --aggressive --experimental --max-line-length=130 --verbose launchable/ tests/'"
55+
lint = "flake8 --count --ignore=C901,E741,F401 --show-source --max-line-length=130 --statistics launchable/ tests/"
56+
lint-warn = "flake8 --count --exit-zero --max-complexity=15 --max-line-length=130 --statistics launchable/ tests/"
57+
test = "python -m unittest"
58+
test-xml = "python -m test-runner"
59+
type = "mypy launchable tests"
60+
161
[build-system]
262
requires = ["setuptools>=45", "wheel", "setuptools_scm"]
363
build-backend = "setuptools.build_meta"

setup.cfg

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,7 @@ classifiers =
1414

1515
[options]
1616
packages = find:
17-
install_requires =
18-
click>=8.0,<8.1;python_version=='3.6'
19-
click>=8.1,<8.2;python_version>'3.6'
20-
requests>=2.25;python_version>='3.6'
21-
urllib3>=1.26
22-
junitparser>=2.0.0
23-
setuptools
24-
more_itertools>=7.1.0;python_version>='3.6'
25-
python-dateutil
26-
tabulate
27-
python_requires = >=3.6
28-
setup_requires =
29-
setuptools-scm
17+
python_requires = >=3.13
3018

3119
[options.entry_points]
3220
console_scripts = launchable = launchable.__main__:main

0 commit comments

Comments
 (0)