Replies: 19 comments
-
I detect Python version at runtime and alias the modules accordingly. For example, if module
I figured 😂 That's why I asked here first, I'd like to know what's right and what's wrong, then eventually I'll make changes and PR. P.S. my Nova+Flask-based search engine is taking shape 😉 |
Beta Was this translation helpful? Give feedback.
-
Doing it now :)
I see you commented something somewhere in the huge commit, but I can't find the comments. Would you please post here the links to the lines or email them to me? Thanks! |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
What In order to make nova a proper package, thus Currently nova, even though it looks like a package, does not work like one because qBittorrent calls one of its scripts directly. For this reason plugins can (in theory) be imported simply with This behavior also breaks my module-aliasing feature (which is required to maintain API compatibility with existing plugins), as This isn't an issue on Unix, technically, because we have fork (see this). However it turns out the forkless behavior is the default for A thread-based pool is a good compromise: we have a good degree of concurrency (network operations run concurrently for sure) and we get to keep the environment without adding even nastier hacks to the code.
Well I think well have to wait a little bit before Python6, and it's not a race or something anyway 😂 As I said, I liked how I personally don't really like
Fine, I'll open it soon then. Beware that it would still need some changes in qBittorrent's code because
It's a minor change, but I'd rather have someone else do it or help me do it: I don't have a lot of experience with C++ and have never seen qBittorrent's code. |
Beta Was this translation helpful? Give feedback.
-
Okay 😂 |
Beta Was this translation helpful? Give feedback.
-
One more detail I think is somewhat important: in Let me know if you think it's okay. |
Beta Was this translation helpful? Give feedback.
-
Thx for info. Unfortunately I can't tell if yours is the right direction about multiprocess/threading. |
Beta Was this translation helpful? Give feedback.
-
I guess I'll wait for more feedback.
For qBittorrent, absolutely nothing. It could just continue to be a "fake package" and it would still work. Using setuptools makes it easy to separate its development from qBittorrent's and make it standalone. It would work just like any other Python module that is available in PyPI or distro repos. Setuptools helps making sure dependencies are present, build proper executable scripts that run code from the package and allows easy publishing to PyPI.
That is correct. |
Beta Was this translation helpful? Give feedback.
-
You also mentioned Although you listed the features in first post (I assume which are good for your project), from qbt standpoint, may I ask what are the benefits? (aside from py2 & 3 unification). |
Beta Was this translation helpful? Give feedback.
-
I'd be interested to see how integration will look exactly. @sledgehammer999 P.s. please ping me so that i could review your PR. I like idea of unifying py2/py3 code base |
Beta Was this translation helpful? Give feedback.
-
Ideally, we just change the cmd line we use to call python+script. The results should be in the same format as now.
If this plans goes through, then IMO it is time to choose a more descriptive name than "nova". Anyone looking at the package in PyPI should have an idea on what it is by its name.
+1
I suppose both of those packages are available if user has python installed. @Depaulicious right? |
Beta Was this translation helpful? Give feedback.
-
As far as i know |
Beta Was this translation helpful? Give feedback.
-
Yep. I barely touched the result-printing stuff (only addressed some 2/3 compatibility issues).
TL;DR: on Linux: they're likely already installed. On Windows: Long answer:
In any case, you should note that, in 2017, most Python modules that need to connect to HTTP have already switched to
TL;DR: Yes. Long answer: there are two proper ways to install a Python package, and that depends on whether you want to have it installed in a local, private environment, or system-wide. In the former case you would need to create a virtual environment in some private user-writable program directory (i.e. This method has the advantage that qBittorrent will have the ability to automatically update nova by simply running In the latter case you'd need to prepare everything at build time, so it would only depend on In my opinion, while the latter would work very well on platforms where a proper packaging system is available (on Linux you'd just make a package for nova and depend on it, other dependencies would be pulled in by the package manager), the former case is more "universal".
As I said earlier, it would make it easier to automatically update the search engine when needed, and have the search engine in a separate repository.
Of course. That's one of the points of using |
Beta Was this translation helpful? Give feedback.
-
Screenshot of the installation of
Entry points for modules installed in virtual environments are found in So to automatically install nova, that's all you need to do. Then you just need to download the plugins somewhere in the filesystem and run it. |
Beta Was this translation helpful? Give feedback.
-
Personally, and speaking from the qbt POV, I am not interested in making it more complex to deploy the search feature. |
Beta Was this translation helpful? Give feedback.
-
Not true in my case, my arch linux doesn't install it by default.
Agree, but this is a C++ project with some python scripts bundled.
Thank you for the lengthy explanation.
IIRC, there are C++ parts that interact with it, so it's not preferred to update python part alone IMO, then it nullifies the need a of separate repo.
+1 |
Beta Was this translation helpful? Give feedback.
-
@Depaulicious I don't think most users would even bother accessing python enviornment and manually update engines/nova. Personally i just use portable python 3 without nay virtual env, and i don't need multiple enviornments :) Anyway, I'll review your PR so ping me and will see how it looks exactly |
Beta Was this translation helpful? Give feedback.
-
So, to recap:
How would you like it if we still keep it in a separate repository, still keep setuptools support for standalone usage but I make two wrappers that qBittorrent can call in order to use it without actually installing it anywhere? It can be included back in qBittorrent's repository using It would still depend on requests, of course, which can be made a qBittorrent dependency on Linux distros and can be installed during Python installation on Windows (just run |
Beta Was this translation helpful? Give feedback.
-
I finally opened the pull request (#7496). |
Beta Was this translation helpful? Give feedback.
-
I wanted to make qBittorrent's search engine standalone, so I took the code and tried to make it more independent.
As it changes many things I'm not opening a pull request immediately, I just wanted to show you the code first to see if you like it.
https://github.com/Depaulicious/Nova6
What's different from your code:
requests
instead ofurllib*
. I renamed it tonova6
because 2*3=6, likesix
setuptools
.nova6.py
andnova6dl.py
shouldn't be called directly anymore:setuptools
will set up two executables inPATH
that will pull the required functions in and make it work the same way it used to.argparse
instead of just readingsys.argv
, so that more command line arguments can be added.nova*/engines
: this behavior is still supported for backwards-compatibility. Engines lookup directories should be specified in command line with the-d
argument.-p
command line argument is provided, it will output some progress information after an engine is done searching.__init__.py
, it uses same-directory imports instead of same-package imports, making it work like a script pulling in some other scripts.sys.modules
aliasing hacks. They make sure that modules can still import package modules the way they always used to. It also aliases some commonly used modules that have been moved/renamed in Python3 to their old name.multiprocessing.Pool
, becausemultiprocessing
doesn't really know how to reconstruct this environment in a separate process. I switched tomultiprocessing.dummy.Pool
(athreading.Thread
-based pool) to keep it in the same process. The performance loss is not noticeable: blocking is mostly due to network operations only, which are done by the operating system. They run in parallel regardless of GIL.A
Process
based tool would also make it a bit complicated to display progress.Let me know if you like it, I'll be glad to add some more changes and help you merge it into qBittorrent.
P.S. why I did this? I'm making a standalone web-based torrent search interface compatible with qBittorrent's search plugins. I'm still working on it because — you know — web browsers, I'll upload the code to GitHub very soon.
nova6
seems very reliable and it's shaping up very well.Beta Was this translation helpful? Give feedback.
All reactions