WhatAmIDoing
WhatAmIDoing

Reputation: 220

How to import a private repo into a project using pipenv

I have a common utils repo with a setup.py. I am trying to install this in a new repo using pipenv and am struggling to get it running.

I don't often play with setup.py so am definitely doing something dumb through not understanding so any help would be appreciated.

Common utils repo

Directory structure looks like:

.
├── setup.py
└── src
    └── utils
        ├── __init__.py
        └── utils.py.py

Setup file looks like

#!/usr/bin/env python
# -*- coding: utf-8 -*

from setuptools import find_packages, setup

install_requires = (...)  # some dependencies here

setup(
    name="common_utils",
    version="0.0.1",
    include_package_data=True,
    package_dir={"": "src"},
    packages=find_packages("src", include=["utils"]),
    install_requires=install_requires,
    process_dependency_links=True,
)

New app that needs to access utils

This app has a Pipfile which should reference that should reference the repo

...
[ packages ]
common_utils = { git = "[email protected]:me/utils-repo" }

When I run pipenv install I get the below error:

ipenv.patched.pip._internal.exceptions.InstallationError: Invalid requirement: 'common_utils@ [email protected]:me/utils-repo.git' (from line 2 of ...)
Hint: It looks like a path. File 'common_utils@ [email protected]:me/utils-repo.git' does not exist.

I'd love to know what I'm doing wrong here because I am going to need to set this up in a few places and I definitely don't understand how setup.py builds the utils library.

Upvotes: 0

Views: 146

Answers (1)

SamuelCook
SamuelCook

Reputation: 58

You could try adding the repository as a submodule:

git submodule add --name <repo name> -b <branch name>

If you subsequently need to update the submodule the command is

git submodule update --remote --init

Docs: https://git-scm.com/book/en/v2/Git-Tools-Submodules

Upvotes: 0

Related Questions