We have an internal tool that was distributed simply by users cloning the git repository. The purpose of the tool is to configure newly created virtual machines for later testing our "real" product.
To make things easier for our users, we want the tool to run within these VMs (as part of VM creation itself).
The VMs have access to an Artifactory instance. Other people already created a local PyPI folder on that instance. So as soon as my tool sits on that local PyPI folder, the VM instances can easily install the tool from that location (that part works nicely, not part of my question).
I wrote a script that uses twine to build and then upload our tool to that Artifactory folder:
echo "Cleaning dist"
rm -rf ./dist/
echo "Building lastest version"
uv build
echo "Upload latest version"
python3 -m twine upload --repository-url https://whatever.com/artifactory/api/pypi/our-pypi-local -u $1 -p $2 dist/*
($1 and $2 are the user name and token passed as argument to the script.)
uv builds the .whl and .tar.gz, and Twine uploads it. Works fine. Then I figured that uv supports publishing directly. So I added
[[tool.uv.index]]
name = "artifactory"
url = "https://whatever.com/artifactory/api/pypi/our-pypi-local/"
publish-url = "https://whatever.com/artifactory/api/pypi/our-pypi-local/"
to our pyproject.toml file. Then I changed my script to:
echo "Cleaning dist"
rm -rf ./dist/
echo "Building lastest version"
uv build
echo "Upload latest version"
uv publish -v --index artifactory --username $1 --password $2
But that already breaks the build step:
Building source distribution...
× Failed to build `/Users/me/repos/mytool`
├─▶ Failed to resolve requirements from `build-system.requires`
├─▶ No solution found when resolving: `setuptools>=64`
╰─▶ Because setuptools was not found in the package registry and you require setuptools>=64, we can conclude that your requirements are unsatisfiable.
hint: An index URL (https://whatever.com/artifactory/api/pypi/our-pypi-local/) could not be queried due to a lack of valid authentication credentials (401
Unauthorized).
But: I don't want uv build to query anything. I want to build my tool the way it did before. And then I simply want uv to push the two files to that remote location.
How can I achieve that?