Skip to content

Tastypie needs to upgrade our dependencies to support Python3 #3570

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

Closed
humitos opened this issue Feb 1, 2018 · 25 comments
Closed

Tastypie needs to upgrade our dependencies to support Python3 #3570

humitos opened this issue Feb 1, 2018 · 25 comments
Labels
Good First Issue Good for new contributors Improvement Minor improvement to code
Milestone

Comments

@humitos
Copy link
Member

humitos commented Feb 1, 2018

If you go to http://localhost:8000/api/v1/project/46162/sync_versions/ while running your instance with Python3 you will get this error:

'dict' object has no attribute 'has_key'

I found that we are using mimetype, https://github.com/rtfd/readthedocs.org/blob/df8079a18ed9c15e9c85f0646e3e9169e725b310/requirements/pip.txt#L49 and python-mimeparse should be used.

We should write a simple test for this, otherwise we will find this out in production :)

Ref: http://django-tastypie.readthedocs.io/en/latest/python3.html#changed-requirements

@humitos humitos added Improvement Minor improvement to code Good First Issue Good for new contributors labels Feb 1, 2018
@humitos humitos added this to the Python 3 milestone Feb 1, 2018
@stsewd
Copy link
Member

stsewd commented Feb 11, 2018

will api v1 still be supported in the long term?

@142ayushkumar
Copy link

142ayushkumar commented Feb 12, 2018

I will like to work on this issue @humitos

@142ayushkumar
Copy link

@humitos @stsewd
the webpage is not available on my local server @ http://localhost:8000/api/v1/project/46162/sync_versions/
a screenshot of error page:
image

@stsewd
Copy link
Member

stsewd commented Feb 12, 2018

@142ayushkumar that's because that url was just an example, you need to create a project on your local instance and take the id. http://localhost:8000/api/v1/project/{id}/sync_versions/. And I believe this endpoint only support POST requests, but I'm not sure.

Thanks for your interest on contributing :)

@142ayushkumar
Copy link

@stsewd, I am facing some problem in webhook integration on my local instance the same way i followed on my live account and it worked. But on the local server
image

And one more thing is that how to run my local instance with python3
I am getting some error python3 manage.py runserver
image

@stsewd
Copy link
Member

stsewd commented Feb 13, 2018

@142ayushkumar did you have any problem when building your project? You can check the builds section /projects/django-kon/builds. And about your other problem I thinks it's because you only setup your project for python2, please follow the installation steps with a python3 virtualenv.

@142ayushkumar
Copy link

image
Build is sucessful.

@stsewd
Copy link
Member

stsewd commented Feb 13, 2018

