Skip to content

Conversation

@ksz16
Copy link

@ksz16 ksz16 commented Dec 8, 2025

In the new versions of Python (3.13 and 3.14) attempt to build pylzma ends with an error.
Replacing pylzma with py7zr should solve the problem.

@ksz16
Copy link
Author

ksz16 commented Dec 9, 2025

I made a second commit because I used a less elegant approach in the first one (unpacking to a temporary directory).
In the second one I used WriterFactory (as described in the link below).

https://py7zr.readthedocs.io/en/latest/advanced.html

CLI tool for downloading subtitles from napiprojekt.pl, fork of [gabrys/napi.py](https://github.com/gabrys/napi.py)

## prerequisites
- Python 3.7 or newer
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it needed to drop support for 3.7 and 3.8?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it needed to drop support for 3.7 and 3.8?

I'm afraid so, because for py7zr version 1.0.0, the minimum required version is Python 3.9, and the maximum is Python 3.13 (planned support for 3.14).

@@ -1,6 +1,6 @@
[tool.poetry]
name = "napi-py"
version = "1.2.4"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if dropping the support is required, I think it should be 1.3.0

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if dropping the support is required, I think it should be 1.3.0

Yes, that makes sense, and you're right.

napi/read_7z.py Outdated
self._length = 0
self._lock = threading.Lock()

def write(self, data: bytes) -> None:
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

linter complains about returning type None instead of int as required by interface

I think there's a bit more work to make this change working with tests passing etc, i.e.

  • run poetry update and commit updated .lock file
  • make sure tests are passing through the means of make test executed in projects directory
  • add all required changes to this PR

The implementation itself makes sense, so there's just some boilerplate needed around python tooling. I may help you with it or base off of your changes and do it on my own but again, my spare time is super limited so can't promise doing it any time soon

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I mentioned when reporting the issue, I am not a Python expert. I admit that I did not perform exhaustive testing. I built a .whl package based on my commits and installed it locally using vevn. I have been using it for a few days instead of the old version, and everything seems to be working fine.
I will run poetry update and add a new poetry.lock. I will also try to run all the tests. I will try to do it myself, and if I have any problems, I will ask you for help. I just don't know when I'll have spare time - it might take me a while.

@ksz16
Copy link
Author

ksz16 commented Jan 25, 2026

A new poetry.lock file has been generated.
Support for Python versions lower than 3.10 has been dropped.

Unit tests passed.
Unfortunately, acceptance tests did not - they only passed partially.

I built a .whl package and installed it locally - it seems to work correctly (I tried it on different subs, with different encodings).

I tried to make various changes to pass the acceptance tests, but I didn't succeed (e.g., I added a User-Agent in api.py).
I think I've exhausted my basic Python skills at this point.

I know your spare time is limited, but maybe you can find a moment to put me on the right track.

Below are some of the test results:

test/acceptance/test_acceptance_cli.py::test_should_physically_download_subtitle_file PASSED                                                                                                                                                                              [ 16%]
test/acceptance/test_acceptance_cli.py::test_should_download_and_correctly_encode_utf8_src_subs FAILED                                                                                                                                                                    [ 33%]
test/acceptance/test_acceptance_lib.py::test_should_download_correctly_encoded_subs FAILED                                                                                                                                                                                [ 50%]
test/acceptance/test_acceptance_lib.py::test_should_return_none_when_no_subtitles_for_movie PASSED                                                                                                                                                                        [ 66%]
test/acceptance/test_acceptance_lib.py::test_should_download_subs_with_forced_encoding FAILED                                                                                                                                                                             [ 83%]
test/acceptance/test_acceptance_lib.py::test_should_download_subs_in_utf_16 FAILED
FAILED test/acceptance/test_acceptance_cli.py::test_should_download_and_correctly_encode_utf8_src_subs - AssertionError: Expected subtitles file under /tmp/tmpt4oixdhc.srt is absent
FAILED test/acceptance/test_acceptance_lib.py::test_should_download_correctly_encoded_subs - AssertionError: assert None == 'UTF-8-SIG'
FAILED test/acceptance/test_acceptance_lib.py::test_should_download_subs_with_forced_encoding - AssertionError: assert None == 'utf-8'
FAILED test/acceptance/test_acceptance_lib.py::test_should_download_subs_in_utf_16 - AssertionError: assert None == 'UTF-16'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants