Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add support for python3 #69

Merged
merged 17 commits into from
Jun 5, 2019
Merged

Add support for python3 #69

merged 17 commits into from
Jun 5, 2019

Conversation

justinfx
Copy link
Contributor

@justinfx justinfx commented Jun 5, 2019

This is a large merge which adds support for python 3.6+
It was a bit time consuming and took 3 full days. Some of the time was spent improving the tests and a good majority was spent dealing with the bytes/str handling between the api and the underlying sockets, buffers, and encoder/decoder.

Summary of changes:

  • Updating the test suite to properly clean up all queues and exchanges regardless of the test outcome and make it a little more externally configurable to run against different amqp user name
  • Introduce a dependency on python-future to bridge the support between python 2/3
  • Drop support for < py 2.7 and remove unnecessary vendored backports
  • Updated syntax in library and tests
  • Update and re-vendor the amqp_codegen tool
  • Update the local codegen tooling
  • Update buffer/socket/table logic to deal with bytes in py3
  • Updated doctests

I had to make a decision on the option for handling bytes vs str between python 2 and 3, and opted to keep a compatible experience for existing py2 users. And in py3 I went with encoding to bytes at the buffer/socket layer to allow for str type at the api layer. I had also encountered a new situation in my porting experience, where dictionaries unmarshaled directly from bytes produce bytes format keys. This means b'key' != 'key'. So I went with updating the codegen so the spec will decode the keys to a more natural str type.

Caveats:
There are 4 tests that originally failed for me in python2 using the master branch or 0.0.7 release tag (tested against RabbitMQ 3.6.6)

  1. test_basic_qos
  2. test_shared_qos
  3. test_exchange_delete_not_found
  4. test_queue_delete_not_found

For the qos tests, I was finding that the failure happened after the setting of the basic_qos, when the expected remaining messages were not read.
For the delete tests, I was finding that the expected NotFound exception no longer raises when deleting a queue or exchange that does not exist.
I have not spent time investigating these tests since they have not impacted our own higher level library consumption of puka.

Fixes #7
Refs #68

justinfx added 17 commits June 6, 2019 09:46
…nges even on failure

Signed-off-by: Justin Israel <justinisrael@gmail.com>
Signed-off-by: Justin Israel <justinisrael@gmail.com>
Signed-off-by: Justin Israel <justinisrael@gmail.com>
Signed-off-by: Justin Israel <justinisrael@gmail.com>
Signed-off-by: Justin Israel <justinisrael@gmail.com>
Signed-off-by: Justin Israel <justinisrael@gmail.com>
Signed-off-by: Justin Israel <justinisrael@gmail.com>
…old unittest backport

Signed-off-by: Justin Israel <justinisrael@gmail.com>
Signed-off-by: Justin Israel <justinisrael@gmail.com>
Signed-off-by: Justin Israel <justinisrael@gmail.com>
Signed-off-by: Justin Israel <justinisrael@gmail.com>
Signed-off-by: Justin Israel <justinisrael@gmail.com>
Signed-off-by: Justin Israel <justinisrael@gmail.com>
Signed-off-by: Justin Israel <justinisrael@gmail.com>
Signed-off-by: Justin Israel <justinisrael@gmail.com>
Signed-off-by: Justin Israel <justinisrael@gmail.com>
Signed-off-by: Justin Israel <justinisrael@gmail.com>
@majek majek merged commit 7a9f5a3 into majek:master Jun 5, 2019
@justinfx
Copy link
Contributor Author

justinfx commented Jun 5, 2019

Thanks for merging. It this going to get a new minor tag?

@majek
Copy link
Owner

majek commented Jun 5, 2019

v0.0.8 is yours. Thanks for the hard work.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support python 3
2 participants