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
Example python package with pybind11 cpp extension

Developing C++ extension in Python using pybind11 This is a summary of the commands used in the tutorial.

55 Sep 04, 2022
synchronize projects via yaml/json manifest. built on libvcs

vcspull - synchronize your repos. built on libvcs Manage your commonly used repos from YAML / JSON manifest(s). Compare to myrepos. Great if you use t

python utilities for version control 200 Dec 20, 2022
Get a list of the top-10 rejected libraries in your WhiteSource inventory

WhiteSource Top 10 Rejected Libraries Generate a spreadsheet listing the 10 most common libraries in your WhiteSource inventory that were rejected by

WhiteSource-PS-tools 10 Mar 23, 2022
LiteX-Acorn-Baseboard is a baseboard developed around the SQRL's Acorn board (or Nite/LiteFury) expanding their possibilities

LiteX-Acorn-Baseboard is a baseboard developed around the SQRL's Acorn board (or Nite/LiteFury) expanding their possibilities

33 Nov 26, 2022
Junos PyEZ is a Python library to remotely manage/automate Junos devices.

The repo is under active development. If you take a clone, you are getting the latest, and perhaps not entirely stable code. DOCUMENTATION Official Do

Juniper Networks 623 Dec 10, 2022
A tool that automatically creates fuzzing harnesses based on a library

AutoHarness is a tool that automatically generates fuzzing harnesses for you. This idea stems from a concurrent problem in fuzzing codebases today: large codebases have thousands of functions and pie

261 Jan 04, 2023
Macros in Python: quasiquotes, case classes, LINQ and more!

MacroPy3 1.1.0b2 MacroPy is an implementation of Syntactic Macros in the Python Programming Language. MacroPy provides a mechanism for user-defined fu

Li Haoyi 3.2k Jan 06, 2023
Turn a raspberry pi into a Bluetooth Midi device

PiBluetoothMidSetup This will change serveral system wide packages/configurations Do not run this on your primary machine or anything you don't know h

MyLab6 40 Sep 19, 2022
A partial-transpiler that converts a subset of Python to the Folders esoteric programming language

Py2Folders A partial-transpiler that converts a subset of Python to the Folders esoteric programming language Folders Folders is an esoteric programmi

Daniel Johnson 1 Dec 23, 2021
A tool that bootstraps your dotfiles ⚡️

Dotbot Dotbot makes installing your dotfiles as easy as git clone $url && cd dotfiles && ./install, even on a freshly installed system! Rationale Gett

Anish Athalye 5.9k Jan 07, 2023
Combines power of torch, numerical methods to conquer and solve ALL {O,P}DEs

torch_DE_solver Combines power of torch, numerical methods and math overall to conquer and solve ALL {O,P}DEs There are three examples to provide a li

Natural Systems Simulation Lab 28 Dec 12, 2022
El_Binario - A converter for Binary, Decimal, Hexadecimal and Octal numbers

El_Binario El_Binario es un conversor de números Binarios, Decimales, Hexadecima

2 Jan 28, 2022
Learn to code in any language. If

Learn to Code It is an intiiative undertaken by Student Ambassadors Club, Jamshoro for students who are absolute begineers in programming and want to

Student Ambassadors' Club at Mehran UET 15 Oct 19, 2022
Python decorator for `TODO`s

Python decorator for `TODO`s. Don't let your TODOs rot in your python projects anymore !

Klemen Sever 74 Sep 13, 2022
Integration of CCURE access control system with automation HVAC of a commercial building

API-CCURE-Automation-Quantity-Floor Integration of CCURE access control system with automation HVAC of a commercial building CCURE is an access contro

Alexandre Edson Silva Pereira 1 Nov 24, 2021
AdventOfCode 2021 solutions from the Devcord server

adventofcode-21 Ein Sammel-Repository für Advent of Code 2021-Lösungen der deutschen DevCord-Community. A repository collecting Advent of Code 2021 so

Devcord 12 Aug 26, 2022
Ferramenta de monitoramento do risco de colapso no sistema de saúde em municípios brasileiros com a Covid-19.

FarolCovid 🚦 Ferramenta de monitoramento do risco de colapso no sistema de saúde em municípios brasileiros com a Covid-19. Monitoring tool & simulati

Impulso 49 Jul 10, 2022
basic tool for NFT. let's spam, this is the easiest way to generate a hell lotta image

NFT generator this is the easiest way to generate a hell lotta image buckle up and follow me! how to first have your image in .png (transparent backgr

34 Nov 18, 2022
fast_bss_eval is a fast implementation of the bss_eval metrics for the evaluation of blind source separation.

fast_bss_eval Do you have a zillion BSS audio files to process and it is taking days ? Is your simulation never ending ? Fear no more! fast_bss_eval i

Robin Scheibler 99 Dec 13, 2022
Spartan implementation of H.O.T.T.

Down The Path I was walking down the line, Trying to find some peace of mind. Then I saw you, You were takin' it slow, And walkin' it one step at a ti

Trebor Huang 25 Aug 05, 2022