How do I reference a local git branch in Pipfile?

66 Views Asked by At

Having 2 different repositories in local, I want to reference the feature branch of the repository 2 form the Pipfile of the repository 1.

How is it donde? I have this line in the Pipfile of repository 1 but it fails when generating the lock file.

repository2 = {editable = true, extras = ["dev"], path = "/Users/name.surname/Projects/repository2", branch = "feature/my_branch"}
1

There are 1 best solutions below

1
phd On BEST ANSWER

I don't think you can reference a branch from a path. A path is a path to source code, pipenv knows nothing about branches in the source code. So either you checkout the branch yourself or you tell to pipenv that the path is actually a repository so that pipenv clones it and checks out the branch:

repository2 = {editable = true, extras = ["dev"], git = "file:///Users/name.surname/Projects/repository2", ref = "feature/my_branch"}

In command line:

pipenv install git+file:///Users/name.surname/Projects/repository2@feature/my_branch

See another example at How can I specify a custom Git branch in my Pipfile?