Skip to main content

sinv

License: MIT crates.io PyPI Version

A CLI toolkit for handling Sphinx inventory files. It is modeled after sphobjinv but has several improvements over it:

  1. it is up to 200x faster (see benchmarks)
  2. it supports colourised output
  3. it is easier to pronounce (ess-inv)

Installation

You can install the binary simply form PyPi using your favourite method:

uv tool install sinv

If you prefer you can also install it from crates.io:

cargo install sinv

If you wish you can also of course build it from source:

cargo install --git https://github.com/aslowwriter/sinv

though I am also planning more distribution channels like crates.io, conda-forge and possibly pypi.

Usage

Currently sinv has two subcommands:

write

write is used to find and retrieve inventory files from various sources and write them in the appropriate place in the appropriate format. This can be used to easily modify them as shown in the demo.

For example:

sinv write - foo.inv # input over std output to file
sinv write https://docs.kernel.org/objects.inv - # read from url, output over stdout
sinv write foo.inv foo.txt -e plain # convert foo.inv to plain-text version you can edit

By default the output will be the standard zlib format. sinv will use the Sphinx shorthand ($ and - as standin for display name) to compress the output in a way Sphinx expects when outputting to zlib by default. This can also be enabled by using the -m flag when outputting to plain-text

suggest

suggest suggest is for fuzzy finding entries in your inventory files if you're looking for a particular one.

for example you can search in the linux kernel docs for entries containing the word "watchdog" and return the top 5 matches that have at least a score of 100 (scoring is dependant on the length of your query) like so:

sinv suggest watchdog https://docs.kernel.org/objects.inv -m 5 -t 100

Note that sinv will only output colours if it detects your terminal can support it. These decisions can be overridden by setting either the NO_COLOR or FORCE_COLOR environment variable.

textconv

Sphobjinv also includes a textconv utility for viewing diffs of inventory files. This is also implemented, but given that it had some unique design constraints it was published as a separate project here

FAQ

Q: I have a file that isn't parsing!

A: Since this is written in a compiled language we can't easily install extensions like Python can, therefore it is very possible that you have a valid file that isn't parsing correctly. Because there is a lot of extensions out there and it is unclear how many of them are still actively used we limited ourselves to a few of the bigger projects (like http, sip provided by PyQt, and cmake). If you have one that we don't support yet, please open an issue at sphinx_inv (the parser), we'd love to fix it!

Q: What's the status of the project?

A: Currently the project is mostly "done." That means that it does what I need it to do for now, so it may not see regular updates. However, I'm happy to take bug reports and feature requests, and may implement functionalities as needed. The project is still maintained, but I'd rather wait to have actual usecases we can address properly rather than implement a bunch of features nobody is interested in.

Q: Can I use this in my Python code?

A: Not currently because I haven't had a need for that. However, I see no reason it couldn't be made available if anyone would like it. So if you want to use it from Python, please open a feature request.

Benchmarks

Below are two comparisons between sinv and sphobjinv:

a horizontal bar graph showing the average time to parse the linux kernel docs objects.inv and write it out again also in zlib on a logarithmic scale. There are two bars: sinv(99.14 ms) and sphobjinv(586.21 ms)

a horizontal bar graph showing the average time to parse the linux kernel docs objects.inv and find fuzzy matches with the query "watchdog" on a logarithmic scale. There are two bars: sinv(35.41 ms) and sphobjinv-textconv (7721.91 ms)

To run the benchmarks we recommend you have the following tools installed (though only hyperfine, cargo, and sphobjinv are required):

  • cargo to compile the project
  • hyperfine for running the benchmarks and generating the timing data
  • uv to manage the dependencies of and run the Python script for generating the plot
  • just to run the commands
  • curl for downloading the objects.inv file

if you have all these, running the benchmarks should be as easy as

just benchmark

this will:

  1. download the linux kernel docs inventory file
  2. compile the binary
  3. use hyperfine to run the benchmarks
  4. run the plotting script through uv

if you want to benchmark a different objects.inv file all you have to do is replace the url in this line of the justfile :

curl -Lo objects.inv https://docs.kernel.org/objects.inv

