Releases: simonw/symbex
1.4
New output options: --json
, --nl
, --csv
and --tsv
. These can be used to produce structured output which can be consumed by other tools such as sqlite-utils or llm embed-multi. #40
To generate and store embeddings for all of your symbols, run this:
symbex '*' '*:*' --nl | \
llm embed-multi symbols - \
--format nl --database embeddings.db --store
This produces an embeddings.db
database containing your code and its embeddings.
You can then run searches using llm similar:
llm similar symbols -d embeddings.db -c 'test csv' | jq
1.3.1
1.3
Three new filters: #38
--private
: return only symbols that have a_
prefix (excluding__*__
methods which are treated as public)--public
: the opposite of private - just symbols that don't have a_
prefix, but still returns__*__
methods--dunder
: return just symbols matching__*__
- should usually be used with*.*
to filter for class methods, e.g.symbex '*.*' --dunder
1.2
1.1
-
New
--check
option, which will return a non-zero exit code if the tool finds any matching symbols. This is designed to be used with Continuous Integration tools, where it can do things like detect if any functions have been added without docstrings by runningsymbex --function --undocumented --check
.--check
will not output anything by default. Add--count
to output a count of matching symbols, or-s/--signatures
to output the signatures of the matching symbols. -
New
--rexec SHELL_COMMAND
option, which can specify a shell command to be run for a single matching symbol in order to replace its body with the output of that command. This can be used with LLM to use language models to modify code in-place, for example:symbex my_function \ --rexec "llm --system 'add type hints and a docstring'"
This will add type hints and a generated docstring to the
my_function
function.
1.0
New --replace
option for piping replacement code to standard input and having symbex
modify a file in place to replace the matched symbol with the new implementation. #31
This is designed to be used with LLM, a command-line utility for the executing prompts against Large Language Models such as ChatGPT and GPT-4.
Example usage, to add type hints to the specified function:
symbex fetch_articles -n \
| llm --system 'add type hints' \
| symbex fetch_articles --replace
0.7
--stdlib
option for searching for code within the Python standard library. #29-m modulename
option for searching for code within one or more specific importable modules. #30-i/--imports
option causingsymbex
to output comments with# from module import function_name
comments. #26- Imports are calculated relative to the
-d
option used to run the script, but you can have them calculated against other directories by passing one or more--sys-path
options. -n/--no-file
option for suppressing the# File: ...
lines in the output. #28- The
-ni
shortcut can be used to apply both--imports
and--no-file
at once. -x/--exclude DIR
option for excluding a directory from being included in the search. #27--no-init
option for filtering out__init__
methods. This is especially useful when combined with--fully-typed
as it lets you see every class method that has full type annotations, excluding those__init__
methods:symbex '*.*' --fully-typed --no-init
- If a file cannot be read due to a Unicode error a warning will now be shown, unless
--silent
is passed. --docs
is now available as a shortcut for--docstrings
.symbex
can now be installed using Homebrew:brew install simonw/llm/symbex
.
0.6
0.5
- New filter options for filtering results to match specific criteria, documented here:
--function
,--class
,--async
,--typed
,--untyped
,--partially-typed
,--fully-typed
#21 - New
--count
option, returning a count of the number of symbols that matched the search criteria. To count every test function in a project:symbex 'test_*' --count
#22 - README now includes a copy of the
--help
output. #24
0.4
- Running
symbex
without any arguments now displays usage instructions. #14 - Running
symbex
against a huge directory now starts streaming results instantly, rather than pausing for an amount of time before starting to return content. #15 - Now correctly handles Python code that has been saved using an encoding other than
utf-8
. #18 symbex --signatures
mode now handles complex type annotations much better. #16, #19- Added a
Justfile
to help run tests and linters. #20