0

I'd like to share some code with colleagues but I don't want to put it on PyPI or anything.

I thought I could do this by following the docs, but it doesn't seem to work.

The file structure is

/my_package
    /my_package
        __init__.py
        my_module.py
    setup.py
    README.md
    LICENSE

In particular, doing any of

pip3 install the_package_containing_setup.tar.gz
pip3 install . # from the same directory as setup.py
python3 setup.py install # from the same directory as setup.py

results in /usr/local/lib/python3.6/site-packages/my_package-py3.egg.info being made (I'm on Mac, with Python 3.6.5 installed from Homebrew). However, running pip3 freeze prints my_package=0.01.

In short, I'd like a way to do what the most-voted post here does, where I somehow put everything into some sort of zip file or tar ball and just have my colleagues run pip3 install tarball.tar.gz.

Is there a way to do this? Currently I just tell them to unzip the file and then drag and drop it into their project's site-packages folder.

  • So there is no folder called `my_package` in `/usr/local/lib/python3.6/site-packages/` when you use any of these commands? Can you try `import mypackage; mypackage.__file__`? Whats the output you get? – Clock Slave Nov 29 '18 at 06:22
  • No, I can't find such a file there or anywhere else. `import mypackage` fails with `ModuleNotFoundError`. – James Hortle Nov 30 '18 at 07:14
  • 1
    Packaging the code to a source dist is being done via `python setup.py sdist` command from terminal. After the command finishes, check out the emerged file in the `dist` directory, either `tar.gz` or `tar.bz2` or `zip` archive (depends on what you define in the setup script). This file is supposed to be installable via `pip install file.tar.gz`; if you miss any modules after the installation, it is likely you have misconfigured the package in the setup script. If this is the case, add the contents of `setup.py` to the question. – hoefling Nov 30 '18 at 11:41

0 Answers0