common-workflow-language / cwl-utils

Python utilities for CWL

Home Page:https://cwl-utils.readthedocs.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cannot execute the import statement of example in `README.md`.

suecharo opened this issue · comments

If to install with pip install cwl-utils, the parser will not be able to import.

$ uname -a
Linux dh236 4.15.0-156-generic #163-Ubuntu SMP Thu Aug 19 23:31:58 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
$ docker --version
Docker version 19.03.8, build afacb8b7f0
$ docker run -it --rm docker.io/python:3.8-slim-buster bash

# pip install cwl-utils
...
# pip show cwl-utils
Name: cwl-utils
Version: 0.11
Summary: UNKNOWN
Home-page: https://github.com/common-workflow-language/cwl-utils
Author: Common workflow language working group
Author-email: common-workflow-language@googlegroups.com
License: Apache 2.0
Location: /usr/local/lib/python3.8/site-packages
Requires: schema-salad, cwl-upgrader, cwltool, typing-extensions, cwlformat, requests
Required-by: 
# python3 -c 'from cwl_utils.parser import cwl_version, load_document, save'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'cwl_utils.parser'
# ls /usr/local/lib/python3.8/site-packages/cwl_utils
__init__.py		    cwl_normalizer.py		     graph_split.py   py.typed
__meta__.py		    cwl_v1_0_expression_refactor.py  image_puller.py  testdata
__pycache__		    cwl_v1_1_expression_refactor.py  parser_v1_0.py   tests
cite_extract.py		    cwl_v1_2_expression_refactor.py  parser_v1_1.py
cwl_expression_refactor.py  docker_extract.py		     parser_v1_2.py

When I clone d and installed with pip install ., this problem did not occur.

Currently, the latest version of cwl-utils in the GitHub repository is 0.10.
However, when it is installed by pip install cwl-utils, the version is 0.11.

Download the package from pypi - cwl-utils and check the setup.py, it looks like

    packages=["cwl_utils", "cwl_utils.tests", "cwl_utils.testdata"],
    package_dir={"cwl_utils.tests": "tests", "cwl_utils.testdata": "testdata"},

Here, this error will be resolved if modify it as

    packages=["cwl_utils", "cwl_utils.parser", "cwl_utils.tests", "cwl_utils.testdata"],
    package_dir={
        "cwl_utils.parser": "cwl_utils/parser",
        "cwl_utils.tests": "tests",
        "cwl_utils.testdata": "testdata",
    },

Hello @suecharo

Yes, the examples in https://github.com/common-workflow-language/cwl-utils#readme are for the current development version

For the recent release, see the code examples at https://pypi.org/project/cwl-utils/

I agree the difference is confusing, so I'll try to make a new release soon so that they match.