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

Remove Library type + GeoIP & iptools dependencies #2955

Merged
merged 12 commits into from
Feb 10, 2020
Merged

Conversation

tfmorris
Copy link
Contributor

@tfmorris tfmorris commented Feb 2, 2020

Closes #2896. Replaces #2866.

Technical

This removes the Library page type and all associated templates, as well as the inlibrary and geo_ip modules, along with all code the references them.

Testing

Evidence

Stakeholders

@tfmorris tfmorris marked this pull request as ready for review February 2, 2020 18:35
@tfmorris tfmorris requested review from cclauss and hornc February 2, 2020 18:35
@tfmorris
Copy link
Contributor Author

tfmorris commented Feb 2, 2020

From a deployment perspective, you probably want to make sure that there aren't crontab entries or something similar which are updating the GeoIP database, etc. The only dependency changes are dependencies which are no longer needed, so they can be cleaned up when convenient.

@tfmorris tfmorris changed the title WIP - Remove Library type + GeoIP & iptools dependencies Remove Library type + GeoIP & iptools dependencies Feb 2, 2020
@hornc hornc self-assigned this Feb 3, 2020
self.set_inlibrary = True
self.inlibrary = inlibrary.get_library()
return self.inlibrary


def get_item_status(self, ekey, iaid, collections, subjects):
Copy link
Collaborator

Choose a reason for hiding this comment

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

@mekarpeles Is this readlinks.get_item_status() method use anywhere in the current lending system? It looks like it should be @deprecated or removed. I believe using subjects to determine lending status is fully deprecated, and the subjects are being cleared (see #2107) -- if this is still used, I don't think it will be giving good results.

status = 'restricted'
elif not self.get_inlibrary():
elif True: # not self.get_inlibrary(): - Deprecated
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'd probably use else here, but this whole method looks like it should be deprecated, so I'd rather get confirmation from @mekarpeles before changing anything else.

@@ -30,5 +24,4 @@ def on_new_version(self, page):
def setup():
"""Installs handlers for various events.
"""
eventer.bind("page.edit.libraries", on_library_edit)
eventer.bind("page.edit", on_page_edit)
Copy link
Collaborator

Choose a reason for hiding this comment

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

This looks like it could be removed, along with the def on_page_edit(page) -- I wouldn't know if this causes other problems. Is there a specific reason you left it with a pass, or just general caution?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Mainly to leave a vestige of the mechanism in place in case someone wanted to use it again. I'm OK with removing the whole thing if you think that's best.

@hornc
Copy link
Collaborator

hornc commented Feb 3, 2020

Thanks @tfmorris , I'm still reviewing. There are more changes here that I expected, but everything you have removed looks like stuff I'm happy to see gone!

I think even more of that lending code you have touched should be deprecated, but not necessarily in this PR. I think it means there is little risk of changes to those files causing problems since the lending system and has been updated, and we now have an availability API used to provide this functionality elsewhere. I'm hoping @mekarpeles can confirm and ok these changes too.

The main thing I'm unsure about is the stats aspect. I don't know where those stats were going, and whether they are still being used in any way. Again, @mekarpeles will hopefully have more insight.

On the whole this looks like the right approach to me, and I'd like to see it through after some due diligence and review. Thanks!

Getting rid of the Library class and all those templates feels long overdue. I hope no one disagrees - @cdrini, @jdlrobson , please comment here if you have any reservations about removing these files touched by this PR. I'm definitely in favour of seeing them gone.

@hornc hornc requested a review from mekarpeles February 3, 2020 02:03
@hornc hornc added Theme: Upgrade to Python 3 Type: Refactor/Clean-up Issues related to reorganization/clean-up of data or code (e.g. for maintainability). [managed] labels Feb 3, 2020
@hornc
Copy link
Collaborator

hornc commented Feb 3, 2020

sorry, just realised that @cclauss is responsible for many of these changes too, thank you! :)

@mekarpeles
Copy link
Member

Most of this LGTM, core.lending is what drives lending and I'm seeing much in the way of dependencies here.

Copy link
Contributor

@cclauss cclauss left a comment

Choose a reason for hiding this comment

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

RSLGTM

Copy link
Collaborator

@hornc hornc left a comment

Choose a reason for hiding this comment

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

This looks good, I'm happy it avoids current lending code and is only removing stuff we want gone.

@tfmorris I was going to merge, but this has conflicts -- are you able to resolve / rebase against master?

@tfmorris tfmorris force-pushed the remove-class-Library branch from 3c9d1d7 to 7dd26fd Compare February 10, 2020 17:21
@tfmorris
Copy link
Contributor Author

@hornc I've rebased it against the current master.

@hornc hornc merged commit df36ecc into master Feb 10, 2020
@hornc
Copy link
Collaborator

hornc commented Feb 10, 2020

Thanks for your efforts in pushing this forward @tfmorris!

I tested locally in my local env, and also on dev.openlibrary.org. Mainly to check that lending status and borrowing were not affected. I did not notice anything. We should keep an eye out after deploy just in case.

This should unblock a number of the smaller Python 3 PRs currently in flight, @cclauss

hornc added a commit that referenced this pull request Feb 10, 2020
@cclauss cclauss deleted the remove-class-Library branch February 11, 2020 03:22
return LoanStats().get_active_loans_of_libraries()


def on_loan_created_statsdb(loan):
Copy link
Member

@mekarpeles mekarpeles Mar 19, 2020

Choose a reason for hiding this comment

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

:(:(:(:(:(:(:(:(:(:(:(:(:(:(:(:(:(:(:(:(:(:(:(:(:(:(:(:(:(:(:(:(:(:(:(:(:(:(:(:(:(:(:(:(:(:(:(:(:(

Copy link
Collaborator

Choose a reason for hiding this comment

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

Context: Looks like these methods were being used to populate the Borrows graph on the homepage. The setup method of this file hooks to to events and calls these functions. Today we learned. Mek's got a fix in progress.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you for a more meaningful message. The relevant issue is #3194

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Refactor/Clean-up Issues related to reorganization/clean-up of data or code (e.g. for maintainability). [managed]
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove Iptools and GeoIP dependencies
5 participants