Skip to content

Update to support python3 - #86

Merged
codelucas merged 1 commit into
codelucas:masterfrom
paul-english:master
Dec 17, 2014
Merged

Update to support python3#86
codelucas merged 1 commit into
codelucas:masterfrom
paul-english:master

Conversation

@paul-english

Copy link
Copy Markdown
Contributor

This updates the code to work with python 3, issue #36. Similar to PR #38, but for the latest code.

The handling of utf-8 strings and bytes (decoding/encoding) is definitely not ideal. This could be cleaned up, but I'd need to study the library a bit more. Help here would be nice.

Three assertions in the tests don't pass (summary, keywords, authors), but the functionality is correct. These are because the results are random and so assertions will sometimes pass or fail. I don't know why they aren't deterministic, they always pass on master. Maybe due to an update on the dependencies. Not sure how you'd like to test or handle these.

Have a review, and let me know if there's anything else to update.

@codelucas

Copy link
Copy Markdown
Owner

Nicely done! I'll test your code changes over the course of the next few days.

Three assertions in the tests don't pass (summary, keywords, authors), but the functionality is correct. These are because the results are random and so assertions will sometimes pass or fail. I don't know why they aren't deterministic, they always pass on master.

^ What do you mean by this? I've updated the suite so the test runs should be deterministic. i.e., all HTTP requests are mocked. Like you said, the tests always pass on master so the issue is likely to be in the dependencies. Hmm .. maybe it's because we are using an updated NLTK? I'll try to investigate.

Meanwhile, you should submit a pull request with just these commits and i'll merge:

  • Update dependencies to python3 compatible versions b6e9c3c
  • Depend on packages via requirements.txt rather than externed 8c6f078
  • Tests passing (almost) … 32df727

@codelucas codelucas mentioned this pull request Nov 17, 2014
@hnykda

hnykda commented Nov 25, 2014

Copy link
Copy Markdown
Contributor

When this will be merged? +1 Python 3 support

@codelucas

Copy link
Copy Markdown
Owner

This will be merged very very soon. Expect it in ~two weeks.

@hnykda

hnykda commented Nov 26, 2014

Copy link
Copy Markdown
Contributor

Thank you. Looking forward to it :) .

Require BeautifulSoup4 so that pip3 install works.
@paul-english

Copy link
Copy Markdown
Contributor Author

Just wanted to touch in. I haven't refactored this PR with the 3 requested commits as it was a bit of a mess. The 2to3 changes were a bit tough to untangle.

@codelucas

Copy link
Copy Markdown
Owner

I've been looking over the library today trying to get the test cases to pass.

Few things ..
@log0ymxm, you're right about the results not being deterministic. I didn't mock HTTP requests properly in the unit tests file. Fixing the mocking yielded correct results for summary, keywords, and authors ... but a few other tests ended up breaking.

Will continue to work on it and update as time passes.

@codelucas
codelucas merged commit 60a9536 into codelucas:master Dec 17, 2014
@codelucas

Copy link
Copy Markdown
Owner

BOOYAH. I'm currently writing a detailed explanation of how the port went (a few small but nuanced changes were made due to the differences between python 2 and 3)

@punchagan

Copy link
Copy Markdown

Awesome! I just came to know of newspaper, and was looking for Python3 compatibility! Perfect timing. Thanks!

@codelucas

Copy link
Copy Markdown
Owner

I'm trying to figure out how to deploy this on pip3 right now (as well as tagging the latest trunk for the last python 2 version).

For now @punchagan git clone this repo and set up your environment from there instead of a package manager

@punchagan

Copy link
Copy Markdown

Sure @codelucas. Will use pip -e!

@paul-english

Copy link
Copy Markdown
Contributor Author

Nice job, thanks!

@hnykda

hnykda commented Dec 17, 2014

Copy link
Copy Markdown
Contributor

Awesome - thank you very much. Just great.

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 this pull request may close these issues.

4 participants