From d8c834095b4f2afb829dd47ce224f14001ce7ceb Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Sun, 26 Jan 2025 17:50:00 -0600 Subject: [PATCH] feat: add pkg extras for postgres, mysql; update install doc no longer requires psycopg2 by default; use postgres extra --- docs/narr/install.rst | 36 ++++++++++++++++++++++++++---------- pyproject.toml | 3 ++- 2 files changed, 28 insertions(+), 11 deletions(-) diff --git a/docs/narr/install.rst b/docs/narr/install.rst index 68ded40..5d2cd2c 100644 --- a/docs/narr/install.rst +++ b/docs/narr/install.rst @@ -8,22 +8,34 @@ Prerequisites ------------- You'll need Python >= 3.8, and a database. See also -:doc:`wuttjamaican:narr/install/prereqs` in the Wutta docs. +the Wutta docs: + +* :doc:`wuttjamaican:narr/install/prereqs` +* :ref:`wuttjamaican:create-appdb` + +But for convenience here is a cheat sheet: + +*PostgreSQL* .. code-block:: sh sudo apt install build-essential python3-dev python3-venv postgresql libpq-dev -As for the database, see also :ref:`wuttjamaican:create-appdb` but FYI -these docs will assume a PostgreSQL setup with ``sideshow`` as the DB -name (and PG username). - -.. code-block:: sh - sudo -u postgres createuser sideshow sudo -u postgres psql -c "ALTER USER sideshow PASSWORD 'mypassword'" sudo -u postgres createdb -O sideshow sideshow +*MySQL* + +.. code-block:: sh + + sudo apt install build-essential python3-dev python3-venv default-mysql-server + + sudo mysql -e "CREATE USER sideshow@localhost" + sudo mysql -e "ALTER USER sideshow@localhost IDENTIFIED BY 'mypassword'" + sudo mysqladmin create sideshow + sudo mysql -e "GRANT ALL ON sideshow.* TO sideshow@localhost" + Virtual Environment ------------------- @@ -49,12 +61,16 @@ the folder ownership should be changed to whatever you need: Install Sideshow ---------------- -First install the Sideshow package to your virtual environment: +First install the Sideshow package to your virtual environment. Note +that you must specify which DB backend to use: .. code-block:: sh - cd /srv/envs/sideshow - bin/pip install Sideshow + # postgres + bin/pip install Sideshow[postgres] + + # mysql + bin/pip install Sideshow[mysql] Then you can run the Sideshow installer: diff --git a/pyproject.toml b/pyproject.toml index 5b65704..807fc7d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -32,11 +32,12 @@ classifiers = [ license = {text = "GNU General Public License v3+"} requires-python = ">= 3.8" dependencies = [ - "psycopg2", "WuttaWeb>=0.20.5", ] [project.optional-dependencies] +postgres = ["psycopg2"] +mysql = ["mysql-connector-python"] docs = ["Sphinx", "furo", "sphinxcontrib-programoutput", "enum-tools[sphinx]"] tests = ["pytest-cov", "tox"]