Skip to content

Releases: simonw/symbex

1.4

05 Sep 15:32
Compare
Choose a tag to compare

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

02 Sep 20:50
828166f
Compare
Choose a tag to compare
  • Function and class signatures output by this tool now include the trailing :. #39

1.3

19 Jul 01:51
d1784ac
Compare
Choose a tag to compare
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

16 Jul 16:55
ccb57d3
Compare
Choose a tag to compare
1.2
  • New --unasync filter option, for searching for just functions that are not async def functions. #37

1.1

16 Jul 01:12
Compare
Choose a tag to compare
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 running symbex --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

29 Jun 18:31
1904959
Compare
Choose a tag to compare
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

23 Jun 03:27
Compare
Choose a tag to compare
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 causing symbex 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

20 Jun 22:39
83ab58d
Compare
Choose a tag to compare
0.6
  • --docstrings causes the signature of each function to be shown with any docstrings included. #25
  • --documented filters for just classes and functions that have docstrings. --undocumented shows just classes and functions that do not have docstrings. #25

0.5

20 Jun 11:48
Compare
Choose a tag to compare
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

19 Jun 18:07
Compare
Choose a tag to compare
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