Skip to content

Conversation

@benjsec
Copy link

@benjsec benjsec commented Oct 13, 2017

This is work-in-progress pull request for python 3 compatibility addressing issue #36.

The evernote package isn't currently available for py3 (see https://pypi.python.org/pypi/evernote), which causes a problem. For now all evernote functionality has been removed, including for py2 (hence why this is a WIP PR). There are a couple of options here:

  1. Use the beta evernote py3 SDK (https://github.com/evernote/evernote-sdk-python3)
  2. Remove everynote support completely
  3. Retain evernote in py2, but omit it in py3

Also fabric isn't compatible with py3 yet either. I haven't worked with it before, so am not sure how important it is to the dev workflow here. For now I've changed tests to run directly instead of via the fabric generated runtests.py.

p.s. Sorry it's so big - but it feels like an all-or-nothing situation. I've tried to keep it only to changes needed for py3 compatibility, and have endeavored to keep the functionality identical. Before this is merged I'll squash the commits so all my mistakes aren't included, but kept the individual commits for now to make reviewing easier.

Ben S added 30 commits October 12, 2017 13:05
Evernote module not compatible with py3 yes.
* Py3 requires absolute imports
* Multiprocessing module has been reorganized for py3.4+
    (see https://github.com/pyinstaller/pyinstaller/wiki/Recipe-Multiprocessing)
* Use DistUtils.StrictVersion for version checking, makes it easier
* Update except listings to py3 format
* Force encoding for subprocess output to avoid having bytestrings in py3
With a bare `raise` not being acceptable in py3, just raising an exception
of the same type lost much of the useful information, making debugging hard.
Now the original error is preserved, and re-raised appropriately.
* Use context manager for opening files, to make sure they are closed properly
* Different (better) string conversions now py3 is unicode default
* Use tmpdir in tests to ensure a new directory is used for every test and
  cleaned up afterwards.
* Use `self` instead of class name when addressing class attributes
* Define class attributes in `__init__` to prevent data-leaks between multiple
  instances of the class.
* Move queue purging out of loop to avoid "Dictionary changed size..." errors.
* Include py3.5 and py3.6 testing in travis.
* Run pytest directly instead of through `setup.py` and fabric.
    At this time fabric is py2 only, so an updated `runtests.py`
    can't be generated.
This flag is no longer supported, and has been removed from current versions of pip.
See travis-ci/docs-travis-ci-com#10 for more details.
It seems that py2 wasn't happy with purely absolute imports, whilst
py3 isn't happy with purely relative imports. Using explicit relative
imports seems to be working in both py2 and py3.
This reenables evernote support in python2 whilst keeping
python3 functionality for all other aspects.
@benjsec
Copy link
Author

benjsec commented Oct 23, 2017

The most sensible option seemed to be retaining evernote in py2, whilst omitting it in py3 for the time being. I've implemented this and no longer consider this a WIP pull request. I'll go through and squash the commits in the coming days.

@benjsec benjsec mentioned this pull request Nov 6, 2017
@benjsec
Copy link
Author

benjsec commented Nov 6, 2017

Resubmitting this as PR #71 with commit squashed, so closing this PR.

@benjsec benjsec closed this Nov 6, 2017
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.

1 participant