Note: due to differences in hardware or parsing files, the actual value of the timings may be quite different than the ones in the plot, but the relative ordering of the implementations should remain the same.

Acknowledgements

  • Thank you to Brian Skinn et al. for writing sphobjinv and documenting the Sphinx inventory format They have been invaluable in writing this application

Template

This repo was initially setup using cargo-generate and this template

Download files

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

Source Distribution

sinv-0.1.1.tar.gz (63.0 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

sinv-0.1.1-py3-none-win_amd64.whl (3.4 MB view details)

Uploaded Python 3Windows x86-64

sinv-0.1.1-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.6 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ x86-64

sinv-0.1.1-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl (2.8 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ i686

sinv-0.1.1-py3-none-macosx_11_0_arm64.whl (3.1 MB view details)

Uploaded Python 3macOS 11.0+ ARM64

File details

Details for the file sinv-0.1.1.tar.gz.

File metadata

  • Download URL: sinv-0.1.1.tar.gz
  • Upload date:
  • Size: 63.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.3 {"installer":{"name":"uv","version":"0.12.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for sinv-0.1.1.tar.gz
Algorithm Hash digest
SHA256 e03df229f4ec4be510120f5e449f2d4aa94cf6bd670954862205ed80eee17d43
MD5 cb26a123f4508c52713708f5759e3356
BLAKE2b-256 838ae604bc542239c22ca7f648253512d21c5d3532b43ef3e734b29fef8f37a8

See more details on using hashes here.

File details

Details for the file sinv-0.1.1-py3-none-win_amd64.whl.

File metadata

  • Download URL: sinv-0.1.1-py3-none-win_amd64.whl
  • Upload date:
  • Size: 3.4 MB
  • Tags: Python 3, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.3 {"installer":{"name":"uv","version":"0.12.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for sinv-0.1.1-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 9dc15ddd204cce8400b1adc61629c98441c96ce6d6b407995c62939d3457e5f6
MD5 769596dd4f8d42b35763e507dcdc058d
BLAKE2b-256 386efe7a2ca568921b827145ce79443b1d57189b21401ef19e47747f460ac178

See more details on using hashes here.

File details

Details for the file sinv-0.1.1-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

  • Download URL: sinv-0.1.1-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
  • Upload date:
  • Size: 3.6 MB
  • Tags: Python 3, manylinux: glibc 2.17+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.3 {"installer":{"name":"uv","version":"0.12.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for sinv-0.1.1-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4a286bc69b37c1c11e076353c75c96d6239d3a95aa309324aa3cf35ff2fde0a3
MD5 8540322effbb378d9ec5507f7b141693
BLAKE2b-256 7848552482f64f50e5d7380dd9d5eccef89291c83b58e84eede2729190bd5571

See more details on using hashes here.

File details

Details for the file sinv-0.1.1-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl.

File metadata

  • Download URL: sinv-0.1.1-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl
  • Upload date:
  • Size: 2.8 MB
  • Tags: Python 3, manylinux: glibc 2.17+ i686
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.3 {"installer":{"name":"uv","version":"0.12.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for sinv-0.1.1-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 aaf04a41fd9b505c5090a1c87650ce51ae8489c307c6a260fad7881166e677db
MD5 50012312143d653d50ac82095546b887
BLAKE2b-256 f953be45c247168418ede88b88c769e62d00db7b6bbfbf8a2bccbe77ba9a1d8f

See more details on using hashes here.

File details

Details for the file sinv-0.1.1-py3-none-macosx_11_0_arm64.whl.

File metadata

  • Download URL: sinv-0.1.1-py3-none-macosx_11_0_arm64.whl
  • Upload date:
  • Size: 3.1 MB
  • Tags: Python 3, macOS 11.0+ ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.3 {"installer":{"name":"uv","version":"0.12.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for sinv-0.1.1-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 598235eff510759c1f25244ffd4027168f3575fecb11a3aeabeadfa115c537ee
MD5 652c2ec03649ede726ef23201bc9c269
BLAKE2b-256 462f589a19deccd9fce7b93a843f0ddd2aab62679157a399ac93e7633070df47

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page