Skip to content

Commit 9141aec

Browse files
authored
Merge pull request #447 from botify-labs/feat/use-uv
2 parents e1b439a + 4d02eba commit 9141aec

File tree

7 files changed

+5981
-58
lines changed

7 files changed

+5981
-58
lines changed

.github/workflows/ci.yml

+13-6
Original file line numberDiff line numberDiff line change
@@ -37,18 +37,25 @@ jobs:
3737
- os: "ubuntu-latest"
3838
python-version: "pypy-3.9"
3939

40+
env:
41+
UV_PYTHON: ${{ matrix.python-version }}
42+
4043
steps:
41-
- uses: actions/checkout@v3
44+
- uses: actions/checkout@v4
45+
46+
- name: Install uv
47+
uses: astral-sh/setup-uv@v5
48+
with:
49+
enable-cache: true
4250

4351
- name: Set up Python ${{ matrix.python-version }}
44-
uses: actions/setup-python@v4
52+
uses: actions/setup-python@v5
4553
with:
4654
python-version: ${{ matrix.python-version }}
4755

48-
- name: Install test dependencies
49-
run: |
50-
pip install -e .[dev]
56+
- name: Install the project
57+
run: uv sync --all-extras --dev
5158

5259
- name: Test
5360
run: |
54-
./script/test -v
61+
uv run ./script/test -v

.github/workflows/pre-commit.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@ jobs:
1111
runs-on: ubuntu-latest
1212
steps:
1313
- uses: actions/checkout@v3
14-
- uses: actions/setup-python@v3
14+
- uses: actions/setup-python@v5
1515
- uses: pre-commit/[email protected]

.pre-commit-config.yaml

+10-2
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,26 @@
22
# See https://pre-commit.com/hooks.html for more hooks
33
repos:
44
- repo: https://github.com/pre-commit/pre-commit-hooks
5-
rev: v4.6.0
5+
rev: v5.0.0
66
hooks:
77
- id: trailing-whitespace
88
- id: end-of-file-fixer
99
- id: check-yaml
1010
args:
1111
- --unsafe
1212
- id: check-added-large-files
13+
args:
14+
- --maxkb=1024
15+
- repo: https://github.com/astral-sh/uv-pre-commit
16+
# uv version.
17+
rev: 0.5.24
18+
hooks:
19+
# Keep uv.lock up to date.
20+
- id: uv-lock
1321

1422
- repo: https://github.com/astral-sh/ruff-pre-commit
1523
# Ruff version.
16-
rev: v0.5.5
24+
rev: v0.9.3
1725
hooks:
1826
# Run the linter.
1927
- id: ruff

pyproject.toml

+41-31
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[build-system]
2-
requires = ["hatchling==1.17.1"]
2+
requires = ["hatchling"]
33
build-backend = "hatchling.build"
44

55
[project]
@@ -48,36 +48,6 @@ dependencies = [
4848
"pytz",
4949
]
5050

