Skip to main content

sinv

License: MIT codecov crates.io

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.0.tar.gz (64.3 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.0-py3-none-win_amd64.whl (3.4 MB view details)

Uploaded Python 3Windows x86-64

sinv-0.1.0-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.0-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl (2.8 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ i686

sinv-0.1.0-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.0.tar.gz.

File metadata

  • Download URL: sinv-0.1.0.tar.gz
  • Upload date:
  • Size: 64.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.14.1

File hashes

Hashes for sinv-0.1.0.tar.gz
Algorithm Hash digest
SHA256 eb34feb88c8c5fb9828aca561ff0cd90eb57a23926c17d48c21026b2a09033d3
MD5 a7818fd323c340397cb92844773651d3
BLAKE2b-256 3310bd351e06659a388be09149527750ef6d9f74bb23e217d8a940361021d797

See more details on using hashes here.

File details

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

File metadata

  • Download URL: sinv-0.1.0-py3-none-win_amd64.whl
  • Upload date:
  • Size: 3.4 MB
  • Tags: Python 3, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.14.1

File hashes

Hashes for sinv-0.1.0-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 7bab749b6aa47b3147c4633dea48b5d109029319be07eab662aca606b99df74e
MD5 5036452ffcb22d32f14c7d131cf76016
BLAKE2b-256 a54b69c18ac8963f7c4a475154b4fce3e7ed183a10dfa389e0e2e700510e81a5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for sinv-0.1.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 7d34e47348e84cf17637a14aab2a08f3092d8c6dd823054f81605521c8dfc411
MD5 d9cfa3c35cd1a900f3f530797585ee67
BLAKE2b-256 142d9d194a43c83b887ab1a0a275219a9bf86699f26a0083cfbdc756c67b7784

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for sinv-0.1.0-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 59600c1cc734df2e888d3475e90220eb45da3edaf4c759eb34087f7d273db618
MD5 f75fe56420983a136d7ece8a87ac74cf
BLAKE2b-256 d1c697e86aeed5e4dad73693b73745ea7ed5472bbc9b9922cac8ca0a5a734f57

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for sinv-0.1.0-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b80569679a32b28b7f85cf7b954c21f042b1b469f8fbf944e5400eb62956f7c9
MD5 eb78ef9825a7db53273828ab41262c02
BLAKE2b-256 a0a056b9adc4a4ab76d230f0fafb9f015f8788464f1ac1310bbd8d30d2f472f5

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