Comments (6)
#39 should finally round this out. Example output below.
class Choice(Enum):
"""Blah
Attributes:
pear: help pears
banana: help bananas
"""
pear = 'pear'
banana = 'banana'
@spock
class OtherStuff:
"""Other stuff class
Attributes:
three: heahadsf
four: asdfjhasdlkf
"""
three: int
four: str
@spock
class Stuff:
"""Stuff class
Attributes:
one: help
two: teadsfa
"""
one: int
two: str
class ClassStuff(Enum):
"""Class enum
Attributes:
other_stuff: OtherStuff class
stuff: Stuff class
"""
other_stuff = OtherStuff
stuff = Stuff
@spock
class Test:
"""High level docstring that just so happens to be multiline adfjads;lfja;sdlkjfklasjflkasjlkfjal;sdfjlkajsdfl;kja
adfasfdsafklasdjfkladsjklfasdjlkf
Mid-level docstring
Attributes:
fail: help me obi wan
test: you are my only hopes
most_broken: class stuff enum
new_choice: choice type optionality
"""
new_choice: Optional[Choice]
fail: Tuple[Tuple[int, int], Tuple[int, int]]
test: Optional[List[int]]
most_broken: ClassStuff
usage: /Users/a635179/Documents/git_repos/open_source/spock/tests/debug/debug.py -c [--config] config1 [config2, config3, ...]
I am a description
configuration(s):
Test (High level docstring that just so happens to be multiline adfjads;lfja;sdlkjfklasjflkasjlkfjal;sdfjlkajsdfl;kja adfasfdsafklasdjfkladsjklfasdjlkf)
new_choice Optional[Choice] choice type optionality (default: None)
fail Tuple[Tuple[int, int], Tuple[int, int]] help me obi wan
test Optional[List[int]] you are my only hopes (default: None)
most_broken ClassStuff class stuff enum
Stuff (Stuff class)
one int help
two str teadsfa
OtherStuff (Other stuff class)
three int heahadsf
four str asdfjhasdlkf
Choice (Blah)
pear str help pears
banana str help bananas
ClassStuff (Class enum)
other_stuff type OtherStuff class
stuff type Stuff class
from spock.
Upon further inspection, the high-level description that you can provide during config initialization also isn't printed to the command line. Example:
config = ConfigArgBuilder(ModelConfig, desc='asd').generate()
>>> USAGE:
>>> spock_test.py -c [--config] config1 [config2, config3, ...]
>>> CONFIG:
>>> ModelConfig:
>>> n_features: int
>>> dropout: Optional[List[float]]
>>> hidden_sizes: Optional[Tuple[int]]
from spock.
@dorukkilitcioglu WIP branch that implements the core of the request. Print format is similar to argparser for consistency
@spock
class OtherStuff:
"""Other stuff class
Attributes:
three: heahadsf
four: asdfjhasdlkf
"""
three: int
four: str
@spock
class Stuff:
"""Stuff class
Attributes:
one: help
two: teadsfa
"""
one: int
two: str
class ClassStuff(Enum):
"""Class enum
Attributes:
other_stuff: OtherStuff class
stuff: Stuff class
"""
other_stuff = OtherStuff
stuff = Stuff
@spock
class Test:
"""High level docstring that just so happens to be multiline adfjads;lfja;sdlkjfklasjflkasjlkfjal;sdfjlkajsdfl;kja
adfasfdsafklasdjfkladsjklfasdjlkf
Mid-level docstring
Attributes:
fail: help me obi wan
test: you are my only hopes
most_broken: class stuff enum
"""
fail: Tuple[Tuple[int, int], Tuple[int, int]]
test: List[int] = [1, 2]
most_broken: ClassStuff
Running ConfigArgBuilder(Test, Stuff, OtherStuff, desc='I am a description').generate()
using the --help
flag will print this:
usage: /Users/a635179/Documents/git_repos/open_source/spock/tests/debug/debug.py -c [--config] config1 [config2, config3, ...]
I am a description
configuration(s):
Test (High level docstring that just so happens to be multiline adfjads;lfja;sdlkjfklasjflkasjlkfjal;sdfjlkajsdfl;kja adfasfdsafklasdjfkladsjklfasdjlkf)
fail Tuple[Tuple[int]] help me obi wan
test List[int] you are my only hopes (default: [1, 2])
most_broken ClassStuff class stuff enum
Stuff (Stuff class)
one int help
two str teadsfa
OtherStuff (Other stuff class)
three int heahadsf
four str asdfjhasdlkf
Lmk what you think
from spock.
Top level Enums now get caught by the help print on #39. Still need to figure out some hacky way to grab Enums nested in other types (e.g. List[List[Choice]]
) but that should round this out...
class Choice(Enum):
"""Blah
Attributes:
pear: help pears
banana: help bananas
"""
pear = 'pear'
banana = 'banana'
@spock
class OtherStuff:
"""Other stuff class
Attributes:
three: heahadsf
four: asdfjhasdlkf
"""
three: int
four: str
@spock
class Stuff:
"""Stuff class
Attributes:
one: help
two: teadsfa
"""
one: int
two: str
class ClassStuff(Enum):
"""Class enum
Attributes:
other_stuff: OtherStuff class
stuff: Stuff class
"""
other_stuff = OtherStuff
stuff = Stuff
@spock
class Test:
"""High level docstring that just so happens to be multiline adfjads;lfja;sdlkjfklasjflkasjlkfjal;sdfjlkajsdfl;kja
adfasfdsafklasdjfkladsjklfasdjlkf
Mid-level docstring
Attributes:
fail: help me obi wan
test: you are my only hopes
most_broken: class stuff enum
new_choice: choice type optionality
"""
new_choice: Choice
fail: Tuple[Tuple[int, int], Tuple[int, int]]
test: List[int] = [1, 2]
most_broken: ClassStuff
usage: /Users/a635179/Documents/git_repos/open_source/spock/tests/debug/debug.py -c [--config] config1 [config2, config3, ...]
I am a description
configuration(s):
Test (High level docstring that just so happens to be multiline adfjads;lfja;sdlkjfklasjflkasjlkfjal;sdfjlkajsdfl;kja adfasfdsafklasdjfkladsjklfasdjlkf)
new_choice Choice choice type optionality
fail Tuple[Tuple[int]] help me obi wan
test List[int] you are my only hopes (default: [1, 2])
most_broken ClassStuff class stuff enum
Choice (Blah)
pear str help pears
banana str help bananas
from spock.
This is starting to look quite good! Is there a reason why the type for fail
is cut short?
from spock.
This is starting to look quite good! Is there a reason why the type for
fail
is cut short?
Ahhh good question... Recently updated spock in v2.0.0 to handle Tuples different than Lists (Tuples are now length restricted) and I don't think some of the repr of type info got updated. Will fix
from spock.
Related Issues (20)
- Double nested class type with Enum fails to identify the str to Enum map
- Nested Configuration via CLI HOT 5
- Nested config values are not updated with provided value in --config file HOT 20
- Update Docs from Portray to Docusaurus HOT 1
- Is there a reason why dependencies are pinned? HOT 4
- ax-platform==0.2.3 fails tests
- Default values of nested list with items is a spock class. HOT 2
- SavePath HOT 2
- SavePath HOT 4
- Link to "Spock As a Drop In Replacement For Argparser" broken in docs HOT 1
- Spock-config has name clash with spock
- Is it possible to set a default namespace for command-line arguments? HOT 3
- SavePath from config.yaml file HOT 5
- Interpolation and Accessing environment variables and other resolvers inside the config.yaml similar to OmegaConf HOT 3
- Support for SM HyperparameterTuner
- Convert individual namespace within a Spockspace to a dictionary
- Nested List, Tuple error HOT 1
- Unable to use newer syntax of typing HOT 1
- Spock seems to be unusable, when running inside a jupyter notebook. HOT 2
- Remove config as a required argument HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from spock.