Baroness
Toolkit for easy searching and manipulation of python source code using redbaron.
Installation
pip install baroness
Usage
Searching
You can search through python code using the redbaron API on the commandline. By default baroness will search through all python files from the current directory down recursively. The search pattern is just regular python code that would work with redbaron. The top level node is called root.
For example to search for all name nodes with a value of bar:
baroness search 'root("name", value="bar")'
search is the default subcommand so you can write the same with:
baroness 'root("name", value="bar")'
For full usage look at baroness search --help:
usage: baroness search [-h] [--no-cache] [--parents PARENTS] [--no-color]
[--no-linenos]
pattern [files [files ...]]
positional arguments:
pattern Python redbaron code to search where `root` is the
variable holding the tree
files File names and/or glob pattern. Default to recursive
search of python all files.
optional arguments:
-h, --help show this help message and exit
--no-cache Do no use the cache in `.baroness` even if it exists
--parents PARENTS Number of parents to go up on matched nodes.
--no-color Do not color the output.
--no-linenos Do not output the linenumbers.
Caching
Parsing python files to a baron fst can be time consuming for large code bases. Baroness can cache the baron fst as json files to save time when searching. By default caching isn’t enabled, but will be used if baroness finds a .baroness directory.
Saving/Initialising Cache
To enable caching (and initially create cache) you can use:
baroness cache save
For full usage look at baroness cache save --help:
usage: baroness cache save [-h] [--force] [FILE [FILE ...]] Save given files (all tree) to disk positional arguments: FILE Files to save to cache. optional arguments: -h, --help show this help message and exit --force Save over already existing cache files.
Clearing the Cache
To delete all .baroness directories recursively use:
baroness cache delete
Metadata
Release files for baroness 1.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| baroness-1.3.0.tar.gz | 6.0 kB | Without provenance | Details for baroness-1.3.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| baroness-1.3.0-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details for baroness-1.3.0-py2.py3-none-any.whl |
Total release size: 13.1 kB
Release files / baroness-1.3.0.tar.gz
| Download URL | baroness-1.3.0.tar.gz |
|---|---|
| Size | 6.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a64e42e2bfef2d1e6d168d484c28224e7af3e8e55b5685bb6c8944b700cc0c23
|
|
BLAKE2b-256 checksum How to use checksums |
95de9784a911c824a9e3eaf19dfc4006ce22c7fde2101d49cdc98c298b976d3d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/39.0.1 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/2.7.15
|
Release files / baroness-1.3.0-py2.py3-none-any.whl
| Download URL | baroness-1.3.0-py2.py3-none-any.whl |
|---|---|
| Size | 7.1 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
e890a7592f02131b9128ec34e2ad6914dca2ba13422949bfb8c4beaaac969600
|
|
BLAKE2b-256 checksum How to use checksums |
b51e04b3aa6f9a72786e2b61bb5e24e6de368d0e92b663f5cfba55374ede7499
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/39.0.1 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/2.7.15
|
Security for baroness 1.3.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.