Add describe_method() for structured parameter introspection#1263
Open
caiocrocha wants to merge 1 commit intomalariagen:masterfrom
Open
Add describe_method() for structured parameter introspection#1263caiocrocha wants to merge 1 commit intomalariagen:masterfrom
caiocrocha wants to merge 1 commit intomalariagen:masterfrom
Conversation
This was referenced Mar 31, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The current
describe_apiimplementation lists API method names and summaries, however there was no easy way to programmatically discover a method's parameters (names, types, defaults, descriptions).The proposed
describe_methodmethod extracts this information from a method's docstring and returns a DataFrame containing one row per parameter, including its name, type, description, and default value. Example usage (Python console):Output:
Related Issues
Directly addresses: #1262
Relates to: #1238, #1141, #1123.
Why? All issues above mention difficulties in discovering the API and function arguments, including lack of interactive documentation, hard learning curve, and unclear parameter schema. The current PR contributes to more discoverable methods. In addition to the
describe_apimethod,describe_methodscan significantly simplify discovering the parameters of the API methods.Changes Made
Added a new describe_method(method_name) method to AnophelesDescribe that returns a DataFrame with columns: parameter, type, default, description. Includes _parse_param_docs() helper and 6 new tests.
Testing
Implemented tests:
Returns DataFrame: Verifies output structure with required columns (parameter, type, default, description);
Error Handling: Validates ValueError for non-existent methods;
Smoke Test: Uses "sample_sets" method to confirms it works on real methods;
Correct @doc() Parsing: Verifies parameter parsing from NumPy docstrings;
Empty Parameter: Tests passing empty parameters;
Keyword Arguments: Tests *args and **kwargs extraction.
Checklist
I have followed the steps covered in CONTRIBUTING.md:
[X] Tests pass locally
[X] Pre-commit hooks pass (or run pre-commit run --all-files)
[X] Code is well-documented
[X] Commit messages are clear and descriptive