I realise that I'm going about the usual use-case for Morgan backwards.
Normal would be:
- Add new dependency
bar to the morgan.ini file, with some constraints
- Morgan figures out that
bar depends on foo and downloads an appropriate version of both.
- Then in my offline mirror, do
uv add foo and uv will look at the mirror, see only the versions that Morgan has brought, and then pin to those.
All good so far.
I'm in an existing environment though, which is moving offline and I want to use morgan to set up mirrors.
It was straightforward enough to parse uv.lock files and convert them to morgan.ini files, with all the dependencies arranged in alphabetic order and pinned to specific versions, as such:
[requirements]
bar = ==1.2.3
foo = ==2.0.4
So what ends up happening is that since bar depends on foo, and bar's metadata shows that it requires >=2.0 but the latest package in PyPI has moved on since last time we pinned the requirements, so Morgan ends up downloading v2.1.4.
Sometimes this is not the end of the world, I just end up with a few more package versions than I really need. Other times, having more versions there confuses uv and it ends up not being able to resolve all dependencies in the offline environment.
Would it be possible to add a --no-resolver option or something like that, to have morgan download only the packages listed directly in the ini file?
I managed to get this working in a bit of a hacked way so I have an idea of how it could be done, am happy to contribute a PR, but my understanding of the overall architecture of the tool is limited so I'd need input from the architects.
I realise that I'm going about the usual use-case for Morgan backwards.
Normal would be:
barto themorgan.inifile, with some constraintsbardepends onfooand downloads an appropriate version of both.uv add fooanduvwill look at the mirror, see only the versions that Morgan has brought, and then pin to those.All good so far.
I'm in an existing environment though, which is moving offline and I want to use morgan to set up mirrors.
It was straightforward enough to parse
uv.lockfiles and convert them tomorgan.inifiles, with all the dependencies arranged in alphabetic order and pinned to specific versions, as such:So what ends up happening is that since
bardepends onfoo, andbar's metadata shows that it requires>=2.0but the latest package in PyPI has moved on since last time we pinned the requirements, so Morgan ends up downloading v2.1.4.Sometimes this is not the end of the world, I just end up with a few more package versions than I really need. Other times, having more versions there confuses
uvand it ends up not being able to resolve all dependencies in the offline environment.Would it be possible to add a
--no-resolveroption or something like that, to have morgan download only the packages listed directly in theinifile?I managed to get this working in a bit of a hacked way so I have an idea of how it could be done, am happy to contribute a PR, but my understanding of the overall architecture of the tool is limited so I'd need input from the architects.