ido50 / morgan

PyPI Mirror for Restricted/Offline Environments
Apache License 2.0
105 stars 7 forks source link

morgan missing optional requirements when mirroring jupyterlab #17

Open alex-orange opened 9 months ago

alex-orange commented 9 months ago

Morgan version 0.13.4

Mirroring jupyterlab ==4.0.9 misses the fqdn requirement of the format-nongpl optional-dependency of jsonschema. This dependency is pulled in by jupyter_events which chains up by jupyter_server > jupyterlab_server > jupyterlab.

From pyproject.toml of jupyter-events (which is included in the mirror index):

...
[project]
...
dependencies = [
    "referencing",
    "jsonschema[format-nongpl]>=4.18.0",
    "python-json-logger>=2.0.4",
    "pyyaml>=5.3",
    "traitlets>=5.3",
    # The following are necessary to address an issue where pyproject.toml normalizes extra dependencies
    # such that 'format_nongpl' is normalized to 'format-nongpl' which prevents these two validators from
    # from being installed when jsonschema is <= 4.9 because jsonschema uses 'format_nongpl' in those releases.
    "rfc3339-validator",
    "rfc3986-validator>=0.1.1",
]
...

From pyproject.toml of jsonschema (which is also included in the mirror index):

...
[project.optional-dependencies]
...
format-nongpl = [
  "fqdn",
  "idna",
  "isoduration",
  "jsonpointer>1.13",
  "rfc3339-validator",
  "rfc3986-validator>0.1.0",
  "uri_template",
  "webcolors>=1.11",
]
...

fqdn is NOT included in the mirror index (hence the problem) and causes a pip install against the mirror to fail for jupyterlab (or simpler and smaller for jupyter-event).

Beyond what I've described I don't understand what's going on (how morgan calculates dependencies), but I'm happy to help debug.

alex-orange commented 9 months ago

P.S. It's worth mentioning that when I looked into this pipdeptree seems to have a similar symptom in that it doesn't realize that fqdn is an optional dependency pulled in by jsonschema's optional that's required by jupyter-events.