Local Python Packages

This page provides an overview of the various options and configurations available when using local-python sources. The quick-start guide also includes a section for getting started quickly with internally-built Python packages.

Local Python Sources

Similar to the local source for R packages, Package Manager has a local-python source type that can be used for uploading your local Python packages. Any repositories of the python type can subscribe to local-python sources, enabling you to create combined repos that subscribe to both PyPI and your internally-built Python packages. For example:

Terminal
# Create a local Python source:
$ rspm create source --name=local-python-src --type=local-python
Source 'local-python-src':
 Type:  Local Python
# Create a Python repository:
$ rspm create repo --name=python-repo --type=python --description='Access Python packages'
Repository: python-repo - Access Python packages - Python

# Subscribe the repository to the local Python source:
$ rspm subscribe --repo=python-repo --source=local-python-src
Repository: python-repo
Sources:
--local-python-src (Local Python)

# Subscribe the repository to the local Python source:
$ rspm subscribe --repo=python-repo --source=pypi
Repository: python-repo
Sources:
--local-python-src (Local Python)
--pypi (PyPI)

# Upload a single package:
$ rspm add --source=local-python-src --path=/path/to/package-1.0.0.tar.gz

# Upload a signed package:
$ rspm add --source=local-python-src --path=/path/to/example-0.0.3-py3-none-any.whl,/path/to/example-0.0.3-py3-none-any.whl.asc

# Upload multiple packages from a directory:
$ rspm add --source=local-python-src --path=/path/to/directory

# Upload multiple packages from a directory, keeping any existing packages:
$ rspm add --source=local-python-src --path=/path/to/directory --succeed-on-existing

# Upload multiple packages from a directory, replacing any existing packages:
$ rspm add --source=local-python-src --path=/path/to/directory --replace
Note

Priority order of sources in a repository is important. If there is a package that is in both PyPI and the local Python source and the repository is subscribed to both, the source that subscribed to the repo first takes precedence by default. The order can be rearranged by using the rspm reorder command. To find out more, refer to the command description in the CLI appendix.

Note

When uploading multiple packages from a directory, any signature files (*.asc) will be automatically included with their respective package files.

Note

Some packages originate elsewhere and only get re-hosted here, such as an internal rebuild of a public PyPI package. For those, the listing and detail pages show the date you added the package to this repository. They do not show the date the original publisher released it upstream. Local R packages behave the same way.

Note

Package Manager captures license and release-date information for older packages once, while the server starts. This applies only to packages you uploaded before Package Manager began recording that information. If your installation holds a very large number of them, the capture can add noticeably to the first startup after you upgrade. The server logs its progress as it goes.

To start the server without waiting, set Migration.SkipPythonLicenseCapture to true. Those packages then show no license and no release date. Remove the option and restart the server to capture them. Packages you upload after upgrading are unaffected.

Optionally Enabling Remote Authentication

Advanced

Local Python sources also support remote token authentication. You can use remote authentication to upload Python packages with either the CLI or with twine.

For more information, see the Remote Publishing documentation.

Back to top