Skip to content

Commit

Permalink
fix: Bump yte from >=1.0,<2.0 to >=1.5.1,<2.0 (#2275)
Browse files Browse the repository at this point in the history
### Description

Bumps package `yte`, to enable kwarg `require_use_yte` below:


https://github.com/snakemake/snakemake/blob/95b8dfefdb19945aaa038da387d6eadd653bffcd/snakemake/io.py#L1696-L1701

The try/except does not capture this because an unrecognized kwarg is
not `YAMLError`, but `TypeError`.

I encountered this error in the `test_schema` test suite. I do not know
if it is an error encountered during normal execution of Snakemake.

### QC
<!-- Make sure that you can tick the boxes below. -->

* [x] The PR contains a test case for the changes or the changes are
already covered by an existing test case.
- Changes are covered by the failing tests which they fix (see failures
below)
* [x] The documentation (`docs/`) is updated to reflect the changes or
this is not necessary (e.g. if the change does neither modify the
language nor the behavior or functionalities of Snakemake).

```
=================================== FAILURES ===================================
_________________________________ test_config __________________________________

config_schema = local('/tmp/guix-build-snakemake-7.26.0.drv-0/pytest-of-nixbld/pytest-0/test_config0/schema/config.schema.yaml')

    def test_config(config_schema):
        config = {}
>       validate(config, str(config_schema), False)

tests/test_schema.py:119: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
snakemake/utils.py:71: in validate
    schema = _load_configfile(source, filetype="Schema")
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

configpath_or_obj = '/tmp/guix-build-snakemake-7.26.0.drv-0/pytest-of-nixbld/pytest-0/test_config0/schema/config.schema.yaml'
filetype = 'Schema'

    def _load_configfile(configpath_or_obj, filetype="Config"):
        "Tries to load a configfile first as JSON, then as YAML, into a dict."
        import yaml
    
        if isinstance(configpath_or_obj, str) or isinstance(configpath_or_obj, Path):
            obj = open(configpath_or_obj, encoding="utf-8")
        else:
            obj = configpath_or_obj
    
        try:
            with obj as f:
                try:
                    return json.load(f, object_pairs_hook=collections.OrderedDict)
                except ValueError:
                    f.seek(0)  # try again
                try:
                    import yte
    
>                   return yte.process_yaml(f, require_use_yte=True)
E                   TypeError: process_yaml() got an unexpected keyword argument 'require_use_yte'

snakemake/io.py:1699: TypeError
_______________________________ test_config_ref ________________________________

config_schema_ref = local('/tmp/guix-build-snakemake-7.26.0.drv-0/pytest-of-nixbld/pytest-0/test_config_ref0/schema/config.ref.schema.yaml')

    def test_config_ref(config_schema_ref):
        config = {}
>       validate(config, str(config_schema_ref))

tests/test_schema.py:127: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
snakemake/utils.py:71: in validate
    schema = _load_configfile(source, filetype="Schema")
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

configpath_or_obj = '/tmp/guix-build-snakemake-7.26.0.drv-0/pytest-of-nixbld/pytest-0/test_config_ref0/schema/config.ref.schema.yaml'
filetype = 'Schema'

    def _load_configfile(configpath_or_obj, filetype="Config"):
        "Tries to load a configfile first as JSON, then as YAML, into a dict."
        import yaml
    
        if isinstance(configpath_or_obj, str) or isinstance(configpath_or_obj, Path):
            obj = open(configpath_or_obj, encoding="utf-8")
        else:
            obj = configpath_or_obj
    
        try:
            with obj as f:
                try:
                    return json.load(f, object_pairs_hook=collections.OrderedDict)
                except ValueError:
                    f.seek(0)  # try again
                try:
                    import yte
    
>                   return yte.process_yaml(f, require_use_yte=True)
E                   TypeError: process_yaml() got an unexpected keyword argument 'require_use_yte'

snakemake/io.py:1699: TypeError
________________________________ test_dataframe ________________________________

df_schema = local('/tmp/guix-build-snakemake-7.26.0.drv-0/pytest-of-nixbld/pytest-0/test_dataframe0/schema/df.schema.yaml')

    def test_dataframe(df_schema):
        df = pd.DataFrame([{"sample": "foo", "condition": "bar"}])
>       validate(df, str(df_schema), False)

tests/test_schema.py:142: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
snakemake/utils.py:71: in validate
    schema = _load_configfile(source, filetype="Schema")
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

configpath_or_obj = '/tmp/guix-build-snakemake-7.26.0.drv-0/pytest-of-nixbld/pytest-0/test_dataframe0/schema/df.schema.yaml'
filetype = 'Schema'

    def _load_configfile(configpath_or_obj, filetype="Config"):
        "Tries to load a configfile first as JSON, then as YAML, into a dict."
        import yaml
    
        if isinstance(configpath_or_obj, str) or isinstance(configpath_or_obj, Path):
            obj = open(configpath_or_obj, encoding="utf-8")
        else:
            obj = configpath_or_obj
    
        try:
            with obj as f:
                try:
                    return json.load(f, object_pairs_hook=collections.OrderedDict)
                except ValueError:
                    f.seek(0)  # try again
                try:
                    import yte
    
>                   return yte.process_yaml(f, require_use_yte=True)
E                   TypeError: process_yaml() got an unexpected keyword argument 'require_use_yte'

snakemake/io.py:1699: TypeError
```

Co-authored-by: Johannes Köster <johannes.koester@tu-dortmund.de>
  • Loading branch information
ning-y and johanneskoester committed Jun 11, 2023
1 parent aad61a0 commit 8c0b34f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion setup.cfg
Expand Up @@ -56,7 +56,7 @@ install_requires =
throttler
toposort >=1.10
wrapt
yte >=1.0,<2.0
yte >=1.5.1,<2.0

[options.extras_require]
google-cloud =
Expand Down

0 comments on commit 8c0b34f

Please sign in to comment.