Skip to content

Commit

Permalink
Programmatically determine max wheel version to push to spaces (#7115)
Browse files Browse the repository at this point in the history
* Add code

* remove breakpoint 🤦‍♂️

* fix lint

* add changeset

* remove breakpoint 🤦‍♂️

---------

Co-authored-by: gradio-pr-bot <[email protected]>
  • Loading branch information
freddyaboulton and gradio-pr-bot authored Jan 23, 2024
1 parent 80f8fbf commit cb90b3d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/famous-mammals-attend.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"gradio": patch
---

fix:Programmatically determine max wheel version to push to spaces
5 changes: 4 additions & 1 deletion gradio/cli/commands/components/publish.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,10 @@ def _publish(
distribution_files = [
p.resolve() for p in Path(dist_dir).glob("*") if p.suffix in {".whl", ".gz"}
]
wheel_file = next((p for p in distribution_files if p.suffix == ".whl"), None)
wheel_file = max(
(p for p in distribution_files if p.suffix == ".whl"),
key=lambda s: semantic_version.Version(str(s).split("-")[1]),
)
if not wheel_file:
raise ValueError(
"A wheel file was not found in the distribution directory. "
Expand Down

0 comments on commit cb90b3d

Please sign in to comment.