-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #108 from czue/develop
2024.12 release notes + uv updates
- Loading branch information
Showing
9 changed files
with
565 additions
and
241 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,6 +24,100 @@ python ./manage.py promote_user_to_superuser [email protected] | |
|
||
Now you should be able to access the django admin at http://localhost:8000/admin | ||
|
||
## Migrating from pip-tools to uv | ||
|
||
To migrate your project from pip-tools to uv follow these steps. | ||
|
||
### Install uv | ||
|
||
If you haven't already, [install uv](https://docs.astral.sh/uv/getting-started/installation/): | ||
|
||
```bash | ||
curl -LsSf https://astral.sh/uv/install.sh | sh | ||
``` | ||
|
||
### Update your project code | ||
|
||
It's recommended to do this in two steps: | ||
|
||
1. [Upgrade your project](./upgrading.md) to the latest Pegasus version, keeping your pacakge manager as "pip-tools". | ||
Merge all conflicts and ensure your project is working properly on this version. | ||
2. Then, change the package manager from pip-tools to uv in your project settings and do another upgrade/pull request. | ||
|
||
At this point you will likely have conflicts in your requirements files, but hopefully nowhere else. | ||
See the next sections for resolving these. | ||
|
||
### Prepare to resolve conflicts | ||
|
||
First, follow the github instructions to merge your project on your local machine, by checking out the pegasus upgrade | ||
branch and merging the main branch into it. | ||
You will have to update the command below with the exact branch name of the pull request created by Pegasus: | ||
|
||
``` | ||
git fetch origin | ||
git checkout pegasus-<version>-<timestamp> | ||
git merge main | ||
``` | ||
|
||
At this point you'll have a partially merged branch with conflicts. | ||
|
||
### Migrate your requirements.in files | ||
|
||
The uv build of Pegasus no longer uses requirements files, so any changes you've made to these will need | ||
to be migrated to `pyproject.toml` and `uv.lock`. | ||
|
||
You can use the [reqs-sync](https://github.com/saaspegasus/reqs-sync/) package to help with this. | ||
Follow the steps below for any file with conflicts. | ||
|
||
To migrate your main *requirements.in* file: | ||
|
||
```bash | ||
uv tool run reqs-sync reqs-to-toml requirements/requirements.in | ||
``` | ||
|
||
To migrate your development *dev-requirements.in* file: | ||
|
||
```bash | ||
uv tool run reqs-sync reqs-to-toml requirements/dev-requirements.in --group=dev | ||
``` | ||
|
||
To migrate your production *prod-requirements.in* file: | ||
|
||
```bash | ||
uv tool run reqs-sync reqs-to-toml requirements/prod-requirements.in --group=prod | ||
``` | ||
|
||
These commands should copy all project requirements from your `requirements.in` file(s) to your `pyproject.toml` file | ||
(into the appropriate group, if necessary). | ||
|
||
### Update your uv.lock file | ||
|
||
Next you should rebuild your `uv.lock` file from the updated `pyproject.toml` file: | ||
|
||
```bash | ||
uv lock | ||
``` | ||
|
||
You should then check the versions that were added to the `uv.lock` file and update any as | ||
needed based on the versions your requirements.txt files. | ||
|
||
### Test the migration | ||
|
||
Run your project (`uv run python manage.py runserver`) and verify everything works as expected. | ||
|
||
### Remove your requirements files | ||
|
||
Finally, run: | ||
|
||
```bash | ||
git rm requirements/*` | ||
``` | ||
|
||
To remove all your requirements files. | ||
|
||
Congratulations, you've migrated to uv! | ||
Resolve any other conflicts, push and merge your code, and you're done! | ||
|
||
## Migrating to auto-formatted code | ||
|
||
As of February, 2023 all Pegasus projects have the option to auto-format your Python code. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.