Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add cli for finding locations of registered func #12757

Merged
merged 17 commits into from
Jul 31, 2023

Conversation

victorialslocum
Copy link
Contributor

@victorialslocum victorialslocum commented Jun 27, 2023

Description

Add cli command for finding the locations of registered functions. Required function argument, optional registry name argument. Provides a local file link and line number for the function.

$ python -m spacy find-loc spacy.TextCatBOW.v2
Found registered function at file:///Users/.../spacy/ml/models/textcat.py:92

$ python -m spacy find-loc spacy.Corpus.v1 readers
Found registered function at file:///Users/.../spacy/training/corpus.py:22

Types of change

New cli feature

Checklist

  • I confirm that I have the right to submit this contribution under the project's MIT license.
  • I ran the tests, and all new and existing tests passed.
  • My changes don't require a change to the documentation, or if they do, I've added all required information.

@victorialslocum victorialslocum added the feat / cli Feature: Command-line interface label Jun 27, 2023
Copy link
Contributor Author

@victorialslocum victorialslocum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wasn't sure if we also wanted to put this in the docs or not, let me know if so and I can update that!

spacy/cli/find_loc.py Outdated Show resolved Hide resolved
@svlandeg svlandeg added the enhancement Feature requests and improvements label Jun 27, 2023
@victorialslocum victorialslocum marked this pull request as ready for review June 27, 2023 08:54
@adrianeboyd
Copy link
Contributor

find-function?

spacy/cli/find_loc.py Outdated Show resolved Hide resolved
spacy/cli/find_loc.py Outdated Show resolved Hide resolved
spacy/cli/find_loc.py Outdated Show resolved Hide resolved
spacy/cli/find_loc.py Outdated Show resolved Hide resolved
@svlandeg svlandeg marked this pull request as draft July 26, 2023 14:10
@svlandeg
Copy link
Member

I think this is neat :-)

$ spacy find-function spacy.TextCatBOW.v1 -r "architectures"
✔ Found registered function at
...\lib\site-packages\spacy_legacy\architectures\textcat.py:41

$ spacy find-function spacy.TextCatBOW.v2 -r "architectures"
✔ Found registered function at
...\spacy\ml\models\textcat.py:92

@svlandeg svlandeg marked this pull request as ready for review July 26, 2023 16:19
Copy link
Contributor

@rmitsch rmitsch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

spacy/cli/find_function.py Show resolved Hide resolved
@adrianeboyd
Copy link
Contributor

Looks good to me, thanks @victorialslocum!

@svlandeg svlandeg merged commit 49055ed into explosion:master Jul 31, 2023
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Feature requests and improvements feat / cli Feature: Command-line interface
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants