Source checkouts with uv?

I want to stay up-to-date and have created a new plone project using cookieplone (and uv). Now I want to move code and configuration from my older cookieplone created project to this new project.

In the older project I have a lot source checkouts in my mx.ini.

I have found

but I’m wondering if/how this can replace mx-dev?

How to automate the “git clone”? For CI: Do I have to manually add a script that checkout all the sources before “make install”? Or did I miss something?

We didn’t recommend a way to handle git clone because I don’t think there is consensus on the best way to do that yet in a uv-managed project.

mxdev recently gained the ability to update [tool.uv.sources] in pyproject.toml, so that might help. (Edit pyproject.toml file's `tool.uv.sources` option if it is a uv-managed project by erral · Pull Request #81 · mxstack/mxdev · GitHub) But you would need to modify the Makefile generated by cookieplone-templates in order to make it again run mxdev before the normal uv sync.

1 Like

The point is that if we have the code in git we do not need editable checkouts what we got when using mxdev.

If you just point to the source in [uv.tool.sources] uv will manage to download the source and build it in your project.

Another story is the need to have editable checkouts of other dependencies while in development, for that you will need something like David explained.

The point is that if we have the code in git we do not need editable checkouts what we got when using mxdev.

I’m not sure that I get this right. Do you mean that all packages should now be in the monorepo? If so: How do I add another package to the monorepo? Suppose I want to split my code into two packages: the policy package created by cookieplone and an other package. How to add this other package? Or should now everything live in the policy package?

Sorry, I didn't explain that properly.

"Editable checkouts" are just source checkouts installed in the project using pip install -e package.name

This is a feature of pip which allows installing arbitrary packages in a project.

It allows you editing any file in that checkout and the project will use it seamlessly.

uv does not have this concept of editable checkouts but you can tell uv to install a package from a git repository.

So, to use a package that is not published and lives in a git repository with uv, you can add it to the [tool.uv.sources] option in your pyproject.toml. This way, uv will download the package from git to somewhere in your computer and add it to your project. The point is that you don't have control over where this package will be downloaded (like the sources folder when using mx.ini) and you can't edit that package in your computer, because every time you run make install uv will download the package from git and install it again.

Thanks for clarifying this.

I have tested latest mxdev with uv support - works fine, thx!