Code Monkey home page Code Monkey logo

gxargparse's People

Contributors

bgruening avatar brainstorm avatar hexylena avatar mr-c avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

anton-khodak

gxargparse's Issues

Error when trying to convert click command to cwl

I'd like to convert click commands to cwl command line tools. After installing gxargparse I get an error if I run the command with or without --generate_cwl_tool:

> python -m nlppln.replace_ner --generate_cwl_tool
Traceback (most recent call last):
  File "/usr/lib/python3.5/runpy.py", line 184, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.5/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/home/jvdzwaan/code/nlppln/nlppln/replace_ner.py", line 2, in <module>
    import click
  File "/home/jvdzwaan/code/gxargparse/click/__init__.py", line 20, in <module>
    setattr(__selfmodule__, x, getattr(click, x))
AttributeError: module 'random_name_1' has no attribute 'cwlt'

> python -m nlppln.replace_ner
Traceback (most recent call last):
  File "/usr/lib/python3.5/runpy.py", line 184, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.5/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/home/jvdzwaan/code/nlppln/nlppln/replace_ner.py", line 2, in <module>
    import click
  File "/home/jvdzwaan/code/gxargparse/click/__init__.py", line 20, in <module>
    setattr(__selfmodule__, x, getattr(click, x))
AttributeError: module 'random_name_1' has no attribute 'cwlt'
(cwl3) jvdzwaan@ESLT0062:~/code/gxargparse$ 

The error also occurs in Python 2.7:

> python -m nlppln.replace_ner --generate_cwl_tool
Traceback (most recent call last):
  File "/usr/lib/python2.7/runpy.py", line 174, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/home/jvdzwaan/code/nlppln/nlppln/replace_ner.py", line 2, in <module>
    import click
  File "click/__init__.py", line 20, in <module>
    setattr(__selfmodule__, x, getattr(click, x))
AttributeError: 'module' object has no attribute 'cwlt'

> python -m nlppln.replace_ner
Traceback (most recent call last):
  File "/usr/lib/python2.7/runpy.py", line 174, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/home/jvdzwaan/code/nlppln/nlppln/replace_ner.py", line 2, in <module>
    import click
  File "click/__init__.py", line 20, in <module>
    setattr(__selfmodule__, x, getattr(click, x))
AttributeError: 'module' object has no attribute 'cwlt'

In both instances gxargparse_check_path gives Ready to go!

Running example.py creates file named `example.cwl` unexpectedly

Took me a few minutes to understand why my changes weren't sticking as I had created an example.cwl for testing.

When example.py is run, it outputs the CWL tool to both stdout + example.cwl (one also has an extra newline). This seems like odd behaviour to me (a linux admin). If it outputs to stdout, I don't expect it to also be writing to a file.

$ strace -e open python example.py --generate_cwl_tool 2>&1 | grep example.cwl
open("example.cwl", O_WRONLY|O_CREAT|O_TRUNC, 0666) = 3

Additionally one of them has an extra newline at the end (stdout vs updated file).

Repository name

As @mr-c mentioned in a private conversation, Galaxy will be gaining CWL support, and the development of the original gxargparse basically stopped, so Galaxy specific parts can be ripped off. I need them now as a sample, but as soon as CWL tool wrapper will be finished, I'll remove them as much as the docs. Should the repository bear the old name along with that?

/cc @brainstorm

parse_known_args() cwl generation?

Hi,

I looked through the issues before posting, apologies if this has been asked or explained elsewhere or I missed it...

I noticed that if my argparse objects call parse_known_args instead of parse_args, the --generate_cwl_tool doesn't fire. Is that by design? I can see the logic if so, just wondering.

Error when running --generate_cwl_tool on example.py

I get an error when I run python example.py --generate_cwl_tool:

Traceback (most recent call last):
  File "example.py", line 29, in <module>
    args = parser.parse_args()
  File "/home/jvdzwaan/code/gxargparse/argparse/__init__.py", line 78, in parse_args
    self.parse_args_cwl(*args, **kwargs)
  File "/home/jvdzwaan/code/gxargparse/argparse/__init__.py", line 115, in parse_args_cwl
    cwlt_parameter = methodToCall(result)
  File "/home/jvdzwaan/code/gxargparse/argparse/argparse_cwl_translation.py", line 85, in _StoreAction
    cwlparam = self.__cwl_param_from_type(param)
  File "/home/jvdzwaan/code/gxargparse/argparse/argparse_cwl_translation.py", line 58, in __cwl_param_from_type
    'type': self.get_cwl_type(param.type) or 'str'}
  File "/home/jvdzwaan/code/gxargparse/argparse/argparse_cwl_translation.py", line 131, in get_cwl_type
    return PY_TO_CWL_TYPES[py_type]
KeyError: <class 'io.IOBase'>

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.