Skip to content
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

remove no longer maintained scripts from searxng_extra #651

Closed
wants to merge 2 commits into from

Conversation

return42
Copy link
Member

What does this PR do?

remove no longer maintained scripts from searxng_extra

Why is this change important?

tidy up

Related issues

@dalf
Copy link
Member

dalf commented Dec 24, 2021

IMO we should keep searxng_extra/standalone_searx.py: it can be useful to have a command line to run the app.

  • For example here and there I've seen request to make a equivalent of Google Alert. standalone_searx.py can be starting point.
  • It can also be useful to have an search engine available in command line (using coloredlogs or rich)
  • Or just pipe the output to some other commands.

Script did not work / is not maintained.

Closes: searxng#332
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
Script did not work / is not maintained.

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
@return42
Copy link
Member Author

it can be useful to have a command line to run the app.

Yes I also like to have a command line .. but one that works :-) .. try:

./manage pyenv.cmd python searxng_extra/standalone_searx.py --help

For me it is not clear what use case of this implementation is / is the command line started like shown above? .. or do I need to install (make install).

We can implement a command line but then it should be placed in a folder ./cli (or similar). At the of the reorganization of SearXNG I see the following root folders in the repository:

  • ./client --> where the HTML clients are located
  • ./server --> where the webapp is located
  • ./cli --> where a command line client is located

If you want, we can implement a command line, but this broken code in standalone_searx.py want help us I think.

@dalf
Copy link
Member

dalf commented Dec 24, 2021

but one that works :-) .. try:

A quick fix

diff --git a/searxng_extra/standalone_searx.py b/searxng_extra/standalone_searx.py
index e243d9cb..de8a0d77 100755
--- a/searxng_extra/standalone_searx.py
+++ b/searxng_extra/standalone_searx.py
@@ -196,9 +196,14 @@ def parse_argument(
 
 
 if __name__ == '__main__':
-    searx.search.initialize()
+    settings_engines = searx.settings['engines']
+    searx.search.load_engines(settings_engines)
     engine_cs = list(searx.engines.categories.keys())
     prog_args = parse_argument(category_choices=engine_cs)
+    searx.search.initialize_network(settings_engines, searx.settings['outgoing'])
+    searx.search.check_network_configuration()
+    searx.search.initialize_metrics([engine['name'] for engine in settings_engines])
+    searx.search.initialize_processors(settings_engines)
     search_q = get_search_query(prog_args, engine_categories=engine_cs)
     res_dict = to_dict(search_q)
     sys.stdout.write(dumps(

What happens with --help: the engines are initialized with background threads, and the main thread quickly displays the help message and quit. Since the main thread is exiting, the network are closed by the atexit handler, so the background threads find that the HTTP clients are closed which throw an exception.

The fix is to load the engines but to initialize them only after the arguments parsing.

The engines must be loaded first to be able to display the category list in the help message.

./client --> where the HTML clients are located

I don't understand what goes into this folder.

./cli --> where a command line client is located

An alternative is to move standalone_searx.py to searx/__main__py, so python -m searx[ng] works and it can be installed using setup.py --> ./searx[ng] "time" works too.

@return42
Copy link
Member Author

return42 commented Dec 26, 2021

A quick fix

@dalf thanks .. but:

An alternative is to move standalone_searx.py to searx/__main__py, so python -m searx[ng] works ..

I would vote to implement a generic command line which can be started by python -m searx[ng]. The command line can group commands and can be extended to the needs. But I think we can drop standalone_searx.py since I do expect some different needs.

Its up to your decision, if want, we can keep standalone_searx.py ... just give me a short feedback if you want to keep ... / if so please send your PR to fix standalone_searx.py.


./client --> where the HTML clients are located

I don't understand what goes into this folder.

Somewhere in the future, the source of the HTML-CSS-JS clients could be moved into this folder, e.g.:

rename ./searx/static/themes/simple/src    ./client/simple
rename ./searx/static/themes/__common__    ./client/__common__

@dalf
Copy link
Member

dalf commented Dec 26, 2021

I do expect some different needs.

What are they?

I do expect some different needs.

I would like to keep it, so we can take time to implement a new script. If someone wants a command line the existing script still provides some values.

@dalf dalf mentioned this pull request Dec 26, 2021
@return42
Copy link
Member Author

I do expect some different needs.

What are they?

  • A command line client / not a command line server like standalone_searx.py it is. The big drawback of this solution is, that each time I use this command line my IP is send to all active engines (google, yahoo ..) and can be tracked. --> this is against of the privacy concept of SearXNG.

  • A output that is rendered for the command line .. not a JSON dump.

The standalone_searx.py script is good for developers, to see how things in SearXNG do work and to experiment with .. but standalone_searx.py is nothing that should be used by end-users.

@dalf dalf closed this Dec 27, 2021
@dalf
Copy link
Member

dalf commented Dec 27, 2021

Replaced by #658

return42 added a commit to return42/searxng that referenced this pull request Dec 29, 2021
Stuff in folder searxng_extra/ is not suitable for normal users and should only
be used by developers.

The script searxng_extra/standalone_searx.py must not give the impression that
it improves privacy. [1]

[1] searxng#651 (comment)

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
return42 added a commit to return42/searxng that referenced this pull request Jan 3, 2022
Stuff in folder searxng_extra/ is not suitable for normal users and should only
be used by developers.

The script searxng_extra/standalone_searx.py must not give the impression that
it improves privacy. [1]

[1] searxng#651 (comment)

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
@return42 return42 deleted the clean-extra branch January 3, 2022 14:04
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.

None yet

2 participants