I have lots of git dependencies in my various proj...
# general
s
I have lots of git dependencies in my various project, for instance
Copy code
"microsoft-python-type-stubs @ git+<https://github.com/microsoft/python-type-stubs.git>"
rather than relying on this, I would like to publish these packages to my own repo and then refer to that package directly.
āœ… 1
Do you have a nice workflow for that?
I tried this:
Copy code
python_requirement(
    name="type-stubs",
    resolve="repos",
    requirements=[
        "microsoft-python-type-stubs @ git+<https://github.com/microsoft/python-type-stubs.git>"
    ],
)

python_distribution(
    name="microsoft-python-type-stubs",
    dependencies=[":type-stubs"],
    provides=python_artifact(
        name="microsoft-python-type-stubs",
        version="1.0.0",
    ),

    repositories=[
        "<https://europe-west4-python.pkg.dev/xxxxxxxx>",
    ],
)
but don't think it's the right way
and I get this error:
Copy code
Failed to generate lockfile for python-default: UV lock failed: Using CPython 3.12.5
error: Package `microsoft-python-type-stubs` attempted to resolve via URL: git+<https://github.com/microsoft/python-type-stubs.git>. URL dependencies must be expressed as direct requirements or constraints. Consider adding `microsoft-python-type-stubs @ git+<https://github.com/microsoft/python-type-stubs.git>` to your dependencies or constraints file.

āœ— Failed to generate lockfile for python-default
even a non-pants workflow
f
Why not just mirror the relevant parts of PyPI using bandersnatch?
Or you want to vendor the git repositires?
Would a git submodule workflow help?
s
I don't want to use submodules, I already have enough
Does bandersnatch supports mirroring from git to a pip repositorty?
looking at the docs
f
I think it is just for mirroing PyPI
s
yeah the issue is that these packages are not on pip
f
Maybe just download a source archive from GitHub and unpack it in your repository?
s
I am creating a pants plugin
Copy code
mirror_python_dependency(
    name="microsoft_python_type_stubs",
    source="microsoft-python-type-stubs @ git+<https://github.com/microsoft/python-type-stubs.git>",
    repository="<https://oauth2accesstoken@europe-west4-python.pkg.dev/xxxxxxx>",
)
ideally
Copy code
mirror_python_dependencies(
  source="packages_to_mirror.txt"
)