51-
[project.optional-dependencies]
52-
dev = [
53-
"boto3-stubs[s3,swf]",
54-
"cffi==v1.17.0rc1; python_full_version=='3.13.0b4'", # via cryptography via moto, secretstorage
55-
"flaky",
56-
"hatch==1.7.0",
57-
"invoke",
58-
"moto>=4.2.8,<5.0.0",
59-
"packaging",
60-
"pre-commit",
61-
"pytest",
62-
"pytest-xdist>=3.2.0",
63-
"ruff",
64-
"setuptools<72", # See https://github.com/pypa/setuptools/issues/4519
65-
"sphinx",
66-
"sphinx_rtd_theme",
67-
"sure",
68-
"typing-extensions",
69-
"vcrpy",
70-
"twine",
71-
]
72-
73-
doc = [
74-
"mkdocs",
75-
"mkdocs-material",
76-
"pygments",
77-
"pymdown-extensions",
78-
"markdown-include",
79-
]
80-
8151
[project.urls]
8252
documentation = "https://botify-labs.github.io/simpleflow"
8353
repository = "https://github.com/botify-labs/simpleflow"
@@ -117,3 +87,43 @@ path = "simpleflow/__init__.py"
11787
[tool.hatch.build]
11888
include = ["/simpleflow"]
11989
exclude = ["*~"]
90+
91+
[dependency-groups]
92+
dev = [
93+
"boto3-stubs[s3,swf]",
94+
"cffi==v1.17.0rc1; python_full_version=='3.13.0b4'", # via cryptography via moto, secretstorage
95+
"flaky",
96+
"hatch",
97+
"invoke",
98+
"moto>=4.2.8,<5.0.0",
99+
"packaging",
100+
"pre-commit",
101+
"pytest",
102+
"pytest-xdist>=3.2.0",
103+
"ruff",
104+
"setuptools<72", # See https://github.com/pypa/setuptools/issues/4519
105+
"sphinx",
106+
"sphinx_rtd_theme",
107+
"sure",
108+
"typing-extensions",
109+
"vcrpy",
110+
"twine",
111+
]
112+
113+
doc = [
114+
"mkdocs",
115+
"mkdocs-material",
116+
"pygments",
117+
"pymdown-extensions",
118+
"markdown-include",
119+
]
120+
121+
[[tool.uv.index]]
122+
name = "pypi"
123+
url = "https://pypi.org/simple/"
124+
publish-url = "https://pypi.org/legacy/"
125+
126+
[[tool.uv.index]]
127+
name = "testpypi"
128+
url = "https://test.pypi.org/simple/"
129+
publish-url = "https://test.pypi.org/legacy/"

script/release

+9-15
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ def current_branch() -> str:
102102
branch = execute(["git", "branch", "--show-current"]).strip()
103103
if branch:
104104
return branch
105-
fail("Couldn't find current branch, please don't" " be in 'detached' state when running this.")
105+
fail("Couldn't find current branch, please don't be in 'detached' state when running this.")
106106

107107

108108
def on_main_branch() -> bool:
@@ -238,17 +238,13 @@ def main():
238238
"--test-pypi",
239239
"-T",
240240
action="store_const",
241-
const="test",
242-
dest="repository",
241+
const="testpypi",
242+
dest="index",
243243
help="upload to TestPyPI",
244244
)
245245
group.add_argument(
246-
"--repository",
247-
help="repository (package index) name or URL to upload the package to",
248-
)
249-
group.add_argument(
250-
"--repository-url",
251-
help="repository (package index) URL to upload the package to",
246+
"--index",
247+
help="index name (from [[tool.uv.index]] in pyproject.toml) to upload the package to",
252248
)
253249
parser.add_argument("--new-version", help="new version number")
254250
args = parser.parse_args()
@@ -289,14 +285,12 @@ def main():
289285

290286
# push package to pypi
291287
step(f"Generate and push package to {args.repository or args.repository_url or 'pypi'}")
292-
execute(["hatch", "build", "--clean"], log=True)
288+
execute(["uv", "build"], log=True)
293289
wheel = f"dist/simpleflow-{new_version}-py3-none-any.whl"
294290
tar_gz = f"dist/simpleflow-{new_version}.tar.gz"
295-
cmd = ["hatch", "publish"]
296-
if args.repository:
297-
cmd += ["--repo", args.repository]
298-
elif args.repository_url:
299-
cmd += ["--repo", args.repository_url]
291+
cmd = ["uv", "publish"]
292+
if args.index:
293+
cmd += ["--index", args.index]
300294
cmd += [wheel, tar_gz]
301295
execute(cmd, log=True, dry_run=dry_run)
302296

script/test

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
#!/bin/bash
22

3-
# not needed, but harmless, in CI/container
4-
find . -name '*.pyc' -print0 | xargs -0 rm
53
export PYTHONDONTWRITEBYTECODE=1
64

75
# The AWS_DEFAULT_REGION parameter determines the region used for SWF
@@ -35,4 +33,4 @@ export BOTO_CONFIG=/dev/null
3533

3634
PYTHON=${PYTHON:-python}
3735
# run tests
38-
$PYTHON -m pytest --no-success-flaky-report -q $PYTEST_OPTIONS "$@"
36+
pytest --no-success-flaky-report -q $PYTEST_OPTIONS "$@"

0 commit comments

Comments
 (0)