Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace pip-tools with Monotrail or Similar #192

Closed
mitsuhiko opened this issue May 18, 2023 · 9 comments
Closed

Replace pip-tools with Monotrail or Similar #192

mitsuhiko opened this issue May 18, 2023 · 9 comments

Comments

@mitsuhiko
Copy link
Collaborator

mitsuhiko commented May 18, 2023

The use of pip-tools in rye is because this is what we use at @getsentry. It's however by no means perfect, among other things it does not have proper locking support and the resolver is very hacky. I would like to investigate alternatives. Options that might exist:

Related issues that this would close:

@ddelange
Copy link

Hi 👋

Maybe you find this Makefile useful :) it uses pipgrip to to create (and later commit) a lockfile, and then uses that lockfile with pip's -c/--constraint flag in make install and in our Dockerfile. So the python package just has open version ranges, and the corresponding lockfile lives next to it.

.PHONY: lint
## Run linting
lint:
	pre-commit run --all-files

.PHONY: test
## Run tests
test:
	python -m pytest

.PHONY: install
## Install this repo, plus dev requirements, in editable mode
install:
	test -e requirements/pipgrip.lock || make lockfile
	pip install -r requirements/ci.txt -e . --constraint=requirements/pipgrip.lock
	pre-commit install

.PHONY: lockfile
## Create a lockfile for all python requirements.
lockfile:
	pip install -U pipgrip
	pipgrip -vv --sort --lock --tree .
	mv pipgrip.lock requirements/pipgrip.lock

.PHONY: help
## Print Makefile documentation
help:
	@perl -0 -nle 'printf("%-25s - %s\n", "$$2", "$$1") while m/^##\s*([^\r\n]+)\n^([\w-]+):[^=]/gm' $(MAKEFILE_LIST) | sort
.DEFAULT_GOAL := help

in Github Actions, we block PRs if they updated prod.txt (which is read into the package's install_requires), but they forgot to run make lockfile:

    - name: Check whether requirements/prod.txt changed
      id: requirements-changed
      uses: tj-actions/changed-files@v34
      with:
        files: |
          requirements/prod.txt

    - name: Check whether make lockfile was forgotten
      if: steps.requirements-changed.outputs.any_changed == 'true'
      env:
        PIP_INDEX_URL: ${{ secrets.PIP_INDEX_URL }}
      run: |
        make lockfile
        test ! "$(git diff)" && echo "no changes" || ( git diff && exit 1 )

@mitsuhiko
Copy link
Collaborator Author

That might be an interesting alternative to try.

@charbeljc
Copy link
Contributor

charbeljc commented May 29, 2023

Hi,

You also might look at rustine and pubgrub-pyo3 but this is a rather quick hack, nothing production ready :-)

Regards,
Charbel

@tekumara
Copy link

tekumara commented Sep 18, 2023

See also the prefix.dev resolver

@axel-kah
Copy link

See also the prefix.dev resolver

There's also a noteworthy blog post from the developers of Rattler Resolver which is a port of libsolv to Rust. They started with conda package support and they have set their eyes on PyPI packages support next.

@axel-kah
Copy link

There's also a noteworthy blog post from the developers of Rattler Resolver which is a port of libsolv to Rust. They started with conda package support and they have set their eyes on PyPI packages support next.

Seems like they already delivered: RIP (pip in Rust) 🦀

@GeorchW
Copy link
Contributor

GeorchW commented Mar 28, 2024

I think this can be closed now

@astrojuanlu
Copy link

xref #1185

@charliermarsh
Copy link
Member

Yes sorry -- we now use uv here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants