New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use setuptools entry_points for scripts #230

Merged
merged 2 commits into from Jan 17, 2015

Conversation

Projects
None yet
1 participant
@cdeil
Member

cdeil commented Jan 17, 2015

This PR moves all Gammapy scripts from scripts to gammapy/scripts, splits them in main functions that parse the args and then call a function that does the work. main is then exposed as a command line tool via setuptools entry_points defined in setup.py.
It also programatically gets a list of tools and runs --help on each to make sure they are not badly broken ... I'm not sure this works if the package is not installed though ...

The recommended way to distribute Python command line tools now is via setuptools entry_points (see e.g. http://click.pocoo.org/3/setuptools/#introduction). This method was also recently adopted in Astropy (see astropy/astropy#3271)

A major advantage is that this will make it much easier to implement tests and docs for the command line tools (see #24) or to re-use the functionality in analysis pipelines.

This is probably not the final way to structure command line tools in Gammapy (e.g. I'm thinking about using clicks and making all commands sub-commands of a single gammapy command line tool, i.e. to work like many other tools like e.g. git). But it's a step in the right direction ...

@cdeil cdeil force-pushed the cdeil:setuptools-entrypoints branch 2 times, most recently from 77b1619 to e32750a Jan 17, 2015

@cdeil cdeil referenced this pull request Jan 17, 2015

Closed

Document scripts in docs #24

@cdeil cdeil force-pushed the cdeil:setuptools-entrypoints branch from e32750a to 67a3a0c Jan 17, 2015

Rewrite scripts as main functions in gammapy.scripts.
This allows us to use setuptools entry_points and has various advantages.

@cdeil cdeil force-pushed the cdeil:setuptools-entrypoints branch 2 times, most recently from eacb546 to 7a7ed4d Jan 17, 2015

@cdeil cdeil force-pushed the cdeil:setuptools-entrypoints branch from 7a7ed4d to 014d0fd Jan 17, 2015

cdeil added a commit that referenced this pull request Jan 17, 2015

Merge pull request #230 from cdeil/setuptools-entrypoints
Move scripts to gammapy/scripts and use setuptools entry_points

@cdeil cdeil merged commit b854958 into gammapy:master Jan 17, 2015

1 check was pending

continuous-integration/travis-ci The Travis CI build is in progress
Details

@cdeil cdeil referenced this pull request Jan 17, 2015

Closed

Further TS map improvements #223

6 of 10 tasks complete

@cdeil cdeil changed the title from Move scripts to gammapy/scripts and use setuptools entry_points to Use setuptools entry_points for command line scripts Apr 8, 2015

@cdeil cdeil added this to the 0.2 milestone Apr 8, 2015

@cdeil cdeil self-assigned this Apr 8, 2015

@cdeil cdeil changed the title from Use setuptools entry_points for command line scripts to Use setuptools entry_points for scripts Apr 8, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment