google / ipaddr-py

Google's Python IP address manipulation library
Apache License 2.0
194 stars 71 forks source link

Fix compatibility with Python 3 #118

Closed ghost closed 7 years ago

ghost commented 8 years ago

This is a trivial fix that makes ipaddr-py work with Python 3. Now, I know Python 3 has ipaddress module, but I see no reason why ipaddr-py should not be made working under Python 3 as well, especially since the fix is so simple, unless I'm missing something non-obvious.

This set of patches was made to make "devel/py-ipaddr" port on FreeBSD buildable with Python 3 (currently a proposal only, please see https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=205907 ), patches against ipaddr-2.1.11 from PyPi.

googlebot commented 8 years ago

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

:memo: Please visit https://cla.developers.google.com/ to sign.

Once you've signed, please reply here (e.g. I signed it!) and we'll verify. Thanks.


ghost commented 8 years ago

I signed it!

googlebot commented 8 years ago

CLAs look good, thanks!

AlexFinkel commented 8 years ago

Thanks for the patch!

The "something non-obvious" you may be unaware of is that the ipaddress module in Python 3 is a fork of ipaddr-py, and I believe more up-to-date. So if you're using Python 3, I'm curious to know why you still need ipaddr.

ghost commented 8 years ago

The problem domain is not for developers building new code for Python 3. It is the maintainership of a diverse ecosystem of Python programs built for a variety of versions. On FreeBSD we have the possibility to build programs against a specific version of Python if the program does not specify the version itself (does not hard depend on Python x.y). This trivial fix will help such programs run under both 2.x and 3.x, depending on what the users prefer for a particular use case.

patrys commented 8 years ago

We have a problem in an open-source project where if we include full requirements for Python 2 then they include ipaddr which is not used for Python 3 but fails to install. If we include requirements for Python 3 then it won't work for Python 2.