PyQt6 and SIP v6 Snapshots Available

Mikhail Terekhov termimd at yandex.com
Sun Sep 27 18:59:57 BST 2020


On 2020-09-23 17:17, Eli Schwartz wrote:
> On 9/23/20 1:42 PM, Phil Thompson wrote:
>> On 23/09/2020 18:33, Detlev Offenbach wrote:
>>> Hi Phil,
>>>
>>> the download page says, that 'pyrcc' has been removed. What will be
>>> the successor? The eric-ide sources use resource files and thus
>>> depends on pyrcc.
>> I don't plan a successor as I don't see the point of resource files in a
>> Python context.
>>
>> What do you use it for?
>>
>> Phil
> +1
>
> qresource files are intended to embed random data files into
> single-executable style software distributions, to reduce the number of
> moving parts. This is as opposed to doing proper installation management
> unix style, and is of limited use on Windows too, as long as people ship
> Qt itself as shared libraries necessitating a directory structure.
Single executable style is not the only use case. And there is nothing
wrong with it, no matter what is called "proper installation management".
> This is all fine and well for C++ programs where qresources get
> statically linked into the executable itself, reducing the number of
> files to be installed.
>
> What's the point of it for generating *.py files with that data? You end
> up with multiple files to distribute anyway.
Yes, but the number of files could be reduced if the number of data files
is large. This could be very important if the filesystem latency is high
(think of running from NFS or very aggressive Windows antivirus
configuration). And yes, there are still cases when programs are run over
network without "proper" installation.

Also think of embedded devices where putting multiple small data files
into one could save precious space.

> pkg_resources.resource_filename() and its modern equivalent, the stdlib
> importlib.resources, allows you to access real files through standard
> pythonic mechanisms, without the wrapper abstractions and without an the
> rcc compiler. There's no need to handle data blobs as python inline
> strings, try to byte-compile something that doesn't really byte-compile
> well, etc.
>
> The resulting files are easily introspectable and modifiable in the
> built software bundle (because they are the original files) and only get
> read at the time of use.
Look at zipimport in python - there are some similarities.
>
> Really -- what is the big attraction to using qresources in python?
>
Simply put - convenience. One doesn't have to use it all the time but
some time it could be very handy. It is like using python instead of
C or even assembler - not strictly necessary but very convenient :)


Regards,

Mikhail Terekhov



More information about the PyQt mailing list