-
Notifications
You must be signed in to change notification settings - Fork 61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ci: setup build/publish with uv #573
Changes from 2 commits
7b818d2
56e4457
97aa3db
f1187be
c8fbba4
9314395
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,5 +2,7 @@ dist | |
__pycache__ | ||
.ruff_cache | ||
.pytest_cache | ||
.mypy_cache | ||
.coverage | ||
.venv | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,8 +3,10 @@ | |
"version": "0.11.0", | ||
"private": true, | ||
"scripts": { | ||
"prepublishOnly": "rimraf dist && mkdir dist && hatch run test:cov && hatch fmt --check && hatch build", | ||
"publish": "hatch publish --user __token__", | ||
"release": "npm run prepublishOnly && npm run publish" | ||
"prepublishOnly": "uv run pytest && uv run ruff check && uv run ruff format --check", | ||
"publish": "uv build && uvx twine upload --skip-existing dist/*", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don't mind this at all! We do something similar in anywidget. The funny thing is that uv is so flexible that you could probably publish a package to PyPI that just reads scripts from somewhere in the
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Haha, that's a nice hack. I hope uv will support scripts/shortcuts/commands/dev-scripts (whatever they will call it) eventually to clean this up. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Agreed. IIRC, there has been some discussion around this, but I don't remember the thread or where I saw it. |
||
"release": "npm run prepublishOnly && npm run publish", | ||
"dev": "uv run watchmedo auto-restart --pattern '*.py' --recursive --signal SIGTERM uv run duckdb-server", | ||
"clean": "rimraf dist" | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Depending on how you want to split out these, I believe you can run:
from the root of the repo.
I usally have a separate workflow for "Python Lint" e.g.,:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just moved out up. I didn't set up a separate workflow since the python one is plenty fast.
setup-uv doesn't seem to like the python version file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, uv is a python installer and by default i think picks a "managed" mode where it will determine and install interpreters rather than relying on the system. If there is a
.python-version
root of the project (like we've done in this PR) it will respect that when running various uv commands. You can specify the version withUV_PYTHON=
in the env if you want to test multple python versions in matrix.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you could
setup-python
with a specific version and thensetup-uv
and run uv commands with--system
to use the "system python" (i.e., whateversetup-python
did), but i find the uv-only workflow most simple.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://github.com/manzt/anywidget/blob/478e742eaaf85d8fab68b006210680232863a488/.github/workflows/ci.yml#L56-L69
For example, I should change this to: