Quantcast
Channel: RasadaCrea rss feeds aggregator
Viewing all articles
Browse latest Browse all 176

The joy of distributing Python packages for Python 2 and 3

$
0
0
I released ws4py 0.3.4 this weekend and although I had integrated support for Python 2 and 3 for a long time now, I ran into a challenge I had quite missed. Indeed, until now my Python 3 support had mainly been concerned about string handling and various compatibility modules . This has proven to work very well and avoided having to rely on external packages such as six. However, in the past few weeks and I added asyncio support to ws4py and therefore introduced the newly yield from statement. Of course, this isn't tolerated by Python 2 which complains with a well deserved SyntaxError. The issues however is that I wished to distribute the same source code with a single source distribution archive. Initially, I had written a function that was preventing modules using that statement to actually be packaged . However, this was rather daft since that, if it weren't packaged, it wouldn't be distributed either. Next, I decided to some of setuptools magic . Well, it didn't help since that's not what it's there for anyhow. At this stage, I should say: Don't simply copy/paste. It will do no good. Finally, I opted for a fairly simple solution . I knew that when a package is installed from a distribution packages, it is obviously built .. cntd

Viewing all articles
Browse latest Browse all 176

Trending Articles