defnull / multipart

Multipart parser for Python 3
Other
120 stars 33 forks source link

Port to python 3 only (was: attempted used of unicode type in python3) #15

Closed theelous3 closed 5 years ago

theelous3 commented 5 years ago

The unicode type does not exist in python 3, but an attempt to use it is made:

def to_bytes(data, enc="utf8"):  # Convert strings to bytes (py2 and py3)
    return data.encode(enc) if isinstance(data, unicode) else data
defnull commented 5 years ago

The project uses 2to3 to create a python3 version, which correctly translates unicode to str during the build process for python 3. This was the way to go 9 years ago. Dark, dark times.

I'd accept a pull request that moves the entire project to Python3 only, as long as the patch is comprehensible and can be reviewed properly (e.g. do not also fix formatting in the same commit).

defnull commented 5 years ago

I'll keep this open as a reminder or invitation to port this project to Python3 only. The 0.1 release works fine for Python 2.5+ and can still receive bugfixes to support old environments.

theelous3 commented 5 years ago

Working on this.

https://github.com/defnull/multipart/pull/16

theelous3 commented 5 years ago

Ah. Just saw we're leaving this as a dev version. I'll reopen until it's good to go.

defnull commented 5 years ago

All merged. We are on python 3.6+ now

theelous3 commented 5 years ago

Can we get a pypi push?

defnull commented 5 years ago

Let's see if anyone is actually using this library and auto-upgrading dependencies ;)

theelous3 commented 5 years ago

I'm using it now :D Running my fork locally but would like to run latest on main from pypi as dependency. Are you saying you'd like to hold off in case we need deprecation period?

defnull commented 5 years ago

No need to make things more complicated than necessary. This project is small enough, and in semver 0.x releases are allowed to break backwards compatibility. I just pushed to pypi. Hope it worked, hadn't done that in a while.

We can adopt a more gentle deprecation process later, one people actually depend on this project to be stable and start complaining if we break stuff ;)

theelous3 commented 5 years ago

Ok, nice. I wasn't sure if it was semver cos it's just the first two places.

Next on my list is some sort of iter behaviour to get rid of any use of tempfiles :)

https://pypi.org/project/multipart/0.2/

Pushed well. Description is out of date though.