Added support for reading argparse instances inside classes#93
Open
fixeria wants to merge 1 commit intosphinx-doc:mainfrom
Open
Added support for reading argparse instances inside classes#93fixeria wants to merge 1 commit intosphinx-doc:mainfrom
fixeria wants to merge 1 commit intosphinx-doc:mainfrom
Conversation
Currently, sphinx-argparse can only read argparse instances from global variables/attributes within a module. This patch introduces the ability to specify a dotted path in ':func:' (e.g. 'Foo.Bar.parser') to reach ArgumentParser instances defined as class attributes. This is useful for CLI/REPL interfaces built with modules like 'cmd2', where argparse parsers are defined inside command handler classes. Initial patch by: Harald Welte <laforge@osmocom.org> Co-authored by: Vadim Yanitskiy <fixeria@osmocom.org>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #93 +/- ##
==========================================
+ Coverage 50.19% 50.22% +0.03%
==========================================
Files 18 19 +1
Lines 1289 1306 +17
Branches 262 263 +1
==========================================
+ Hits 647 656 +9
- Misses 598 607 +9
+ Partials 44 43 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Author
|
Hello @AA-Turner, as you suggested in #36 (comment), we've created a new pull request with unit tests. Though, Codecov is complaining about low testing coverage. Is this acceptable or shall I work on extending the coverage? Thank you. |
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.
Currently,
sphinx-argparsecan only readargparseinstances from global variables/attributes within a module. This patch introduces the ability to specify a dotted path in:func:(e.g.Foo.Bar.parser) to reachArgumentParserinstances defined as class attributes.This is useful for CLI/REPL interfaces built with modules like cmd2, where
argparseparsers are defined inside command handler classes.This is a follow-up to #36 (comment) and #60.