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

Metadata

Release files for sinv 0.1.1

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

Source distribution (sdist)

Source distribution for sinv 0.1.1
File Size Uploaded
sinv-0.1.1.tar.gz 63.0 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for sinv 0.1.1
File
sinv-0.1.1-py3-none-win_amd64.whl Python 3 none Windows x86-64 Details
sinv-0.1.1-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl Python 3 none Linux glibc 2.17+ x86-64 Details
sinv-0.1.1-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl Python 3 none Linux glibc 2.17+ x86-32 Details
sinv-0.1.1-py3-none-macosx_11_0_arm64.whl Python 3 none macOS 11.0+ ARM64 Details

Total release size: 13.0 MB

Release files / sinv-0.1.1.tar.gz

Download URL sinv-0.1.1.tar.gz
Size 63.0 kB
Tags Source
SHA-256 checksum
How to use checksums
e03df229f4ec4be510120f5e449f2d4aa94cf6bd670954862205ed80eee17d43
BLAKE2b-256 checksum
How to use checksums
838ae604bc542239c22ca7f648253512d21c5d3532b43ef3e734b29fef8f37a8
Upload date
Uploaded using Trusted Publishing?
What is 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}

Release files / sinv-0.1.1-py3-none-win_amd64.whl

Download URL sinv-0.1.1-py3-none-win_amd64.whl
Size 3.4 MB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
9dc15ddd204cce8400b1adc61629c98441c96ce6d6b407995c62939d3457e5f6
BLAKE2b-256 checksum
How to use checksums
386efe7a2ca568921b827145ce79443b1d57189b21401ef19e47747f460ac178
Upload date
Uploaded using Trusted Publishing?
What is 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}

Release files / sinv-0.1.1-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL sinv-0.1.1-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 3.6 MB
Tags Linux glibc 2.17+ x86-64 Python 3
SHA-256 checksum
How to use checksums
4a286bc69b37c1c11e076353c75c96d6239d3a95aa309324aa3cf35ff2fde0a3
BLAKE2b-256 checksum
How to use checksums
7848552482f64f50e5d7380dd9d5eccef89291c83b58e84eede2729190bd5571
Upload date
Uploaded using Trusted Publishing?
What is 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}

Release files / sinv-0.1.1-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl

Download URL sinv-0.1.1-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl
Size 2.8 MB
Tags Linux glibc 2.17+ x86-32 Python 3
SHA-256 checksum
How to use checksums
aaf04a41fd9b505c5090a1c87650ce51ae8489c307c6a260fad7881166e677db
BLAKE2b-256 checksum
How to use checksums
f953be45c247168418ede88b88c769e62d00db7b6bbfbf8a2bccbe77ba9a1d8f
Upload date
Uploaded using Trusted Publishing?
What is 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}

Release files / sinv-0.1.1-py3-none-macosx_11_0_arm64.whl

Download URL sinv-0.1.1-py3-none-macosx_11_0_arm64.whl
Size 3.1 MB
Tags Python 3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
598235eff510759c1f25244ffd4027168f3575fecb11a3aeabeadfa115c537ee
BLAKE2b-256 checksum
How to use checksums
462f589a19deccd9fce7b93a843f0ddd2aab62679157a399ac93e7633070df47
Upload date
Uploaded using Trusted Publishing?
What is 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}

Release history Release notifications | RSS feed

This release

0.1.1 This release

5 release files

0.1.0

5 release files

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