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

Upgrade Django because #3297 #3305

Closed
wants to merge 2 commits into from
Closed

Conversation

kakulukia
Copy link

Fixed incompatibility with geos 3.6.3 while upgrading Django to its latest version.
Aditionally upgradead all other libs to the latest version except elasticsearch. Refactored render_to_request() to render()

@kakulukia
Copy link
Author

not sure about hos errers - i cant figure out what this has to do with my changes :(

Copy link
Member

@humitos humitos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the overall is OK. Just some comments:

  • I'm not sure about the Pipfile since I never used it, but seems to be something good to have
  • I think at RTD are kind of "conservative" in some way, regarding upgrading all the packages at once, so I'm not sure that something that they want (Upgrade all packages using pur tool #2916)
  • There are some test that do not pass with your changes (maybe it's because of the upgrades), can you fix them?

Finally, can you take a look at my comments?

TASTYPIE_FULL_DEBUG = True

# Domains and URLs
PRODUCTION_DOMAIN = 'readthedocs.org'
PUBLIC_DOMAIN = None
USE_SUBDOMAIN = False
USE_SUBDOMAIN = True
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why you changed this default?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kakulukia Any feedback on this?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this shouldnt have made it into the PR - its already reverted and github anlready maks this as outdated for me

@@ -274,7 +278,7 @@ def INSTALLED_APPS(self): # noqa

# RTD Settings
REPO_LOCK_SECONDS = 30
ALLOW_PRIVATE_REPOS = False
ALLOW_PRIVATE_REPOS = True
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why you changed this default?

TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [os.path.join(SITE_ROOT, 'readthedocs', 'templates')],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use TEMPLATE_ROOT here.

@humitos humitos changed the title fixed https://github.com/rtfd/readthedocs.org/issues/3297#issuecomment-346395199 Upgrade all packages, including Django because #3297 Nov 24, 2017
@kakulukia
Copy link
Author

Hi @humitos i didnt mean to change the config defaults .. had to change them for my installation, but reverted that in the commits.
TEMPLATE_ROOT is not supported anymore - see: https://docs.djangoproject.com/en/1.8/ref/templates/upgrading/
And if im remembering correct, the project was already using Django 1.9 before my changes, so no harm done even for the old version.

@kakulukia
Copy link
Author

kakulukia commented Nov 24, 2017

I also pushed a version of pip.txt with minimal changes .. lets see how Travis likes that .. btw, the errors happened in the pagination package, but now there is a GDAL error .. i dont know how to influence Travis in being able to install it .. looks weird!

@humitos i dont see how my changes would influence the installation of gdal?
Any ideas?

@humitos
Copy link
Member

humitos commented Nov 24, 2017

TEMPLATE_ROOT is not supported anymore - see: docs.djangoproject.com/en/1.8/ref/templates/upgrading

I think it's something used internally by RTD, it's used in a couple of places. That's why I said that it should be used in the DIRS key for the templates.

@humitos i dont see how my changes would influence the installation of gdal? any ideas?

Not really :(

@kakulukia
Copy link
Author

I misunderstood that part .. its replaced now

@kakulukia
Copy link
Author

I still dont know why it wouldnt build - somebody with more knowledge about the travis setup should have a look

@kakulukia
Copy link
Author

The new Django version might be responsible for that GDAL error .. but is RTD actually using GDAL?

@kakulukia
Copy link
Author

That didnt work out that well ..

@RichardLitt RichardLitt added the PR: work in progress Pull request is not ready for full review label Nov 27, 2017
@tony
Copy link
Contributor

tony commented Dec 17, 2017

Let's keep #3297 open since that's not fixed until we get something merged

@tony
Copy link
Contributor

tony commented Dec 17, 2017

#3297 is blocking me on #3341. So let's get something squared away.

Re: Pipfile: I was thinking about a Pipfile, too. But that should happen in a separate PR. It's best to keep this PR conservative as possible. You'll notice a lot of future tweaking opportunities, so it's a good chance to write them down and tackle them in issues.

At this point it needs a rebase again master.

Are you open to sharing your repo and teaming up on it @kakulukia ?

@RichardLitt RichardLitt added the Status: blocked Issue is blocked on another issue label Dec 17, 2017
@kakulukia
Copy link
Author

@tony you are welcome to join!

@kakulukia
Copy link
Author

Well @tony as i stated before "I still dont know why it wouldnt build - somebody with more knowledge about the travis setup should have a look"

@tony
Copy link
Contributor

tony commented Dec 18, 2017

For some reason my change at 7cc235a isn't showing up on Travis.

@tony
Copy link
Contributor

tony commented Dec 18, 2017

I'm concerned about tweaks introduced outside the scope of fixing #3297. Most of them seem ironed out though. The official solution appears to be Django 1.11 (https://code.djangoproject.com/ticket/28441).

For some backstory: Here's the change that was done to fix #3297 itself in 1.11: django/django@a49764d.

@tony
Copy link
Contributor

tony commented Dec 18, 2017

@kakulukia I created two branches in your repo: django-1.11 (where I'm going to be doing squashing / deleting / rebasing) and django 1.11-backup.

@tony
Copy link
Contributor

tony commented Dec 18, 2017

@kakulukia Close this PR, make a new PR with this: master...kakulukia:django-1.11

That way you're operating off a branch name that doesn't clobber with the origin (main RTD's) master branch.

@kakulukia
Copy link
Author

just for curiosity: please explain why the branch name is important?
just because you are creating two diffent PRs or is it somthing else?

@tony
Copy link
Contributor

tony commented Dec 18, 2017

just for curiosity: please explain why the branch name is important?

It's best practice to pick a branch name if you intend on merging another branch on top of it.

In this specific case, there are conflicts and a need to rebase rtfd's master branch. But this PR uses the master branch. That adds a lot of ambiguity. I am switching between branches with 4 different remotes (rtfd, develtech, tony, and yours). Each have "master" branch in a different spot.

just because you are creating two diffent PRs or is it somthing else?

Nope.

The only way to merge from a different branch is a new PR.

Technically, I could close this and make a new PR from your repo. If I did this, you would still get credit in the git history (you would even if I forked your branch and PR'd from my own repo). This is because your commits are still there. However, I also want you to keep the credit for opening the PR, too. That's why I asked you to do it.

The branches:

django-1.11 is where I want to do work. I'm going to be doing rebasing (and probably resolving a lot of conflicts) and rebasing out (permanently removing) changes that were edited out in history.

django-1.11-backup is a pristine backup of this PR.

@kakulukia
Copy link
Author

please go ahead and do whats neccessary to fix the problem - sweet that you care about my credits, but if something gets missing i will still be able to sleep at nights, tho :)

@tony
Copy link
Contributor

tony commented Dec 18, 2017

Old commits: 9190111 ... 6250cd4

New rebase against master: 20cc779 ... 761e95e

@tony
Copy link
Contributor

tony commented Dec 18, 2017

@tony
Copy link
Contributor

tony commented Dec 18, 2017

OK, rebased against master (9e7bcb7), removed Pipfile stuff, and squashed.

Also, ff7acc8 seemed to fix the GDAL package issue.

So there are some remaining bugs cropping up:

  • API Tests, sync_versions, and project_views may be having some issues related to render()

    https://travis-ci.org/rtfd/readthedocs.org/jobs/318152474

  • Linting: Separate from this PR, see lint prospector task failing #3414 and AttributeError: 'NoneType' object has no attribute 'pattern' pylint-dev/pylint-django#108

    https://travis-ci.org/rtfd/readthedocs.org/jobs/318152478

    lint runtests: commands[0] | prospector --profile-path=/home/travis/build/rtfd/readthedocs.org --profile=prospector-more --die-on-tool-error
    
    Traceback (most recent call last):
    
      File "/home/travis/build/rtfd/readthedocs.org/.tox/lint/bin/prospector", line 11, in <module>
    
        sys.exit(main())
    
      File "/home/travis/build/rtfd/readthedocs.org/.tox/lint/lib/python2.7/site-packages/prospector/run.py", line 165, in main
    
        prospector.execute()
    
      File "/home/travis/build/rtfd/readthedocs.org/.tox/lint/lib/python2.7/site-packages/prospector/run.py", line 53, in execute
    
        for tool in self.config.get_tools(found_files):
    
      File "/home/travis/build/rtfd/readthedocs.org/.tox/lint/lib/python2.7/site-packages/prospector/config/__init__.py", line 45, in get_tools
    
        config_result = tool.configure(self, found_files)
    
      File "/home/travis/build/rtfd/readthedocs.org/.tox/lint/lib/python2.7/site-packages/prospector/tools/pylint/__init__.py", line 174, in configure
    
        self._prospector_configure(prospector_config, linter)
    
      File "/home/travis/build/rtfd/readthedocs.org/.tox/lint/lib/python2.7/site-packages/prospector/tools/pylint/__init__.py", line 34, in _prospector_configure
    
        linter.load_plugin_modules(['pylint_django'])
    
      File "/home/travis/build/rtfd/readthedocs.org/.tox/lint/lib/python2.7/site-packages/pylint/lint.py", line 495, in load_plugin_modules
    
        module.register(self)
    
      File "/home/travis/build/rtfd/readthedocs.org/.tox/lint/lib/python2.7/site-packages/pylint_django/plugin.py", line 22, in register
    
        start = name_checker.config.const_rgx.pattern[:-2]
    
    AttributeError: 'NoneType' object has no attribute 'pattern'
    
    ERROR: InvocationError: '/home/travis/build/rtfd/readthedocs.org/.tox/lint/bin/prospector --profile-path=/home/travis/build/rtfd/readthedocs.org --profile=prospector-more --die-on-tool-error'
    
    ___________________________________ summary ____________________________________
    
    ERROR:   lint: commands failed
    

Copy link
Contributor

@tony tony left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [TEMPLATE_ROOT],
'OPTIONS': {
'debug': True,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be 'debug': DEBUG,

@tony
Copy link
Contributor

tony commented Dec 18, 2017

Judging by the breaking of API endpoints, there is more at play between this and pagination.

self = <WSGIRequest: GET '/projects/django-kong/builds/'>, suffix = ''


    def get_page(self, suffix):

        """

        A function which will be monkeypatched onto the request to get the current

        integer representing the current page.

        """

        try:

>           return int(self.REQUEST['page%s' % suffix])

E           AttributeError: 'WSGIRequest' object has no attribute 'REQUEST'


../.tox/py36/lib/python3.6/site-packages/linaro_django_pagination/middleware.py:38: AttributeError

There is no more self.REQUEST, there is self.GET and self.POST.

zyga/django-pagination#41 (comment)

Anndd, the project is no longer maintained. So we're blocked by that.

@tony
Copy link
Contributor

tony commented Dec 19, 2017

This is becoming a lot more complicated.

pagination

I could fork and fix django-pagination. But I can't maintain it.

I'm also not quite sure why django's pagination isn't being used.

tastypie error

self = <readthedocs.api.base.ProjectResource object at 0x7ffbd6704310>

bundle = <Bundle for obj: '' and with data: '{}'>

kwargs = {'slug': 'django-kong'}


    def obj_get(self, bundle, **kwargs):

        """

            A ORM-specific implementation of ``obj_get``.

    

            Takes optional ``kwargs``, which are used to narrow the query to find

            the instance.

            """

        # prevents FieldError when looking up nested resources containing extra data

>       field_names = self._meta.object_class._meta.get_all_field_names()

E       AttributeError: 'Options' object has no attribute 'get_all_field_names'


../.tox/py27/lib/python2.7/site-packages/tastypie/resources.py:2116: AttributeError

----------------------------- Captured stderr call -----------------------------

may be fixed by upgrading to django-tastypie==0.14.0

@tony
Copy link
Contributor

tony commented Dec 19, 2017

This requires too much work for me at the moment. I'd probably end up doing my own PR because it's more than switching out a few packages/updating functions, there are dependencies down the line that need phasing out. Too much on my plate ATM.

If someone else wants to take this up, reply here and make a fresh PR

@kakulukia
Copy link
Author

@tony do you know why there is a need for custom rather than django builtin pagination? maybe it can very well be removed from the dependencies because its just a relic from old times?

@tony
Copy link
Contributor

tony commented Dec 19, 2017

@kakulukia And I should have asked you first, if you want to finish this PR. Or let someone fork it / do their own.

@tony do you know why there is a need for custom rather than django builtin pagination? maybe it can very well be removed from the dependencies because its just a relic from old times?

This is a big codebase. Figuring out whether a third party pagination plugin was cargo-culted in or is now redundant would take time. I have more urgent thing pressing on me ATM (like paying bills 😄)

@kakulukia
Copy link
Author

well, as far as i tested my latest commit i didnt have a problem with the pagination module.
I will have another look next week to maybe figure out whats broken after you fixed the gdal thing. :)

Could you add a help wanted label?

@kakulukia kakulukia changed the title Upgrade all packages, including Django because #3297 Upgrade Django because #3297 Jan 29, 2018
@stsewd
Copy link
Member

stsewd commented Apr 28, 2018

I think is better to follow the Django recommendations for upgrading to a new version https://docs.djangoproject.com/en/2.0/howto/upgrade-version/

Upgrade from each version till the current one (2.0) instead of upgrading to 2.0 in one step.

@stsewd stsewd mentioned this pull request May 31, 2018
5 tasks
@stsewd
Copy link
Member

stsewd commented Aug 30, 2018

Closing this in favor of #4319, which do the upgrade in a more granular way (first to 1.10), thanks to all people here, sorry that this wasn't merged, maybe you can help to review the other PR, or updating to 2.0 later.

@stsewd stsewd closed this Aug 30, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR: work in progress Pull request is not ready for full review Status: blocked Issue is blocked on another issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants