From 4eb2a41a9f8e10338c6de9ed36761d91af53c19a Mon Sep 17 00:00:00 2001 From: Russ Allbery Date: Fri, 20 Dec 2024 16:04:30 -0800 Subject: [PATCH] Move dependencies to pyproject.toml Move runtime dependencies to `pyproject.toml` to match standard Python practices more closely. Delete the `update-deps-no-hashes` target, which is no longer needed now that we're using uv for all package installation and dependency management. --- Makefile | 22 +++++----------------- pyproject.toml | 13 ++++++++++++- requirements/main.in | 27 --------------------------- requirements/main.txt | 23 +++++++++++------------ 4 files changed, 28 insertions(+), 57 deletions(-) delete mode 100644 requirements/main.in diff --git a/Makefile b/Makefile index cacdc5d..e455896 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,6 @@ help: @echo "make run - Run development instance of server" @echo "make update - Update pinned dependencies and run make init" @echo "make update-deps - Update pinned dependencies" - @echo "make update-deps-no-hashes - Pin dependencies without hashes" .PHONY: init init: @@ -17,6 +16,10 @@ init: uv pip install --upgrade pre-commit pre-commit install +.PHONY: run +run: + tox -e run + .PHONY: update update: update-deps init @@ -26,23 +29,8 @@ update-deps: uv pip install --upgrade pre-commit pre-commit autoupdate uv pip compile --upgrade --universal --generate-hashes \ - --output-file requirements/main.txt requirements/main.in + --output-file requirements/main.txt pyproject.toml uv pip compile --upgrade --universal --generate-hashes \ --output-file requirements/dev.txt requirements/dev.in uv pip compile --upgrade --universal --generate-hashes \ --output-file requirements/tox.txt requirements/tox.in - -# Useful for testing against a Git version of a dependency. -.PHONY: update-deps-no-hashes -update-deps-no-hashes: - pip install --upgrade uv - uv pip compile --upgrade --universal \ - --output-file requirements/main.txt requirements/main.in - uv pip compile --upgrade --universal \ - --output-file requirements/dev.txt requirements/dev.in - uv pip compile --upgrade --universal \ - --output-file requirements/tox.txt requirements/tox.in - -.PHONY: run -run: - tox -e run diff --git a/pyproject.toml b/pyproject.toml index 5eb0fb2..5ebacad 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -20,7 +20,18 @@ classifiers = [ "Typing :: Typed", ] requires-python = ">=3.13" -dependencies = [] +dependencies = [ + "fastapi>=0.100", + "httpx", + "jinja2", + "lsst-daf-butler[remote]", + "pydantic>2", + "pydantic-settings", + "pyyaml", + "safir>=6.2.0", + "structlog", + "uvicorn[standard]", +] dynamic = ["version"] [[project.authors]] diff --git a/requirements/main.in b/requirements/main.in deleted file mode 100644 index 5e3b908..0000000 --- a/requirements/main.in +++ /dev/null @@ -1,27 +0,0 @@ -# -*- conf -*- -# -# Editable runtime dependencies (equivalent to install_requires) -# Add direct runtime dependencies here, as well as implicit dependencies -# with constrained versions. -# -# After editing, update requirements/main.txt by running: -# make update-deps - -# These dependencies are for fastapi including some optional features. -fastapi -starlette -uvicorn[standard] - -# Other dependencies. -httpx -jinja2 -lsst-daf-butler[remote] -pydantic -pydantic-settings -pyyaml -safir -structlog - -# Uncomment this, change the branch, comment out safir above, and run make -# update-deps-no-hashes to test against an unreleased version of Safir. -# safir[gcs] @ git+https://github.com/lsst-sqre/safir@main diff --git a/requirements/main.txt b/requirements/main.txt index 0b35040..5c2fb74 100644 --- a/requirements/main.txt +++ b/requirements/main.txt @@ -1,5 +1,5 @@ # This file was autogenerated by uv via the following command: -# uv pip compile --universal --generate-hashes --output-file requirements/main.txt requirements/main.in +# uv pip compile --universal --generate-hashes --output-file requirements/main.txt pyproject.toml annotated-types==0.7.0 \ --hash=sha256:1f02e8b43a8fbbc3f3e0d4f0f4bfc8131bcb4eebe8849b8e5c773f3a1c582a53 \ --hash=sha256:aff07c09a53a08bc8cfccb9c85b05f1aa9a2a6f23728d790723543408344ce89 @@ -284,7 +284,7 @@ fastapi==0.115.6 \ --hash=sha256:9ec46f7addc14ea472958a96aae5b5de65f39721a46aaf5705c480d9a8b76654 \ --hash=sha256:e9240b29e36fa8f4bb7290316988e90c381e5092e0cbe84e7818cc3713bcf305 # via - # -r requirements/main.in + # datalinker (pyproject.toml) # safir gidgethub==5.3.0 \ --hash=sha256:4dd92f2252d12756b13f9dd15cde322bfb0d625b6fb5d680da1567ec74b462c0 \ @@ -368,7 +368,7 @@ httpx==0.28.1 \ --hash=sha256:75e98c5f16b0f35b567856f597f06ff2270a374470a5c2392242528e3e3e42fc \ --hash=sha256:d909fcccc110f8c7faf814ca82a9a4d816bc5a6dbfea25d6591d6985b8ba59ad # via - # -r requirements/main.in + # datalinker (pyproject.toml) # lsst-daf-butler # safir idna==3.10 \ @@ -381,11 +381,11 @@ idna==3.10 \ jinja2==3.1.4 \ --hash=sha256:4a3aee7acbbe7303aede8e9648d13b8bf88a429282aa6122a993f0ac800cb369 \ --hash=sha256:bc5dd2abb727a5319567b7a813e6a2e7318c39f4f487cfe6c89c6f9c7d25197d - # via -r requirements/main.in + # via datalinker (pyproject.toml) lsst-daf-butler==28.2024.5100 \ --hash=sha256:5d6e2866f0b6507ed7f1f9118cbaea9e27d9f36d2fd7426849373df4a0fd1720 \ --hash=sha256:cd4ad2243445736b7e3c01f5fc06c0f3a80f16622209cd367c5ec12cbcf91ea8 - # via -r requirements/main.in + # via datalinker (pyproject.toml) lsst-daf-relation==28.2024.5100 \ --hash=sha256:871897f0259b6a911a67ac48cdab976e14636f6b936cfdd82a68bf03c8cec5f0 \ --hash=sha256:89d7b3166f35f4c719d29514ae00e7d8dd40c5f93cc692dbb745028a3cce935e @@ -629,7 +629,7 @@ pydantic==2.10.4 \ --hash=sha256:597e135ea68be3a37552fb524bc7d0d66dcf93d395acd93a00682f1efcb8ee3d \ --hash=sha256:82f12e9723da6de4fe2ba888b5971157b3be7ad914267dea8f05f82b28254f06 # via - # -r requirements/main.in + # datalinker (pyproject.toml) # fastapi # lsst-daf-butler # lsst-daf-relation @@ -742,7 +742,7 @@ pydantic-core==2.27.2 \ pydantic-settings==2.7.0 \ --hash=sha256:ac4bfd4a36831a48dbf8b2d9325425b549a0a6f18cea118436d728eb4f1c4d66 \ --hash=sha256:e00c05d5fa6cbbb227c84bd7487c5c1065084119b750df7c8c1a554aed236eb5 - # via -r requirements/main.in + # via datalinker (pyproject.toml) pyerfa==2.0.1.5 \ --hash=sha256:07b80cd70701f5d066b1ac8cce406682cfcd667a1186ec7d7ade597239a6021d \ --hash=sha256:0e43c7194e3242083f2350b46c09fd4bf8ba1bcc0ebd1460b98fc47fe2389906 \ @@ -821,7 +821,7 @@ pyyaml==6.0.2 \ --hash=sha256:f753120cb8181e736c57ef7636e83f31b9c0d1722c516f7e86cf15b7aa57ff12 \ --hash=sha256:ff3824dc5261f50c9b0dfb3be22b4567a6f938ccce4587b38952d85fd9e9afe4 # via - # -r requirements/main.in + # datalinker (pyproject.toml) # astropy # lsst-daf-butler # lsst-utils @@ -833,7 +833,7 @@ requests==2.32.3 \ safir==6.4.0 \ --hash=sha256:ba7af071eab0d198e6e15a2117028566f3f4237e02e2278e8bfc2633a7c68228 \ --hash=sha256:f38c3f1d7d76d304984b572288826510e5c7a0e1f965b2eabdd7f3bace07c48a - # via -r requirements/main.in + # via datalinker (pyproject.toml) safir-logging==6.5.1 \ --hash=sha256:b056306de26627e29bd6a6d04b1144456a1319ec0e15a67ebbc12b43362a27cd \ --hash=sha256:ff591f0247fda10842835e714a6dbf601a894432d33d6d98e20fe035a5ad952c @@ -907,14 +907,13 @@ starlette==0.41.3 \ --hash=sha256:0e4ab3d16522a255be6b28260b938eae2482f98ce5cc934cb08dce8dc3ba5835 \ --hash=sha256:44cedb2b7c77a9de33a8b74b2b90e9f50d11fcf25d8270ea525ad71a25374ff7 # via - # -r requirements/main.in # fastapi # safir structlog==24.4.0 \ --hash=sha256:597f61e80a91cc0749a9fd2a098ed76715a1c8a01f73e336b746504d1aad7610 \ --hash=sha256:b27bfecede327a6d2da5fbc96bd859f114ecc398a6389d664f62085ee7ae6fc4 # via - # -r requirements/main.in + # datalinker (pyproject.toml) # safir # safir-logging threadpoolctl==3.5.0 \ @@ -942,7 +941,7 @@ urllib3==2.2.3 \ uvicorn==0.34.0 \ --hash=sha256:023dc038422502fa28a09c7a30bf2b6991512da7dcdb8fd35fe57cfc154126f4 \ --hash=sha256:404051050cd7e905de2c9a7e61790943440b3416f49cb409f965d9dcd0fa73e9 - # via -r requirements/main.in + # via datalinker (pyproject.toml) uvloop==0.21.0 ; platform_python_implementation != 'PyPy' and sys_platform != 'cygwin' and sys_platform != 'win32' \ --hash=sha256:0878c2640cf341b269b7e128b1a5fed890adc4455513ca710d77d5e93aa6d6a0 \ --hash=sha256:10d66943def5fcb6e7b37310eb6b5639fd2ccbc38df1177262b0640c3ca68c1f \