berkerpeksag / astor

Python AST read/write
https://pypi.org/project/astor/
BSD 3-Clause "New" or "Revised" License
810 stars 102 forks source link

Command line changes needed #76

Open pmaupin opened 7 years ago

pmaupin commented 7 years ago

Currently, the only command line supported is python -m astor.rtrip [readonly] [<source file or directory>]

Locally, I've enhanced my own copy of rtrip with a few more options, but the way I did that was, uhhhh, non-standard.

When I started this project, I had some Python interpreter where -m <module> ate any subsequent flags on the command line, e.g. -r didn't work. I don't know what that was, haven't found it again, can't recreate it, don't care.

I also have to confess that I don't know which command line argument parser is winning the hearts and minds of astor-lovers.

So, I have some functionality I'd like to add in a branch, but I haven't created a PR because I assume it's just really wrong code.

I don't know if we want to add a __main__.py and be able to support python -m rtrip ... as well as other options, or whether we just want to do a better job of doing the astor.rtrip command line.

If anybody could help, that'd be awesome.

pmaupin commented 7 years ago

Oh, and we still support Python 2.6, and I don't see any reason to change that just for a command line parser...

berkerpeksag commented 7 years ago

We could use setuptools' console_scripts entry point and introduce a astor ... or astor rtip ... command.

pmaupin commented 7 years ago

I just realized that we didn't have rtrip in 0.5, so we probably want to use a command line parser and nail down an interface before we release 0.6.

Shouldn't be too much work, but real life intervenes in my case.

pmaupin commented 7 years ago

I have a few hours to look at this. I like the console_scripts idea; will probably create a PR tonight.

pmaupin commented 7 years ago

PR #78 created.