Skip to main content
Warning: You are using the test version of PyPI. This is a pre-production deployment of Warehouse. Changes made here affect the production instance of TestPyPI (
Help us improve Python packaging - Donate today!

Instrument for forming CWL tool descriptions from argparse arguments

Project Description
# `gxargparse`

Galaxy argparse aims to be a drop-in replacement for argparse, quite literally.
You can write use your normal import

import argparse

and continue writing code. All functions are passed straight through to
argparse, but `gxargparse` captures them and copies some information along the
way. This information captured is used to produce [Galaxy Tool XML]( when it's
requested with the `--generate_galaxy_xml` flag.

## How it works

Internally, `gxargparse`, masquerading as `argparse` attempts to find and
import the **real** argparse. It then stores a reference to the code module for
the system argparse, and presents the user with all of the functions that
stdlib's argparse provides. Every function call is passed through the system
argparse. However, gxargparse captures the details of those calls and when Tool
XML is requested, it builds up the tool definition according to IUC tool

## Examples

You can see the `` file for an example with numerous types of
arguments and options that you might see in real tools. Accordingly there is an `example.xml` file with the output.

## It doesn't work!!

If you are not able to use the `--generate_galaxy_xml` flag after
installing, it is probably because of module load order. gxargparse must
precede argparse in the path. Certain cases seem to work correctly (`python install` in a virtualenv) while other cases do not (`pip install

To easily correct this, run the tool `gxargparse_check_path` which is installed
as part of this package. Correctly functioning paths will produce the

$ gxargparse_check_path
Ready to go!

while incorrectly ordered paths will produce a helpful error message:

$ gxargparse_check_path
Incorrect ordering, please set



This can even be used inline:

user@host:$ PYTHONPATH=$(gxargparse_check_path -q) python --generate_galaxy_xml


This code doesn't cover the entirety of the `argparse` API yet, and there are some bugs to work out on the XML generation side:

- argparse
- groups not supported (in galaxy, everything should still work in argparse)
- some features like templating of the version string (please submit bugs)
- galaxyxml
- bugs in conditionals/whens (probably)
- bugs, bugs, bugs!
- gxargparse
- support help text
- support declaring output files in an `argparse`-esque manner

# License

- Apache License, v2
Release History

Release History

This version
History Node


History Node


History Node


Download Files

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
gxargparse-0.1.2-py2.py3-none-any.whl (19.6 kB) Copy SHA256 Checksum SHA256 3.5 Wheel Jun 24, 2016
gxargparse-0.1.2.tar.gz (15.6 kB) Copy SHA256 Checksum SHA256 Source Jun 24, 2016

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting