Utility functions for working with data from Nix in Python

Overview

Pynixutil - Utility functions for working with data from Nix in Python

Examples

Base32 encoding/decoding

import pynixutil

input = "v5sv61sszx301i0x6xysaqzla09nksnd"
b = pynixutil.b32decode(input)
output = pynixutil.b32encode(b)
assert input == output

Derivation parsing

import pynixutil

# Returns a dict with the same shape as nix show-derivation uses
d = pynixutil.drvparse(open("/nix/store/33cbakl9bg880apzjyvwwgkwsn8zzpcb-hello-2.10.drv").read())
print(d)

Returns a structure like

Derivation(
  outputs={
    "out": DerivationOutput(
      path="/nix/store/9rg06p1rcpw3y9m1xpji39w43zj0sny6-hello-2.10",
      hash_algo=None,
      hash=None
    )
  },
  input_drvs={
    "/nix/store/0bwic13piazaq033zz893fhd40pb6sj7-stdenv-linux.drv": [
      "out"
    ],
    "/nix/store/b7xrdpwx9jljhw32knn844xyvcmfkbfk-bash-4.4-p23.drv": [
      "out"
    ],
    "/nix/store/vsf383dfgky6bplikvbvixyshkdzd9hz-hello-2.10.tar.gz.drv": [
      "out"
    ]
  },
  input_srcs=[
    "/nix/store/9krlzvny65gdc8s7kpb6lkx8cd02c25b-default-builder.sh"
  ],
  system="x86_64-linux",
  builder="/nix/store/x0dcb2rxlzf32g0ddfkqqz1sfcyx4yay-bash-4.4-p23/bin/bash",
  args=[
    "-e",
    "/nix/store/9krlzvny65gdc8s7kpb6lkx8cd02c25b-default-builder.sh"
  ],
  env={
    "buildInputs": "",
    "builder": "/nix/store/x0dcb2rxlzf32g0ddfkqqz1sfcyx4yay-bash-4.4-p23/bin/bash",
    "configureFlags": "",
    "depsBuildBuild": "",
    "depsBuildBuildPropagated": "",
    "depsBuildTarget": "",
    "depsBuildTargetPropagated": "",
    "depsHostHost": "",
    "depsHostHostPropagated": "",
    "depsTargetTarget": "",
    "depsTargetTargetPropagated": "",
    "doCheck": "1",
    "doInstallCheck": "",
    "name": "hello-2.10",
    "nativeBuildInputs": "",
    "out": "/nix/store/9rg06p1rcpw3y9m1xpji39w43zj0sny6-hello-2.10",
    "outputs": "out",
    "patches": "",
    "pname": "hello",
    "propagatedBuildInputs": "",
    "propagatedNativeBuildInputs": "",
    "src": "/nix/store/3x7dwzq014bblazs7kq20p9hyzz0qh8g-hello-2.10.tar.gz",
    "stdenv": "/nix/store/qdf49mvm79r83n9c9s7pkmmjqwhrw8jv-stdenv-linux",
    "strictDeps": "",
    "system": "x86_64-linux",
    "version": "2.10"
  }
)

This mostly matches the data returned by nix show-derivation, but with more pythonic attribute names.

Owner
Tweag
Software Innovation Lab
Tweag
Personal Chat Assistance

Python-Programming Personal Chat Assistance {% import "bootstrap/wtf.html" as wtf %} titleEVT/title script src="https://code.jquery.com/jquery-3.

PRASH_SMVIT 2 Nov 14, 2021
Python3 Interface to numa Linux library

py-libnuma is python3 interface to numa Linux library so that you can set task affinity and memory affinity in python level for your process which can help you to improve your code's performence.

Dalong 13 Nov 10, 2022
Automatic and platform-independent unpacker for Windows binaries based on emulation

_ _ __ _ __ _ | | | | / / (_) \ \ | | | | | |_ __ | | _ | | _ __ __ _ ___| | _____ _ __

514 Dec 21, 2022
Render reMarkable documents to PDF

rmrl: reMarkable Rendering Library rmrl is a Python library for rendering reMarkable documents to PDF files. It takes the original PDF document and th

Robert Schroll 95 Dec 25, 2022
Simple plug-and-play installer for users who want to LineageOS from stock firmware, or from another custom ROM.

LineageOS for the Teracube 2e Simple plug-and-play installer for users who want to LineageOS from stock firmware, or from another custom ROM. Dependen

Gagan Malvi 5 Mar 31, 2022
A QGIS integration plugin for Kart repositories

QGIS Kart Plugin A plugin to work with Kart repositories Installation The Kart plugin is available in the QGIS Plugins server. To install the latest v

Koordinates 27 Jan 04, 2023
A repository containing useful resources needed to complete the SUSE Scholarship Challenge #UdacitySUSEScholars #poweredbySUSE

SUSE-udacity-cloud-native-scholarship A repository containing useful resources needed to complete the SUSE Scholarship Challenge #UdacitySUSEScholars

Nandini Proothi 11 Dec 02, 2021
Creates a release pull request updating changelog and tags with standard-version

standard version release branch Github action to open releases following convent

8 Sep 13, 2022
TinyBar - Tiny MacOS menu bar utility to track price dynamics for assets on TinyMan.org

📃 About A simple MacOS menu bar app to display current coins from most popular Liquidity Pools on TinyMan.org

Al 8 Dec 23, 2022
Provide error messages for Python exceptions, even if the original message is empty

errortext is a Python package to provide error messages for Python exceptions, even if the original message is empty.

Thomas Aglassinger 0 Dec 07, 2021
An esoteric programming language that supports concurrency, regex, and web requests.

The Hofstadter Esoteric Programming Language Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's La

Austin Henley 19 Dec 27, 2022
A simple script that can watch a list of directories for change and does some action

plot_watcher A simple script that can watch a list of directories and does some action when a specific kind of change happens In its current implement

Charaf Errachidi 12 Sep 10, 2021
API to summarize input text

summaries API to summarize input text normal run $ docker-compose exec web python -m pytest disable warnings $ docker-compose exec web python -m pytes

Brad 1 Sep 08, 2021
Transparently load variables from environment or JSON/YAML file.

A thin wrapper over Pydantic's settings management. Allows you to define configuration variables and load them from environment or JSON/YAML file. Also generates initial configuration files and docum

Lincoln Loop 90 Dec 14, 2022
Materials and information for my PyCascades 2021 Presentation

Materials and information for PyCascades 2021 Presentation: Sparking Creativity in LED Art with CircuitPython

GeekMomProjects 19 May 04, 2022
Python scripts to interact with Upper Deck ePack online trading card platform

This script should connect to the Upper Deck ePack API using your browser cookies and download a list of your current collection and save it as a CSV.

Adrian Kent 1 Nov 22, 2021
A python package that adds "docs" command to disnake

About This extension's purpose is of adding a "docs" command, its purpose is to help documenting in chat. How To Load It from disnake.ext import comma

7 Jan 03, 2023
🥦 Send and receive nano with 2 simple functions

easy_nano Send and receive nano (without having to understand the nano protocol).

1 Feb 14, 2022
Toppr Os Auto Class Joiner

Toppr Os Auto Class Joiner Toppr os is a irritating platform to work with especially for students it takes a while and is problematic most of the time

1 Dec 18, 2021
Cirq is a Python library for writing, manipulating, and optimizing quantum circuits and running them against quantum computers and simulators

Cirq is a Python library for writing, manipulating, and optimizing quantum circuits and running them against quantum computers and simulators. Install

quantumlib 3.6k Jan 07, 2023