From 7b711cb15d11ca9f090ca06c909eab57adf5c316 Mon Sep 17 00:00:00 2001 From: Alexandre Flament Date: Wed, 15 Mar 2023 20:04:03 +0100 Subject: [PATCH] Add GitHub Codespaces configuration --- .devcontainer/Dockerfile | 4 ++++ .devcontainer/devcontainer.json | 31 ++++++++++++++++++++++++++++ .vscode/launch.json | 23 +++++++++++++++++++++ .vscode/settings.json | 11 ++++++++++ .vscode/tasks.json | 36 +++++++++++++++++++++++++++++++++ README.rst | 19 +++++++++++++++++ 6 files changed, 124 insertions(+) create mode 100644 .devcontainer/Dockerfile create mode 100644 .devcontainer/devcontainer.json create mode 100644 .vscode/launch.json create mode 100644 .vscode/settings.json create mode 100644 .vscode/tasks.json diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 000000000..9e5871918 --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,4 @@ +FROM mcr.microsoft.com/devcontainers/base:debian + +RUN apt-get update && \ + apt-get -y install python3 python3-venv redis firefox-esr graphviz imagemagick librsvg2-bin fonts-dejavu shellcheck diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 000000000..3f8c4c81a --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,31 @@ +{ + "build": { + "dockerfile": "Dockerfile" + }, + "features": { + "ghcr.io/devcontainers/features/github-cli": {} + }, + "customizations": { + "vscode": { + "extensions": [ + "ms-python.python", + "ms-azuretools.vscode-docker" + ], + "remote.otherPortsAttributes": { + "protocol": "https" + }, + "settings": { + "files.autoSave": "off", + "python.defaultInterpreterPath": "/workspaces/searxng/local/py3/bin/python3", + "python.formatting.blackPath": "/workspaces/searxng/local/py3/bin/black", + "python.linting.pylintPath": "/workspaces/searxng/local/py3/bin/pylint" + } + } + }, + "forwardPorts": [8000, 8888], + "portsAttributes": { + "8000": {"label": "Sphinx documentation"}, + "8888": {"label": "SearXNG"} + }, + "postCreateCommand": "git pull && make install" +} diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 000000000..8ec6ff9b8 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,23 @@ +{ + // See https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "name": "SearXNG", + "type": "python", + "request": "launch", + "module": "searx.webapp", + "env": { + "FLASK_APP": "webapp", + "FLASK_DEBUG": "1", + "SEARXNG_DEBUG": "1", + }, + "args": [ + "run" + ], + "jinja": true, + "justMyCode": true, + "python": "${workspaceFolder}/local/py3/bin/python", + } + ] +} \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 000000000..512342bae --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,11 @@ +{ + "python.testing.unittestArgs": [ + "-v", + "-s", + "./tests", + "-p", + "test_*.py" + ], + "python.testing.pytestEnabled": false, + "python.testing.unittestEnabled": true, +} \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 000000000..4d4a57b80 --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,36 @@ +{ + // See https://go.microsoft.com/fwlink/?LinkId=733558 + // for the documentation about the tasks.json format + "version": "2.0.0", + "tasks": [ + { + "label": "make run", + "type": "shell", + "command": "make run", + "problemMatcher": [], + "isBackground": true, + "presentation": { + "reveal": "always", + "panel": "dedicated" + }, + "group": { + "kind": "build", + "isDefault": true + } + }, + { + "label": "make docs.live", + "type": "shell", + "command": "make docs.live", + "problemMatcher": [], + "isBackground": true, + "presentation": { + "reveal": "always", + "panel": "dedicated" + }, + "group": { + "kind": "build" + } + } + ] +} \ No newline at end of file diff --git a/README.rst b/README.rst index e3d15bfb6..9b926b1c9 100644 --- a/README.rst +++ b/README.rst @@ -145,6 +145,25 @@ Help translate SearXNG at `Weblate`_ :target: https://translate.codeberg.org/projects/searxng/ +Codespaces +========== + +You can contribute from your browser using `GitHub Codespaces`_: + +- Fork the repository +- Click on the ``<> Code`` green button +- Click on the ``Codespaces`` tab instead of ``Local`` +- Click on ``Create codespace on master`` +- VSCode is going to start in the browser +- Wait for ``git pull && make install`` to appears and then to disapear +- You have `120 hours per month`_ (see also your `list of existing Codespaces`_) +- You can start SearXNG using ``make run`` in the terminal or by pressing ``Ctrl+Shift+B``. + +.. _GitHub Codespaces: https://docs.github.com/en/codespaces/overview +.. _120 hours per month: https://github.com/settings/billing +.. _list of existing Codespaces: https://github.com/codespaces + + Donations =========