Skip to content

Commit

Permalink
Use the uv tool to substitute pip and pip-tools, if available
Browse files Browse the repository at this point in the history
  • Loading branch information
fcbertoldi committed Feb 17, 2024
1 parent 99bf9c5 commit de6aee2
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 32 deletions.
18 changes: 15 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,16 @@
VENV_NAME = my-selenium-automations
UV_TOOL := $(shell command -v uv)

ifeq ($(UV_TOOL),)
PIP := python -m pip
PIP_COMPILE := pip-compile
PIP_SYNC := pip-sync --pip-args "--no-deps"
else
PIP := $(UV_TOOL) pip
PIP_COMPILE := $(UV_TOOL) pip compile
PIP_SYNC := $(UV_TOOL) pip sync
endif


lock: requirements.txt requirements-dev.txt

Expand All @@ -7,17 +19,17 @@ requirements.txt: requirements.in
requirements-dev.txt: requirements.txt requirements-dev.in

%.txt: %.in
pew in $(VENV_NAME) pip-compile --output-file $@ $<
pew in $(VENV_NAME) $(PIP_COMPILE) --output-file $@ $<

sync:
pew in $(VENV_NAME) pip-sync --pip-args "--no-deps" requirements.txt requirements-dev.txt
pew in $(VENV_NAME) $(PIP_SYNC) requirements.txt requirements-dev.txt

build-pkg:
pew in $(VENV_NAME) python -m build

install-dev:
pew new -p python3.11 -r requirements.txt -r requirements-dev.txt $(VENV_NAME)
pew in $(VENV_NAME) python -m pip install -e .
pew in $(VENV_NAME) $(PIP) install -e .

install:
pipx install -e .
Expand Down
24 changes: 7 additions & 17 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,19 +1,12 @@
#
# This file is autogenerated by pip-compile with Python 3.11
# by the following command:
#
# pip-compile --output-file=requirements-dev.txt requirements-dev.in
#
# This file was autogenerated by uv v0.1.1 via the following command:
# uv pip compile --output-file requirements-dev.txt requirements-dev.in
asttokens==2.2.1
# via stack-data
backcall==0.2.0
# via ipython
black==23.7.0
# via -r requirements-dev.in
build==0.10.0
# via
# -r requirements-dev.in
# pip-tools
# via pip-tools
click==8.1.6
# via
# black
Expand All @@ -23,9 +16,7 @@ decorator==5.1.1
executing==1.2.0
# via stack-data
flake8==6.1.0
# via -r requirements-dev.in
ipython==8.14.0
# via -r requirements-dev.in
jedi==0.19.0
# via ipython
matplotlib-inline==0.1.6
Expand All @@ -46,8 +37,9 @@ pexpect==4.8.0
# via ipython
pickleshare==0.7.5
# via ipython
pip==24.0
# via pip-tools
pip-tools==7.1.0
# via -r requirements-dev.in
platformdirs==3.10.0
# via black
prompt-toolkit==3.0.39
Expand All @@ -64,6 +56,8 @@ pygments==2.15.1
# via ipython
pyproject-hooks==1.0.0
# via build
setuptools==69.1.0
# via pip-tools
six==1.16.0
# via asttokens
stack-data==0.6.2
Expand All @@ -76,7 +70,3 @@ wcwidth==0.2.6
# via prompt-toolkit
wheel==0.41.0
# via pip-tools

# The following packages are considered to be unsafe in a requirements file:
# pip
# setuptools
16 changes: 4 additions & 12 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
#
# This file is autogenerated by pip-compile with Python 3.11
# by the following command:
#
# pip-compile --output-file=requirements.txt requirements.in
#
# This file was autogenerated by uv v0.1.1 via the following command:
# uv pip compile --output-file requirements.txt requirements.in
attrs==23.1.0
# via
# outcome
Expand All @@ -19,11 +15,9 @@ idna==3.4
outcome==1.2.0
# via trio
pypdf==3.17.4
# via -r requirements.in
pysocks==1.7.1
# via urllib3
selenium==4.10.0
# via -r requirements.in
sniffio==1.3.0
# via trio
sortedcontainers==2.4.0
Expand All @@ -34,9 +28,7 @@ trio==0.22.2
# trio-websocket
trio-websocket==0.10.3
# via selenium
urllib3[socks]==2.1.0
# via
# -r requirements.in
# selenium
urllib3==2.1.0
# via selenium
wsproto==1.2.0
# via trio-websocket

0 comments on commit de6aee2

Please sign in to comment.