Skip to main content

No project description provided

Project description

Intro

Tiamat is the single binary builder for Python projects.

Getting Started

The main idea behind Tiamat is to make building python projects as a single frozen binary easy. Therefore using tiamat just takes a few steps.

So we can start with an existing python application, this quickstart will assume that your python project has a standard setup.py and requirements.txt.

The only other thing that most projects will need is a run.py.

The run.py

Since Tiamat creates a single binary, it needs a single entry point. This entry point is defined in the file run.py. This is just a simple python script that is used to start your application. The contents of the run.py is typically the same code that is used in your setuptools entry point, or the startup script used in distutils. There is nothing special about the run.py, tiamat just needs an entry point that is clean python.

A typical run.py will look like this:

import myapp

def main():
    myapp.start()

main()

Just some good old python! If you are building a pop project then pop-seed will create the run.py for you.

Run Tiamat

Thats right! All you need outside of a run.py your python project likely already has! Tiamat uses the setup.py and requirements.txt files to build the environment used.

So assuming you have a standard python project defined, all you need to do is cd to that directory and run tiamat build, in this example we will assume the application is called foo:

tiamat build -n foo

This will kick off the process and the resulting binary will be placed in dist/foo

Now that the binary is available it can be directly called.

What Happened?

Tiamat starts with the version of python that you exceuted tiamat with. This python is the python that will be embeded in your binary. Next it creates a venv for your application. With the venv in hand, Tiamat populates it. The venv is populated with all of the deps that are defined as requrements for the main application, including the application itself.

Now that the venv has been set up, we tell PyInstaller to create a binary from the run.py. But PyInstaller is all about building a binary from all of the imports that come from the run.py. This is done to build a small binary and include only the most required code. But this is not the case for many applications, it is typical that things are late imported and the application assumes that a larger python environment is available. It is also typical that extra files are needed by the application and are typically added via the setup.py.

Instead of following the imports, Tiamat bundles the venv into the binary created by PyInstaller. This means that you have a strong assurance that the full, needed environment is available. This does make a larger binary, but it allows for a much easier and reliable build. Also, the binary is typically not much bigger.

Using the Build Addon

Many python projects require C libraries. How is it then, that the dynamic libs can be added to the final binary? Tiamat has an answer to this.

When running tiamat we can use a configuration file. This file allows for any option that would be passed on the cli to be defined, but also to define the routines for external builds.

A Tiamat config, that as an example, adds the library libsodium looks like this:

tiamat:
  build:
    libsodium:
      sources:
          - https://download.libsodium.org/libsodium/releases/LATEST.tar.gz
      make:
          - tar xvf LATEST.tar.gz
          - cd libsodium-stable && ./configure && make
      src: libsodium-stable/src/libsodium/.libs/libsodium.so
      dest: lib/

This example shows how we can define a library to download and build, then the src which is relative to the root of the build and the dest which is relative to the root of the venv.

The src can be a directory or a list of files, the dest is just a single directory to store the files.

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-4.8.tar.gz (15.9 kB view details)

Uploaded Source

Built Distribution

tiamat-4.8-py3-none-any.whl (16.2 kB view details)

Uploaded Python 3

File details

Details for the file tiamat-4.8.tar.gz.

File metadata

  • Download URL: tiamat-4.8.tar.gz
  • Upload date:
  • Size: 15.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.3

File hashes

Hashes for tiamat-4.8.tar.gz
Algorithm Hash digest
SHA256 314497283dc808d6cfd5b39a9d9b4fffcbe1689b0e8eb7b35a7e50617a83499f
MD5 29be93b279251106b032a7e7b9f54f09
BLAKE2b-256 46e1314e46816e38052f2cafcfcd85d073d0a3bfc39c7a35d2f4b00c33972d30

See more details on using hashes here.

File details

Details for the file tiamat-4.8-py3-none-any.whl.

File metadata

  • Download URL: tiamat-4.8-py3-none-any.whl
  • Upload date:
  • Size: 16.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.3

File hashes

Hashes for tiamat-4.8-py3-none-any.whl
Algorithm Hash digest
SHA256 cdd72e3a8a14936b7d6255c46cc9a777fa20b3bc7cfc9142819f2092764ea78d
MD5 5351b877b809d269aa0ee4ffd3726ec3
BLAKE2b-256 fa56b2a6b6dc888ea11b7c6798305395c42996791b9b8647da0a970ca4564f39

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