Skip to main content

NuitkaBS

Nuitka build system

Why? What the reason of this project?

OK, we already have nuitka, and it works. It allows to build any python file as executable or module.

But reality is...

  • The most usual case in production is microservice monolith. It means the code base has many entry points. When you build single executable or single module, you are doing 95% of work twice or more. If you ready to wait forever until build complete, it's OK, but i'm not

  • Some libraries with C-extensions and fallback python code work incorrect. It's much easier to exclude these libraries from build

Modules? Yes, but...

Yes, nuitka allow to split application code by modules. And since this moment you have to write large number build commands -- one command for each module. If you decided to split anything into separated module -- you have to rewrite all commands again, adding --nofollow-import-to=my_new_module. If you added any module, you have to rewrite all these commands again. And again...

Сonclusion

NuitkaBS helps you to create really large number of build commands via simple to read, undarstand and edit YAML config

Installing

pip install -U nuitkabs

Pre-requirements

You should know nuitka generate C-files and then compile it via gcc or clang. So, you have to install compiler (gcc or clang), python development headers. It will be good if you install ccache

Usage

NuitkaBS is really thin wrapper over Nuitka. The first thing you have to create nuitkabs.yaml file in root of your project. The most keys you see in YAML config you can find in nuitka documentation. Example:

modules:
  models:
  views:
  starlette_app:
  ubjson:
    include-module:
      - ubjson.encoder
  starlette:
    include-module:
      - starlette.applications
      - starlette.endpoints

# =========

executables:
  my_script:
  my_daemon:

# =========

generic:
  output-dir: ../build/
  lto:
  remove-output:
  warn-unusual-code:
  follow-imports:
  plugin-enable:
    - pylint-warnings
  nofollow-import-to:
    - sqlalchemy
    - pandas
    - ujson
    - orjson
    - greenlet

Just compare keys and nuitka help page. They are the same.

Compile external library

Just look the example. Find ubjson and starlette modules. Yes, there are external libraries

Some tricks

List or single item

There is no difference between single item and item list:

generic:
  output-dir: 
    - ../build/

If you have nothing to say, don't say

If you have to enumerate your modules, but you have nothing to put as value -- just let value empty

modules:
  models:
  views:
  starlette_app:

[0.0.2]

Fix project description

[0.0.1]

Initial commit

Metadata

Release files for nuitkabs 0.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for nuitkabs 0.0.2
File Interpreter ABI Platform
nuitkabs-0.0.2-py3-none-any.whl Python 3 none any Details

Release files / nuitkabs-0.0.2-py3-none-any.whl

Download URL nuitkabs-0.0.2-py3-none-any.whl
Size 19.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
06ddbdbd5210c603f08c7bd77dca41fb6c08e7d3ba820fc6d0ca2d9db33657cf
BLAKE2b-256 checksum
How to use checksums
5d7f4a20972def7cb43541ab1adb4fa8bbf957cb487c56126e569461bf13a6a5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.4.2 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.3

Release history Release notifications | RSS feed

This release

0.0.2 This release

1 release file

0.0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page