Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incompatibility with latest DRF 3.12.0 #641

Closed
fasih opened this issue Sep 28, 2020 · 23 comments
Closed

Incompatibility with latest DRF 3.12.0 #641

fasih opened this issue Sep 28, 2020 · 23 comments

Comments

@fasih
Copy link

fasih commented Sep 28, 2020

Encode has just released the new version of DRF django-rest-framework 3.12.0 which has dropped all compat support to Django < 2 urls

Affected import in dry-yasg

from rest_framework.compat import URLPattern, URLResolver, get_original_route

DRF merged PR
DRF Commit

@rozacek
Copy link

rozacek commented Sep 28, 2020

Hi,
Here in compat.py file there are removed lines highlighted: encode/django-rest-framework@3.11.1...3.12.0

I also noticed this problem about 1 hour ago as 3.12.0 DRF was released. Currently I had to use fixed requirement of DRF 3.11.1

Let me add some logs to make better search engine inexing ;)

Traceback (most recent call last):
  File "/usr/local/lib/python3.8/threading.py", line 932, in _bootstrap_inner
    self.run()
  File "/usr/local/lib/python3.8/threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/local/lib/python3.8/site-packages/django/utils/autoreload.py", line 53, in wrapper
    fn(*args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/django/core/management/commands/runserver.py", line 118, in inner_run
    self.check(display_num_errors=True)
  File "/usr/local/lib/python3.8/site-packages/django/core/management/base.py", line 392, in check
    all_issues = checks.run_checks(
  File "/usr/local/lib/python3.8/site-packages/django/core/checks/registry.py", line 70, in run_checks
    new_errors = check(app_configs=app_configs, databases=databases)
  File "/usr/local/lib/python3.8/site-packages/django/core/checks/urls.py", line 13, in check_url_config
    return check_resolver(resolver)
  File "/usr/local/lib/python3.8/site-packages/django/core/checks/urls.py", line 23, in check_resolver
    return check_method()
  File "/usr/local/lib/python3.8/site-packages/django/urls/resolvers.py", line 408, in check
    for pattern in self.url_patterns:
  File "/usr/local/lib/python3.8/site-packages/django/utils/functional.py", line 48, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "/usr/local/lib/python3.8/site-packages/django/urls/resolvers.py", line 589, in url_patterns
    patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
  File "/usr/local/lib/python3.8/site-packages/django/utils/functional.py", line 48, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "/usr/local/lib/python3.8/site-packages/django/urls/resolvers.py", line 582, in urlconf_module
    return import_module(self.urlconf_name)
  File "/usr/local/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 783, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/usr/src/app/main/urls.py", line 36, in <module>
    SchemaView = get_schema_view(
  File "/usr/local/lib/python3.8/site-packages/drf_yasg/views.py", line 67, in get_schema_view
    _generator_class = generator_class or swagger_settings.DEFAULT_GENERATOR_CLASS
  File "/usr/local/lib/python3.8/site-packages/drf_yasg/app_settings.py", line 122, in __getattr__
    val = perform_import(val, attr)
  File "/usr/local/lib/python3.8/site-packages/rest_framework/settings.py", line 166, in perform_import
    return import_from_string(val, setting_name)
  File "/usr/local/lib/python3.8/site-packages/rest_framework/settings.py", line 180, in import_from_string
    raise ImportError(msg)
ImportError: Could not import 'drf_yasg.generators.OpenAPISchemaGenerator' for API setting 'DEFAULT_GENERATOR_CLASS'. ImportError: cannot import name 'URLPattern' from 'rest_framework.compat' (/usr/local/lib/python3.8/site-packages/rest_framework/compat.py).

@JoelLefkowitz
Copy link
Collaborator

Patched with #642

@fasih
Copy link
Author

fasih commented Sep 28, 2020

I think we should also drop support of Django < 2.1
Raised PR #644

@al-muammar
Copy link

@axnsan12, could we get your attention here?
Also, the build is failing because of unrelated issues, should we raise an issue to resolve it?

@JackAtOmenApps
Copy link

Having same issue here after updating to 3.12.1, (running with django 3.1.2 on Ubuntu).

Traceback (most recent call last):
  File "manage.py", line 31, in <module>
    execute_from_command_line(sys.argv)
  File "/usr/local/lib/python3.8/site-packages/django/core/management/__init__.py", line 401, in execute_from_command_line
    utility.execute()
  File "/usr/local/lib/python3.8/site-packages/django/core/management/__init__.py", line 395, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/local/lib/python3.8/site-packages/django_extensions/management/commands/shell_plus.py", line 120, in run_from_argv
    return super().run_from_argv(argv)
  File "/usr/local/lib/python3.8/site-packages/django/core/management/base.py", line 330, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/usr/local/lib/python3.8/site-packages/django/core/management/base.py", line 368, in execute
    self.check()
  File "/usr/local/lib/python3.8/site-packages/django/core/management/base.py", line 392, in check
    all_issues = checks.run_checks(
  File "/usr/local/lib/python3.8/site-packages/django/core/checks/registry.py", line 70, in run_checks
    new_errors = check(app_configs=app_configs, databases=databases)
  File "/usr/local/lib/python3.8/site-packages/django/core/checks/urls.py", line 13, in check_url_config
    return check_resolver(resolver)
  File "/usr/local/lib/python3.8/site-packages/django/core/checks/urls.py", line 23, in check_resolver
    return check_method()
  File "/usr/local/lib/python3.8/site-packages/django/urls/resolvers.py", line 408, in check
    for pattern in self.url_patterns:
  File "/usr/local/lib/python3.8/site-packages/django/utils/functional.py", line 48, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "/usr/local/lib/python3.8/site-packages/django/urls/resolvers.py", line 589, in url_patterns
    patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
  File "/usr/local/lib/python3.8/site-packages/django/utils/functional.py", line 48, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "/usr/local/lib/python3.8/site-packages/django/urls/resolvers.py", line 582, in urlconf_module
    return import_module(self.urlconf_name)
  File "/usr/local/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 783, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/app/config/urls.py", line 21, in <module>
    schema_view = get_schema_view(
  File "/usr/local/lib/python3.8/site-packages/drf_yasg/views.py", line 67, in get_schema_view
    _generator_class = generator_class or swagger_settings.DEFAULT_GENERATOR_CLASS
  File "/usr/local/lib/python3.8/site-packages/drf_yasg/app_settings.py", line 122, in __getattr__
    val = perform_import(val, attr)
  File "/usr/local/lib/python3.8/site-packages/rest_framework/settings.py", line 166, in perform_import
    return import_from_string(val, setting_name)
  File "/usr/local/lib/python3.8/site-packages/rest_framework/settings.py", line 180, in import_from_string
    raise ImportError(msg)
ImportError: Could not import 'drf_yasg.generators.OpenAPISchemaGenerator' for API setting 'DEFAULT_GENERATOR_CLASS'. ImportError: cannot import name 'URLPattern' from 'rest_framework.compat' (/usr/local/lib/python3.8/site-packages/rest_framework/compat.py).

@pablobuenaposada
Copy link

same here @OmenApps

@gonzalejandro
Copy link

same problem than @OmenApps

@niviacampos
Copy link

same problem than @OmenApps

do update on drf, for me decided

@johnthagen
Copy link
Collaborator

johnthagen commented Oct 6, 2020

I'm worried this project is no longer maintained given that there has been no activity since February (#590).

The maintainer, @axnsan12, is still slightly active on GitHub (see https://github.com/rabbitmq/rabbitmq-management/issues/836#issue-678646238 dated Aug 13), but there hasn't been any activity on this repo.

Does the project need to be forked?

@JoelLefkowitz
Copy link
Collaborator

I'm worried this project is no longer maintained given that there has been no activity since February (#590).

The maintainer, @axnsan12, is still slightly active on GitHub (see rabbitmq/rabbitmq-management#836 (comment) dated Aug 13), but there hasn't been any activity on this repo.

Does the project need to be forked?

We can continue on my fork, drf-yasg2. Would someone like to volunteer to fix the test suite and build failures?

@johnthagen
Copy link
Collaborator

johnthagen commented Oct 6, 2020

Thanks!

Here are some PR's I triaged that would be good to migrate over:

Typos:

Perhaps we should comment on the PRs when they've been merged into the fork so that if people need the fix, they know to check out drf-yasq2.

@johnthagen

This comment has been minimized.

@JoelLefkowitz
Copy link
Collaborator

@johnthagen Issues now enabled

@AlekseiKhatkevich
Copy link

Hi.
Is it any chance you are gonna release a patched version on this issue?
Thanks and thanks for the package, its awesome!

@GitRon
Copy link

GitRon commented Oct 7, 2020

Same problem here. Sad to see this package dying...

@JoelLefkowitz
Copy link
Collaborator

Same problem here. Sad to see this package dying...

Since the maintainers of this repo are not replying, we've moved to my fork drf-yasg2

@creyD
Copy link

creyD commented Oct 8, 2020

I wrote an email to the owner of this repository stating the problems, I hope he has a solution.

@JoelLefkowitz
Copy link
Collaborator

JoelLefkowitz commented Oct 12, 2020

Please note a compatible and stable version of this package is now available on pypi; drf-yasg2

zachmullen added a commit to kitware-resonant/cookiecutter-resonant that referenced this issue Oct 12, 2020
zachmullen added a commit to kitware-resonant/cookiecutter-resonant that referenced this issue Oct 12, 2020
@captbilard
Copy link

Uninstalling drf-yasg & then installing drf_yasg2 fixed this for me

@PaulWay
Copy link
Contributor

PaulWay commented Oct 12, 2020

Probably means I should move some of my patches over to drf_yasg2.

marksmall pushed a commit to astrosat/django-astrosat-core that referenced this issue Oct 22, 2020
The libary we use currently for this `drf-yasg` appears to be no
longer maintained and we are experiencing an error, having upgraded
to a newer version of `djangorestframework`, see:

axnsan12/drf-yasg#641

I also had to update to the latest version of `pytest` as I consistently
got an error installing dependencies.

IssueID #35
mingfeng added a commit to City-of-Helsinki/city-infrastructure-platform that referenced this issue Oct 23, 2020
The previously referenced django-heluser branch was
merged to the master branch and we pin the latest
commit in master branch as time of writing.

We need to pin specific versions of djangoresetframework and ipython because:
- drf-yasg is not compatible with DRF 3.12+, see details: axnsan12/drf-yasg#641
- ipython 7.17+ requires python 3.7+ (we need to support Python 3.6)

Refs: LIIK-197
mingfeng added a commit to City-of-Helsinki/city-infrastructure-platform that referenced this issue Oct 23, 2020
The previously referenced django-heluser branch was
merged to the master branch and we pin the latest
commit in master branch as time of writing.

We need to pin specific versions of djangoresetframework and ipython because:
- drf-yasg is not compatible with DRF 3.12+, see details: axnsan12/drf-yasg#641
- ipython 7.17+ requires python 3.7+ (we need to support Python 3.6)

Refs: LIIK-197
mingfeng added a commit to City-of-Helsinki/city-infrastructure-platform that referenced this issue Oct 23, 2020
The previously referenced django-heluser branch was
merged to the master branch and we pin the latest
commit in master branch as time of writing.

We need to pin specific versions of djangoresetframework and ipython because:
- drf-yasg is not compatible with DRF 3.12+, see details: axnsan12/drf-yasg#641
- ipython 7.17+ requires python 3.7+ (we need to support Python 3.6)

Refs: LIIK-197
mingfeng added a commit to City-of-Helsinki/city-infrastructure-platform that referenced this issue Oct 23, 2020
The previously referenced django-heluser branch was
merged to the master branch and we pin the latest
commit in master branch as time of writing.

We need to pin specific versions of djangoresetframework and ipython because:
- drf-yasg is not compatible with DRF 3.12+, see details: axnsan12/drf-yasg#641
- ipython 7.17+ requires python 3.7+ (we need to support Python 3.6)

Refs: LIIK-197
@fasih
Copy link
Author

fasih commented Oct 25, 2020

Since the maintainers of this repo are not replying, we've moved to my fork drf-yasg2

@JoelLefkowitz I was thinking to update the description of the issue, to move to drf-yasg2
and close the same. What you say?

Even I have been already moved to drf-yasg2. Thanks to you

@johnthagen
Copy link
Collaborator

I was thinking to update the description of the issue, to move to drf-yasg2 and close the same.

@fasih I went ahead and created a new issue with a clear title about the fork. I think it's good to keep this issue open to document the clear DRF 3.12 problem for current users of drf-yasg to reference.

@axnsan12
Copy link
Owner

1.20.0 is now out with the fix. I think we can consider this closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.