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

Add a migration guide from pip to uv projects #12382

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

Conversation

zanieb
Copy link
Member

@zanieb zanieb commented Mar 21, 2025

This is incomplete, but I wanted to post it to share progress. I've finished the "how" of importing from requirements.txt to pyproject.toml. The next step is to work on the narrative and explanation of other changes.

Rendered

@zanieb zanieb added the documentation Improvements or additions to documentation label Mar 21, 2025
@zanieb zanieb force-pushed the zb/pip-wip branch 2 times, most recently from 4eb8dd6 to 1c68c8e Compare March 21, 2025 21:19
Comment on lines +16 to +18
When using pip, requirements files specify both the dependencies for your project and lock
dependencies to a specific version. For example, if you require `fastapi` and `pydantic`, you'd
specify these in a `requirements.in` file:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
When using pip, requirements files specify both the dependencies for your project and lock
dependencies to a specific version. For example, if you require `fastapi` and `pydantic`, you'd
specify these in a `requirements.in` file:
When using `pip` with `pip-tools`, requirements files specify both the dependencies for your project and lock
dependencies to a specific version. For example, if you require `fastapi` and `pydantic`, you'd
specify these in a `requirements.in` file:


### Development dependencies

The requirements file format can only a single set of dependencies at once. This means if you have
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The requirements file format can only a single set of dependencies at once. This means if you have
The requirements file format can only describe a single set of dependencies at once. This means if you have

pytest
```

Notice the base requirements are included with `-r requirements.in`. This is common, as it ensures
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Notice the base requirements are included with `-r requirements.in`. This is common, as it ensures
Notice the base requirements are included with `-r requirements.in` with version constraints specified by `-c requirements.txt`. This is common, as it ensures

$ pip freeze > requirements.txt
```

```text tite="requirements.txt"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
```text tite="requirements.txt"
```text title="requirements.txt"


Here, all the versions constraints are _exact_. Only a single version of each package can be used.
The above example was generated with `uv pip compile`, but could also be generated with
`pip-compile` from `pip-tools`. The `requirements.txt` can also be generated using `pip freeze`, by
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
`pip-compile` from `pip-tools`. The `requirements.txt` can also be generated using `pip freeze`, by
`pip-compile` from `pip-tools`. The `requirements.txt` can also be generated using `pip freeze` on a pristine environment, by

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

Successfully merging this pull request may close these issues.

2 participants