GaretJax / django-click

Write Django management command using the click CLI library
MIT License
251 stars 20 forks source link

Django-click doesn't work with click >= 7.1 #14

Closed ykshatroff closed 4 years ago

ykshatroff commented 4 years ago

When installing a version of click later than 7.0, the djclick import fails with an error:

    import djclick
/usr/local/lib/python3.6/site-packages/djclick/__init__.py:16: in <module>
    __all__ = click.__all__ + ['pass_verbosity']
E   AttributeError: module 'click' has no attribute '__all__'

The click module does not define __all__ as of 7.1 and later.

rafaph commented 4 years ago

It seems like removing this line

__all__ = click.__all__ + ['pass_verbosity']

Solve the problem

pkfec commented 4 years ago

With the following latest packages, I am gettingAttributeError: module 'click' has no attribute '__all__' How I can resolve this issue?

django v2.2.11 python v3.7.5 click v7.1.1 django-click v2.1.0

ykshatroff commented 4 years ago

@pkfec Unfortunately, it is not easy.

I suggest that for the time being, while this issue is not fixed by a new release, you fork this repository and install the package directly from your git. (Please refer to the respective docs for pip or pipenv or whatever package manager you're using, as to how exactly to do it.)

All you need to change is to delete this line: https://github.com/GaretJax/django-click/blob/master/djclick/__init__.py#L16

But a new release is blocked by failing tests and a bunch of pretty old unsupported dependencies.

D3f0 commented 4 years ago

@ykshatroff won't removing all kill autocompletion in completion-capable editors? I know after some time you learn click options/arguments by heart, but even so, some inner things like pass_context require some "Go to definition" :blush:

ykshatroff commented 4 years ago

@D3f0 Well first, what is more important: autocompletion in editors or a working library? :) Second, if the dependency doesn't provide us with their __all__ where are we supposed to take it from? I don't feel like we should build our own __all__ for click. And finally, in any case, it must have been removed for a reason - which, I suppose, is that __all__ is no longer a thing for autocompletion in modern editors - it's quite error-prone, not DRY, and I suppose in 2020 any editor that truly supports python is able to take a list of symbols from the module itself.