Skip to content

Commit 50401c2

Browse files
committed
python-uv got removed
1 parent 602670a commit 50401c2

File tree

1 file changed

+99
-0
lines changed

1 file changed

+99
-0
lines changed

scripts/python-uv.mk

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
# UV is required for Python dependency management
2+
UV ?= uv
3+
UV_PYTHON = 3.10
4+
5+
# Python/pip/pytest commands using UV
6+
python := $(UV) run --python $(UV_PYTHON) python
7+
pip := $(UV) run --python $(UV_PYTHON) pip
8+
pytest := $(UV) run --python $(UV_PYTHON) pytest
9+
wheel_opts := $(if $(and $(or $(CI),$(V),$(VERBOSE)),$(not $(QUIET))),,-q)
10+
build_wheel_opts := $(if $(and $(or $(CI),$(V),$(VERBOSE)),$(not $(QUIET))),--verbose,)
11+
12+
define uv_sync_dev
13+
$(UV) sync --frozen --group dev --python $(UV_PYTHON)
14+
endef
15+
16+
poetry := poetry
17+
poetry_run := $(poetry) run
18+
19+
pypi_upload_url := https://upload.pypi.org/legacy/
20+
pypi_test_upload_url := https://test.pypi.org/legacy/
21+
22+
ot_project := $(OPENTRONS_PROJECT)
23+
project_rs_default = $(if $(ot_project),$(ot_project),robot-stack)
24+
project_ir_default = $(if $(ot_project),$(ot_project),ot3)
25+
26+
PROJECT = $(project_rs_default)
27+
28+
git_describe_base := git describe --dirty --tags --long --match
29+
30+
# get the appropriate git describe command for a given project
31+
# parameter 1: project
32+
define git_describe_cmd_for_project
33+
$(if $(findstring robot-stack,$(1)),$(git_describe_base)=v*,$(if $(findstring ot3,$(1)),$(git_describe_base)=ot3@*,$(error "Unknown project $(1) (valid: ot3, robot-stack)")))
34+
endef
35+
36+
# get the appropriate tag regex for a given project
37+
# parameter 1: project
38+
define git_tag_regex_for_project
39+
$(if $(findstring robot-stack,$(1)),v(?P<version>.*),$(if $(findstring ot3,$(1)),ot3@(?P<version>.*),$(error "Unknown project $(1) (valid: ot3, robot-stack)")))
40+
endef
41+
42+
# get the full environment variable definition for hatch git describe
43+
# parameter 1: project
44+
define hatch_raw_options_for_project
45+
git_describe_command=$(call git_describe_cmd_for_project,$(1))
46+
endef
47+
48+
# get the python package version
49+
# (evaluates to that string)
50+
# parameter 1: name of the package (aka api, robot-server, etc)
51+
# parameter 2: name of the project
52+
# parameter 3: an extra version tag string
53+
# parameter 4: override python_build_utils.py path (default: ../scripts/python_build_utils.py)
54+
define python_package_version
55+
$(shell $(python) $(if $(4),$(4),../scripts/python_build_utils.py) $(1) $(2) normalize_version $(if $(3),-e $(3)))
56+
endef
57+
58+
# This is the poetry version of python_get_wheelname. Arguments are identical.
59+
define poetry_python_get_wheelname
60+
$(3)-$(call python_package_version,$(1),$(2),$(4),$(5))-py3-none-any.whl
61+
endef
62+
63+
# get the name of the wheel that setup.py will build
64+
# parameter 1: the name of the package (aka api, robot-server, etc)
65+
# parameter 2: the name of the project (aka robot-stack, ot3, etc)
66+
# parameter 3: the name of the python package (aka opentrons, robot_server, etc)
67+
# parameter 4: any extra version tags
68+
# parameter 5: override python_build_utils.py path (default: ../scripts/python_build_utils.py)
69+
define python_get_wheelname
70+
$(3)-$(call python_package_version,$(1),$(2),$(4),$(5))-py3-none-any.whl
71+
endef
72+
73+
# get the name of the sdist that setup.py will build
74+
# parameter 1: the name of the project (aka api, robot-server, etc)
75+
# parameter 2: the name of the python package (aka opentrons, robot_server, etc)
76+
# parameter 3: the name of the project (aka robot-stack, ot3, docs)
77+
# parameter 4: any extra version tags
78+
# parameter 5: override python_build_utils.py path (default: ../scripts/python_build_utils.py)
79+
define python_get_sdistname
80+
$(3)-$(call python_package_version,$(1),$(2),$(4),$(5)).tar.gz
81+
endef
82+
83+
# upload a package to a repository
84+
# parameter 1: auth arguments for twine
85+
# parameter 2: repository url
86+
# parameter 3: the wheel file to upload
87+
# parameter 4: the sdist to upload
88+
define python_upload_package
89+
$(python) -m twine upload $(and $(CI),--verbose) --repository-url $(2) $(1) $(3) $(4)
90+
endef
91+
92+
# Get an enhanced version dict of the project
93+
# parameter 1: name of the package (aka api, robot-server, etc)
94+
# parameter 2: name of the project (aka robot-stack, ot3, etc)
95+
# parameter 3: an extra version tag string
96+
# parameter 4: override python_br_version.py path (default: ../scripts/python_build_utils.py)
97+
define python_get_git_version
98+
$(shell $(python) $(if $(4),$(4),../scripts/python_build_utils.py) $(1) $(2) dump_br_version $(if $(3),-e $(3)))
99+
endef

0 commit comments

Comments
 (0)