简体   繁体   中英

can I create python package with no publishing to pypi?

following this guide: https://realpython.com/pypi-publish-python-package/ can I just create my Python package but not publish it to pypi. just install it with pip install and then import my_packeg. when trying this get No module named my_packeg error the goal is to using this package code inside x micro service for prevent duplicate code...

From pip's user guide:

pip supports installing from PyPI, version control, local projects, and directly from distribution files.

The command-line to use is different:

There is a suitable command-line use for each of them and pip looks for, in the following order:

When looking at the items to be installed, pip checks what type of item each is, in the following order:

Project or archive URL. Local directory (which must contain a setup.py, or pip will report an error). Local file (a sdist or wheel format archive, following the naming conventions for those formats). A requirement, as specified in PEP 440. For your specific problem, you don't need to upload to PyPI. Solutions:

Build a "wheel" https://pip.pypa.io/en/stable/reference/pip_wheel/ and distribute that file, pip can install it. Place a zip archive of the source somewhere on your intranet (or shared file system) and call pip install http://intranet.url/mypackage-1.0.4.zip

source: Can I make pip installable package without registering package in pypi?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM