4

I have python package which need to be installed to run a Django project?

I go into the python virtual environment and clone the module from git in site-packages folder inside lib.

What i need is to make that module pip intallable and installation access should be given only to specific people i.e that module should not be public to everyone.

3
  • Don't clone into the site-packages. Just clone it to a temporary location. Then make sure you have the virtual environment activated and do pip install <folder-name> where the <folder-name> is the directory git created when you cloned. That should install the module to your virtual environment only. Commented Mar 26, 2019 at 18:25
  • can you tell me a way using Pypi? Commented Mar 26, 2019 at 18:29
  • Anything you upload to PyPi will be public. See @daniellong's answer Commented Mar 26, 2019 at 18:49

2 Answers 2

7

Build the python package as you normally would for a public build. For helpful step-by-step instructions on that front, check out the python docs

There are a number of ways to maintain both installability and privacy. When I looked into this for my own packages I started with the suggestions at this site. This site includes instructions on how to build your own equivalent of a PyPi server.

The solution I landed on though, I feel is quite simpler. I pushed the entire package to a private git repository hosted on github. You can then install using pip install git+[insert full url to your github repository here]. You can enforce privacy by restricting who has access to your git repository.

Sign up to request clarification or add additional context in comments.

Comments

1

To make your package part of the requirements, place it where it will be accessible only by the people you want to have access, e.g. on a private github. Then you can add a line like this to any project's requirements.txt, and pip will fetch it and install it:

-e git://github.com/<user>/<package>.git#egg=<package> 

(Replace with the name of the package you are distributing.) This line is simply added to the list of simple package names that requirements.txt usually contains. You could also replace the git download with an egg placed on a local fileshare, or whatever.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.