Skip to main content

Pip handling for tiamat projects

Project description

Tiamat Pip

Pip handling for tiamat projects

Setup

In order to be able to pip install packages which can be used with your tiamat packaged application you need to add tiamat-pip as a dependency and your run.py should look similar to:

#!/usr/bin/env python3

import sys
import multiprocessing

import tiamatpip.cli
import tiamatpip.configure

import mainapp

# Configure the path where to install the new packages
tiamatpip.configure.set_user_site_packages_path("THIS SHOULD BE A HARDCODED PATH")


def main(argv):
    # Let's see if we should be handling pip related stuff
    if tiamatpip.cli.should_redirect_argv(argv):
        tiamatpip.cli.process_pip_argv(argv)
        # You can choose to `return` but there's really no need since the pip command
        # interceptions will trigger a `sys.exit` with the appropriate exit code.

    # If we reached this far, it means we're not handling pip stuff
    # Your application logic can resume

    mainapp.main(argv)
    sys.exit(0)


if __name__ == "__main__":
    if sys.platform.startswith("win"):
        multiprocessing.freeze_support()
    main(sys.argv)

Usage

When your package is compiled with tiamat and includes tiamat-pip, the pip commands get intercepted and the code logic runs within your packaged binary python runtime.

All pip commands and their respective CLI flags are supported.

Showing the pip usage and help

your-project-binary pip --help
your-project-binary pip install --help

Installing a python package

your-project-binary pip install foo
your-project-binary pip install foo>=2.1.0

Listing installed packages

your-project-binary pip list

This will list all of the python packages that were installed using pip, which, are not included in the binary.

Listing packages shipped with the binary

If you want to know which packages, and their respective versions, were shipped with the tiamat binary, issue the following command:

your-project-binary pip frozen

This command is not supported by pip. We intercept the call and get the package listing from the right place. The CLI flags for this command are the same as for pip list.

Uninstalling a package

your-project-binary pip uninstall foo

ATTENTION: Only the packages installed by pip can be uninstalled. The packages that were shipped with the binary cannot be uninstalled.

Known Issues

  • Getting the version of an upgraded package using pkg_resources.get_distribution(pkgname).version returns the version of the package that was shipped with the tiamat binary and not the upgraded package version. See #11 for more information.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tiamat-pip-1.6.0.tar.gz (32.6 kB view details)

Uploaded Source

Built Distribution

tiamat_pip-1.6.0-py3-none-any.whl (33.3 kB view details)

Uploaded Python 3

File details

Details for the file tiamat-pip-1.6.0.tar.gz.

File metadata

  • Download URL: tiamat-pip-1.6.0.tar.gz
  • Upload date:
  • Size: 32.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.8.12

File hashes

Hashes for tiamat-pip-1.6.0.tar.gz
Algorithm Hash digest
SHA256 82c51ac70b89d8ce29680b5b1e95c4350ce46355a607e30b6b5407d44c7fb6d2
MD5 1b7e0f2ac1c8c9ad42a3cf39463fd019
BLAKE2b-256 669674b359292390982618f2a87e9e428f23799fd8220b0b98593c5c82e7943c

See more details on using hashes here.

File details

Details for the file tiamat_pip-1.6.0-py3-none-any.whl.

File metadata

  • Download URL: tiamat_pip-1.6.0-py3-none-any.whl
  • Upload date:
  • Size: 33.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.8.12

File hashes

Hashes for tiamat_pip-1.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c7588529ac0e939d1038d5a73ed6371ff4690b5d8e2d96c3acdd732151643306
MD5 01703d370c56b37660f4f7cdea2d7674
BLAKE2b-256 5dccf8142d1ba5e101c9d6dbc4265c624c0618f1f7f34819d77928bb2174196a

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page