@142ayushkumar That isn't a successfully build, it's just triggered. I think you need to setup your build environment (see https://docs.readthedocs.io/en/latest/development/buildenvironments.html), by the way, that guide needs improvement, so probably you may want to read https://github.com/rtfd/readthedocs.org/pull/2692/files too.

@142ayushkumar
Copy link

142ayushkumar commented Feb 14, 2018

@stsewd, Can you help me with the configuration part. How to change these configurations?

@stsewd
Copy link
Member

stsewd commented Feb 14, 2018

You need to create a file readthedocs/settings/local_settings.py and put there your settings.

This is my local settings https://gist.github.com/stsewd/1fd3178435397c72c563dc83480dc663, you need to set DOCKER_IMAGE to yours.

@142ayushkumar
Copy link

142ayushkumar commented Feb 14, 2018

@stsewd where to save the Dockerfile(as mentioned here) in the readthedocs.org folder or in settings?

@142ayushkumar
Copy link

@stsewd @humitos
Also after saving the local settings as you suggested I am getting this error
image

@stsewd
Copy link
Member

stsewd commented Feb 15, 2018

@142ayushkumar in any place you like, the important step here is building the image docker build -f Dockerfile.user -t readthedocs/build:2.0-modified . on the same directory where the Docker file is. If you use my local_settings.py, you don't need these lines https://gist.github.com/stsewd/1fd3178435397c72c563dc83480dc663#file-local_settings-py-L18-L26.

@142ayushkumar
Copy link

142ayushkumar commented Feb 15, 2018

@stsewd I am still getting error
Error log when i tried to build image using dockerfile
image
because i have saved my file named as Dockerfile not Dockerfile.user but the latter also shows errors

@humitos
Copy link
Member Author

humitos commented Feb 15, 2018

will api v1 still be supported in the long term?

@stsewd the API v1 is deprecated but people still use it. So, we don't want to add features or support it if this involves too much work, but making this small change to keep the compatibility shouldn't be so complicated and I think it worth the effort.

Anyway, the first step is to write a test that fails with Python3 so at least we are covered and this error doesn't pass silently.

@stsewd
Copy link
Member

stsewd commented Feb 15, 2018

@142ayushkumar you should use docker build -t readthedocs/build:2.0-modified .

Also I believe we are populating this issue with irrelevant content, probably is better to make this questions on https://gitter.im/rtfd/readthedocs.org or irc (#readthedocs), I would be glad to help you there if you don't mind.

@srikant-ch5
Copy link
Contributor

srikant-ch5 commented Feb 18, 2018

@stsewd @humitos I would like to work on this issue..

@stsewd
Copy link
Member

stsewd commented Feb 18, 2018

@Sriks123 I think the steps given by @humitos are very clear, just follow them. If anything isn't clear, feel free to ask.

@stsewd
Copy link
Member

stsewd commented Apr 3, 2018

@humitos I was submitting a PR to fix this, but I realize that this endpoint doesn't work at all. the _sync_versions and _delete_versions were deleted on d11cc9f#diff-aeef6dfbd37b07c9cc73482e8c2fb36eL95

So always return an exception

https://github.com/rtfd/readthedocs.org/blob/393e31ad3a9aafee297df64f1a654ffcda7ef04a/readthedocs/api/base.py#L81-L108

I think that was used internally only, now RTD uses the apiv2 endpoint to sync versions.

@stsewd
Copy link
Member

stsewd commented Apr 3, 2018

Should this endpoint be deleted then?

@agjohnson agjohnson modified the milestones: Python 3, APIv2.1 Apr 12, 2018
@stsewd
Copy link
Member

stsewd commented Jun 28, 2018

This code was removed in #4038. We only need to update the mimeparse dependency. BUT noted that tastypie already includes this in their requirements https://github.com/django-tastypie/django-tastypie/blob/v0.13.0/requirements.txt (same version that we have 0.13.0)

Also I wanna point this that a found about tastypie and breaks our code when updating to 0.13.2 django-tastypie/django-tastypie#1407

@davidfischer
Copy link
Contributor

davidfischer commented Jun 28, 2018

Based on docs I wrote documenting our APIv2, I stated that we'd support APIv1 through at least Jan 2019. If that isn't possible, let me know.
https://docs.readthedocs.io/en/latest/api/v1.html

@stsewd
Copy link
Member

stsewd commented Jun 29, 2018

I don't think this will be a problem when updating django or python, so we can hold till 2019 😁, but there are some solutions in the related issue (I'm not really familiar with the Authorization part, so I'm not sure how this will affect our code if we want to apply that fix).

@stsewd stsewd mentioned this issue Jul 2, 2018
4 tasks
@stsewd
Copy link
Member

stsewd commented Jul 2, 2018

@davidfischer I found that we need to update tastypie to support django 1.10 (#4319), if isn't possible to adapt our code to django-tastypie/django-tastypie#1407 we will need to remove tastypie, I'm not sure what decision will be taken here (keep tastypie to extend the api v1 life or upgrade django).

@humitos
Copy link
Member Author

humitos commented Jul 26, 2018

I'm closing this because the endpoint with the problem no longer exists and #4426 already upgraded the requirement.

@humitos humitos closed this as completed Jul 26, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Good First Issue Good for new contributors Improvement Minor improvement to code
Projects
None yet
Development

No branches or pull requests

6 participants