Comments (4)
Thanks for opening the issue! This is now supported in v2.9.0
from cyclopts.
I forgot to update how --help
resolves these for choces; this will be resolved in v2.9.1 in just a sec.
from cyclopts.
Thanks for the additional report! This is due to some inconsistencies in how python internally defines unions. I have a more comprehensive union-check, but I forgot to use it when getting help options! Fix incoming and I'll release 2.9.2.
from cyclopts.
--help
seems that there are still issues in v2.9.1
from typing import Literal, TypeAlias
from cyclopts import App
app = App()
FontSingleFormat: TypeAlias = Literal['otf', 'woff2', 'ttf', 'bdf', 'pcf']
FontCollectionFormat: TypeAlias = Literal['otc', 'ttc']
@app.default
def main(
font_formats: list[FontSingleFormat | FontCollectionFormat] | None = None
):
print(font_formats)
if __name__ == '__main__':
app()
(.venv) % python main.py -h
Usage: main COMMAND [ARGS] [OPTIONS]
╭─ Commands ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ --help,-h Display this message and exit. │
│ --version Display application version. │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
╭─ Parameters ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ FONT-FORMATS,--font-formats,--empty-font-formats [choices: otf,woff2,ttf,bdf,pcf,otc,ttc] │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
from typing import Literal
from cyclopts import App
app = App()
type FontSingleFormat = Literal['otf', 'woff2', 'ttf', 'bdf', 'pcf']
type FontCollectionFormat = Literal['otc', 'ttc']
@app.default
def main(
font_formats: list[FontSingleFormat | FontCollectionFormat] | None = None
):
print(font_formats)
if __name__ == '__main__':
app()
(.venv) % python main.py -h
Usage: main COMMAND [ARGS] [OPTIONS]
╭─ Commands ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ --help,-h Display this message and exit. │
│ --version Display application version. │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
╭─ Parameters ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ FONT-FORMATS,--font-formats,--empty-font-formats │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
from cyclopts.
Related Issues (20)
- Misc likely (rare) typing bugs HOT 1
- Use of the meta application results in a double help display HOT 5
- Automatic conversion from underscore to hyphen HOT 3
- Prompt for missing required parameters HOT 6
- Newlines should not be present in descriptions that span multiple lines HOT 5
- [Feature Request] Add auto_env_var_prefix HOT 19
- Importing cyclopts fails if there is a file called "tokenize.py" in the project which imports cyclopts HOT 1
- [feature request]: automatic markdown documentation generation HOT 5
- Support rich markup in version strings HOT 2
- Single-character option name HOT 2
- Loosen python version requirement from `>=3.8,<4.0` to `>=3.8` HOT 3
- Unrecognised tokens are only passed through if a parameter is matched HOT 2
- how to set the help message of app that register sub-app HOT 1
- Type of "app.default" is partially unknown with strict typechecking in VSCode HOT 1
- Shared configuration between commands HOT 3
- Example "Command Chaining" doesn't work HOT 1
- help issues? HOT 4
- the --help and --version parameters seems to not get parsed correctly because they are default commands HOT 2
- [Question] Displaying the Traceback HOT 3
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 cyclopts.