-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Python 3 Support #8
Comments
Is Python 2 still needed? If not I can try port it. |
I would be happy to have your help for porting to Python 3. The main goal is to have it running on Python 3. As a bonus it would be great, if it still runs on Python 2.7 with compatibility layers like python-future [1]. I already gave it a try last year using To run the unit and integration tests, you can use the following commands:
[1] https://python-future.org/ |
It's been quite tedious so far, and I reckon having it working with Python 3 is more than enough. Got most of the tests working now, just 32 left! |
I'm not sure if I'll continue porting this however, the code doesn't look all that well written from reading it. Maybe I'm better off using other utilities. But would be happy if you can continue where I left off. |
Thanks for your effort! I am sad to hear that you stopped your porting work for now. However, I think you already got a lot further with your port, than my last try. I know the code base is old and not easy to port. Did you find any major show stopper that requires a lot of re-work? I do not know about any similar tool with that many features, that's why I am trying to keep cfv alive. If you find some other tool with a similar feature-set, I am happy to hear about it myself. I will give your branch a try, once time allows it. |
Well the tool has good intentions but it just isn't that well written. This makes me rather nervous in using it. The main problem I saw was that it treated strings and bytes the same, and lots of functions were called assuming they were the same thing. Files were opened in both The torrent files were parsed in a rather non-documented way, with the torrent file specifying its own encoding. I somehow got those tests to pass. I agree there aren't any similar tools, but there are individual tools for their own file formats, like But yes I can continue a bit more today see if I can make more progress. I don't intend on using the tool though. |
Alright got the tests down to 26 failing ones. The remaining ones all appear to be due to a similar reason. I'm not quite sure what the test does however:
Perhaps you could debug it with both Python 2 & 3 and see how it's failing? I might stop working on it here on, since doubt I'm gonna use this in the future anyway. |
Thanks for your hard work! I will look into it, when I have some free time. |
Just a heads up - cfv is marked for autoremoval from testing on 2020-04-17 I guess we can re-add the package later on unless the current state of the py3 port is complete enough? |
Thanks for this heads up! |
cfv isn't going to be removed entirely from Debian by 2020-04-17, but only from testing, see https://en.wikipedia.org/wiki/Debian#Branches As such. it won't be part of the next stable release unless it gets ported to Python 3. If a port is complete and upload to Debian by end of the year, that will still allow it to re-enter for the next release. |
Sorry, don't think so. It would block removal of python2. Anyway, lets just ITP it once py3 version is functional enough. By "functional", I think we can disable certain functions if they are blocking the porting progress (i.e. perhaps fixing some uncommon checksum files can be postponed to later if there are py3 problems with those). |
As |
@bentolor Some alternatives I use are |
I tried |
@bentolor @stevenxxiu @Clover2k rhash with |
Hi, just thought some background might be helpful, or at least interesting. cfv started back in the Python 1.5.2 days before unicode string was a thing. I was working on converting it to use the Python2 unicode support but it might have been in a weird state when I stopped. If I recall, the reason for passing around byte/unicode strings equivalently was to try to handle invalid filename encodings. At least in Python 2, I recall that if filenames didn't decode properly with the current locale, they would be returned as a byte string instead of a unicode string. I don't know how Python 3 handles this. That might also be the reasoning behind the non-standard torrent handling that was mentioned, I don't recall that. I also apologize for the inscrutable tests. |
@matt-mueller Thanks for sharing these insights. I would be happy if you could join the project here at Github. I think Github encourages people more to contribute to the project than Sourceforge does. I still plan to have a working cfv version for Python 3 at some point. It is just not progressing that fast because at least for myself the pain of still having Python 2 around was not that big. |
I tried the cfv-python3.zip file with code from 05-24-2020 (latest) with Python 3.8 on FreeBSD 12.2, and it appears that there are some new incompatibilities. Trying to use cfv as-is results in: Can someone suggest a path forward, or at least things for me to try? I don't think trying to futurize the code again would work as there were additional changes made after futurizing. I've looked at the alternatives and none of them seem appealing: |
Sadly, Python 3 support is still in an incomplete state. I started the Python 3 port some time ago in the |
I was able to build and install the code from there. A quick test of functionality seems to be working. What is the method to run the tests without installing external test scaffolding? A simple: I am very encouraged by the progress made by others so far and would like to help. Also, should the various changes made to the cfv-project/cfv master branch since the python3 fork be looked at and possibly cherry-picked for inclusion in the stevenxxiu/cfv python3 branch? |
You can run the tests via I took some time to work through some changes made by @stevenxxiu. I ended up cherry-picking some fixes and also implementing some fixes differently (see my recent push to python3 branch). I only worked through to commit b69e34a, so @stevenxxiu's branch still has a lot more fixes. However, I want to carefully review them, as a few fixes are suboptimal, because they do not fix the root-cause, which most of the time was introduced by my previous porting effort. The changes from the master branch are currently not that important for the python3 branch, as they are only changing the CI pipeline from Travis CI to Github Actions. Of course, in the end we want to have those changes in the python3 version, but there is still a long way to go. In the python3 branch we are still struggling to have the test suite not crash... I am not even talking about having all tests pass. |
|
I made a lot of progress in the last days. All normal testcases pass now, at least on my Linux system. However, I haven't tried to use it in real-world scenarios yet. Also there seem to be some issues with the long tests. @Terry-Kennedy I think it would be a good opportunity, if you could try the python3 branch on your system. Please also run the test suite with something like |
I was finally able to get back to this today (a combination of work and vacation was interfering). It looks pretty good in summary:
The one failure in both "testing" and "testing without mmap" is:
I also get a bunch of: This is with Python 3.8.11 on FreeBSD 12.2-STABLE r370177 if that matters. Thanks to everyone for your hard work on this! With a little further testing we should be able to get this back into the FreeBSD ports tree. |
I decided to create a FreeBSD port in case anyone wants to try this. This is not an official port although I plan on submitting it once we're all happy with with the state of the python3 branch. |
@Terry-Kennedy Thank you for testing. I think the failure is just a hiccup with the test suite on your system. Basically, the test suite assumes that The clipping of max open files is a feature of the test suite, it keeps the test duration and resource usage within bounds. I would suggest you to reduce the max open files limit to <=4096 before running the tests (on Linux you can do this using Thanks for creating the FreeBSD port. I would be glad, if you could submit it, when the time has come :) |
Yes, I do have a partition named /data1 (I'm the guy with 512TB in his dining room 8-): If I temporarily unmount it (and remove the mountpoint) the test passes. May I suggest changing the "/data1" reference (and any other similar references) in the tests to something like "/ZxCvB" that people are less likely to run into? OTOH, maybe things are just more 'fun' here at the Edge Case Saloon. (cf. "On Testing" by Bill Sempf) Doing "ulimit -n 4096" lets those other tests pass without warning, so we're at 100% on FreeBSD 12.2. I see that a subsequent commit appears to address this. I'll be glad to submit the port. It would be best to wait until we have something where it makes sense to tag it as cfv-3_0_0 or similar - the port framework gets upset if the checksum of the tarball it downloads doesn't match what is coded in the port. In fact, if I re-run the port build now it fails because the python3 branch changed since Thursday. I believe that a bunch of the other *BSDs base their ports on FreeBSD's, so once the port lands back in FreeBSD it should be picked up by the others. |
For the The commit regarding the max open file limit does not change the code behavior. It just fixes the issue in the CI pipeline by calling I still want to do some more practical testing before releasing 3.0.0. However, I could release 3.0.0-beta1, if that helps. |
@Terry-Kennedy I just tagged and released version 3.0.0.dev0. I hope this helps with the FreeBSD port. |
Request to reinstate the FreeBSD port submitted as PR 257546: |
Committed to FreeBSD ports: If anyone following this issue has contacts at any of the other *BSDs, feel free to ask them to pick this up from FreeBSD. |
@Terry-Kennedy Thank you! |
What's missing for releasing 3.0.0? |
The only things missing for 3.0.0 is more testing, some minor code formatting changes (see #19) and fixing the PyPI project description formatting (https://pypi.org/project/cfv/3.0.0.dev0/). If you want to give it a try, you can simply install it via pip. On Python 3, the 3.0.0.dev0 pre-release version is automatically selected, because no stable release is available yet. So you only need to run: pip install cfv Please report back any problems and also if it is just working for you :) |
Version 3.0.0 is out now 🎉 🎉 🎉 : https://github.com/cfv-project/cfv/releases/tag/v3.0.0 Thanks to everyone supporting the Python 3 port, especially @stevenxxiu! @Terry-Kennedy This would be a good time to update the FreeBSD port :) Closing here :) |
On 2022-10-30 18:20, David Gnedt wrote:
Version 3.0.0 is out now 🎉 🎉 🎉 :
https://github.com/cfv-project/cfv/releases/tag/v3.0.0
Thanks to everyone supporting the Python 3 port, especially
@stevenxxiu!
@Terry-Kennedy This would be a good time to update the FreeBSD port :)
…--
Terri
|
Thank you! ### From OS-specific Repositories
#### FreeBSD
To install from FreeBSD port (maintained by @Terry-Kennedy):
```sh
...install cfv...
``` |
On 2022-11-01 10:04, David Gnedt wrote:
> Submitted: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=267449
> ...
> -- Terri
Thank you!
If you plan to keep the FreeBSD port up-to-date, you can also provide
us some install instructions for inclusion in the README.md.
I thought about something like this:
### From OS-specific Repositories
#### FreeBSD
To install from FreeBSD port (maintained by @Terry-Kennedy):
```sh
...install cfv...
```
It's pretty easy.
To install the pre-built package (updated quarterly, so may be
out-of-date):
pkg install cfv
To build from source (make sure your source tree is up-to-date via any
of
the usual methods):
cd /usr/ports/security/cfv
make; make install; make clean
To update the pre-built package:
pkg upgrade cfv
To update from source (again, make sure your source tree is
up-to-date)
portupgrade cfv
|
On 2022-10-30 18:20, David Gnedt wrote:
Version 3.0.0 is out now 🎉 🎉 🎉 :
https://github.com/cfv-project/cfv/releases/tag/v3.0.0
Thanks to everyone supporting the Python 3 port, especially
@stevenxxiu!
@Terry-Kennedy This would be a good time to update the FreeBSD port :)
@alfs If you can help resurrecting the Debian package, please leave a
comment here: #4
Closing here :)
Committed to FreeBSD ports tree:
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=267449#c3
…--
Terri
|
Thank you @Terry-Kennedy! I have updated the README.md with your instructions. If you find any mistake or want to improve the wording, just leave a comment or directly open a pull request :) |
Python 2 will be end-of-life in 2020 (https://www.python.org/dev/peps/pep-0373/#update), so we have to add support for Python 3.
The text was updated successfully, but these errors were encountered: