Package has hard dependency on djangorestframework_camel_case
Goldziher opened this issue · 12 comments
Hi @sondrelg ,
So the package currently has a hard dependency on djangorestframework_camel_case, as you can see in the below stacktrace. I do not use this package though, and I don't think this should be a requirement really. You can use "inflection" for this purpose, or use your own regex based solution instead.
Traceback (most recent call last):
File "manage.py", line 16, 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/core/management/base.py", line 343, in run_from_argv
connections.close_all()
File "/usr/local/lib/python3.8/site-packages/django/db/utils.py", line 232, in close_all
for alias in self:
File "/usr/local/lib/python3.8/site-packages/django/db/utils.py", line 226, in __iter__
return iter(self.databases)
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/db/utils.py", line 153, in databases
self._databases = settings.DATABASES
File "/usr/local/lib/python3.8/site-packages/django/conf/__init__.py", line 83, in __getattr__
self._setup(name)
File "/usr/local/lib/python3.8/site-packages/django/conf/__init__.py", line 70, in _setup
self._wrapped = Settings(settings_module)
File "/usr/local/lib/python3.8/site-packages/django/conf/__init__.py", line 177, in __init__
mod = importlib.import_module(self.SETTINGS_MODULE)
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/consumer_portal/settings.py", line 17, in <module>
from django_swagger_tester.loaders import DrfSpectacularSchemaLoader
File "/usr/local/lib/python3.8/site-packages/django_swagger_tester/loaders.py", line 12, in <module>
from django_swagger_tester.utils import Route
File "/usr/local/lib/python3.8/site-packages/django_swagger_tester/utils.py", line 12, in <module>
from djangorestframework_camel_case.util import camelize_re, underscore_to_camel
ModuleNotFoundError: No module named 'djangorestframework_camel_case'
Must have snuck in during the latest patch. I'll push a fix for this today. Let me know if you spot anything else :)
will do :)!
Could you try to install the package from the github master branch directly to see if #84 fixed the issue?
Think you just need to run
python -m pip install git+https://github.com/snok/django-swagger-tester -U
Sure
So i cant test this with ease due to the dependency on poetry, which requires a lot of changes to my dockerfile. If you release a built version i can test.
Not sure I understand you, but you're using poetry, so it makes it hard?
If so I believe you can add this to your pyproject.toml
:
django-swagger-tester = { git = "https://github.com/snok/django-swagger-tester", branch = "master" }
I could push a test-version, but you would have to make a similar change to use test-pypi.
If this isn't possible I'll just push 2.1.1 today. Please let me know when you can :)
I meant: I cannot test due to this package's dependecy on poetry, which means I need to make some complex modifications to my current project. If you can publish 2.1.1 it would be optimal.
You shouldnt need poetry to install, you just need git
in your docker image. By running pip install git+https://github.com/snok/django-swagger-tester
it should work.
But I'll push a new version later tonight anyways :) Pretty sure it's resolved.
Thanks :),
So its installing correctly now but failing. I am debugging this.
the stacktrace I'm getting:
Traceback (most recent call last):
File "/opt/project/openid_auth/tests/test_views.py", line 127, in test_successful_retrieve_application_native
validate_response(
File "/opt/project/django_swagger_tester/testing.py", line 28, in validate_response
SchemaTester(
File "/opt/project/django_swagger_tester/schema_tester.py", line 46, in __init__
self.test_dict(schema=schema, data=data, reference='init')
File "/opt/project/django_swagger_tester/schema_tester.py", line 122, in test_dict
self.case_tester(schema_key, 'schema')
TypeError: <lambda>() takes 0 positional arguments but 2 were given
the issue it appears is because of this function:
@property
def case_tester(self) -> Callable:
return self.settings.get('CASE_TESTER', lambda: None)
Yup, changing the above mentioned function like so resolved the issue:
@property
def case_tester(self) -> Callable:
return self.settings.get('CASE_TESTER', lambda *args: None)