python-jsonschema / jsonschema

An implementation of the JSON Schema specification for Python
https://python-jsonschema.readthedocs.io
MIT License
4.51k stars 571 forks source link

TypeError: attrib() got an unexpected keyword argument 'converter' #449

Closed dhimmel closed 5 years ago

dhimmel commented 5 years ago

In a Travis CI linux build on Python 3.6, I am getting an odd error:

E   TypeError: attrib() got an unexpected keyword argument 'converter'

The errors occurs in the following line of jsonschema:

https://github.com/Julian/jsonschema/blob/bb92111a85c981d14788257ebc0885f272b17e40/jsonschema/_types.py#L64

Windows builds passed. These builds are for https://github.com/greenelab/manubot/pull/49/commits/34de1a6f34c2b3cc8bc7ee112347a0f6af6a1e99 of https://github.com/greenelab/manubot/pull/49.

Interestingly, the tests pass locally for me on Linux. From the test log, it seems that the error is being triggered upon import. Possibly related to pytest.

dhimmel commented 5 years ago

Possibly related to https://github.com/pytest-dev/pytest/issues/3280 or https://github.com/pytest-dev/pytest/pull/3228.

The environments:

# Travis pytest version info (failing)
platform linux -- Python 3.6.3, pytest-3.3.0, py-1.5.2, pluggy-0.6.0
# Local pytest version info (passing)
platform linux -- Python 3.6.4, pytest-3.3.0, py-1.5.2, pluggy-0.6.0

Very similar. Perhaps has to do with how pytest is installed? Locally, I'm using conda.

dhimmel commented 5 years ago

Looking further, likely related to this library: https://github.com/python-attrs/attrs

@hynek or @Tinche any idea?

hynek commented 5 years ago

Your attrs version is too old. It used to be convert which is now deprecated and called converter instead

Julian commented 5 years ago

@dhimmel jsonschema should already be declaring that it needs attrs>17.4 -- just in case that was added after v3.0.0a1, I just pushed a v3.0.0a2, but there's also a small chance you are depending on some library that is pinning attrs to below 17.4.0.

Try re-running your build now and see if it still fails?

Will close this since jsonschema's own test suite is passing here so I'm pretty sure the bug would be elsewhere, but leave a comment if you have any issues.

dhimmel commented 5 years ago

jsonschema should already be declaring that it needs attrs>17.4.

Ah I see

https://github.com/Julian/jsonschema/blob/8f9460fea08cb2a24554852f9bc0041213e3d804/setup.cfg#L27

Okay I am using jsonschema 2.6.0 locally (latest version on PyPI). It looks like failed Travis build used jsonschema 3.0.0a1 and attrs 18.1.0.

Let me wipe the Travis pip cache and rerun.

dhimmel commented 5 years ago

Let me wipe the Travis pip cache and rerun.

That did not fix. However, I switched to installing the manubot package on Travis using pip install . rather than python setup.py install in https://github.com/greenelab/manubot/pull/49/commits/ec10ec63ff0c7ee038d6efdf9cc7ed859854a2e0. The new Travis build passed!

I believe python setup.py install was using easy_install rather than pip, but not sure why this would cause the outdated version of attrs when it claimed to be installing 18.1.0. Anyways, I'm happy since the build is passing, so not likely to dig further unless this issue reappears.

Julian commented 5 years ago

Yeah setup.py install hasn't been a great way to install things for awhile -- definitely go for pip. Glad you got it working.

On Wed, Aug 8, 2018, 16:53 Daniel Himmelstein notifications@github.com wrote:

Let me wipe the Travis pip cache and rerun.

That did not fix. However, I switched to installing the manubot package on Travis using pip install . rather than python setup.py install in greenelab/manubot@ec10ec6 https://github.com/greenelab/manubot/commit/ec10ec63ff0c7ee038d6efdf9cc7ed859854a2e0. The new Travis build https://travis-ci.org/greenelab/manubot/builds/413590031#L482 passed!

I believe python setup.py install was using easy_install rather than pip, but not sure why this would cause the outdated version of attrs when it claimed to be installing 18.1.0. Anyways, I'm happy since the build is passing, so not likely to dig further unless this issue reappears.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/Julian/jsonschema/issues/449#issuecomment-411413391, or mute the thread https://github.com/notifications/unsubscribe-auth/AAUIXkYaMNkoutNQIg4v7ptbl5bPvZ84ks5uOu1QgaJpZM4Vy-J9 .