[
https://issues.apache.org/jira/browse/AVRO-3162?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17406503#comment-17406503
]
ASF subversion and git services commented on AVRO-3162:
-------------------------------------------------------
Commit e8c61ba4f0051a76d4bf2e2d4391ec92a6e90f4f in avro's branch
refs/heads/master from Michael A. Smith
[ https://gitbox.apache.org/repos/asf?p=avro.git;h=e8c61ba ]
AVRO-3162: Use Argparse to Manage Arguments (#1270)
Improve the python cli, consisting mainly of scripts/avro and avro.tool, by
implementing argparse, and a `__main__.py` module.
- argparse handles arity and type exceptions more fluently at invocation time
than can easily be done with sys.argv.
- argparse handles sub-commands natively, especially in python 3.7 and up.
- `__main__.py` dispatch (along with setuptools `entry_points.console_scripts`
at install time) allows the cli to be invoked with both `python -m avro` and
just `avro` without having an out-of-band `scripts/avro` directory.
- Just in case someone is still using scripts/avro, I've kept that around with
a deprecation warning.
- I added type hints as best I can; however, the avro script has an `eval` call
that we might want to get rid of, some day.
> Update Python CLI Argument Handling
> -----------------------------------
>
> Key: AVRO-3162
> URL: https://issues.apache.org/jira/browse/AVRO-3162
> Project: Apache Avro
> Issue Type: Improvement
> Components: python
> Affects Versions: 1.10.2
> Reporter: Michael A. Smith
> Assignee: Michael A. Smith
> Priority: Major
> Labels: pull-request-available
> Time Spent: 10m
> Remaining Estimate: 0h
>
> Avro python has several modules that use commandline arguments via sys.argv
> or the outdated optparse library. I propose to replace all of that using the
> up-to-date argparse library.
> Also, I would like to move scripts/avro into {{avro/__main__.py}}, so that
> {{{{python -m avro}}}} invokes it directly, and so that all the avro python
> code is in the same directory tree.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)