Skip to content

Commit 3ccb49d

Browse files
committed
feat: add anyvlm database
close #23
1 parent a961068 commit 3ccb49d

File tree

20 files changed

+612
-0
lines changed

20 files changed

+612
-0
lines changed

.env.example

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
###############
2+
# BASIC SETUP #
3+
###############
4+
5+
# Storage configuration -- see "Configuration" -> "Object Storage" in the docs
6+
ANYVLM_STORAGE_URI=postgresql://anyvlm:anyvlm-pw@localhost:5435/anyvlm
7+
8+
############
9+
# OPTIONAL #
10+
############
11+
12+
## Testing - see "Contributing" -> "Testing" in the docs
13+
ANYVLM_TEST_STORAGE_URI=postgresql://anyvlm_test:anyvlm-test-pw@localhost:5436/anyvlm_test

compose.yaml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
services:
2+
3+
anyvlm_db:
4+
image: postgres:17
5+
volumes:
6+
- anyvlm_vol:/var/lib/postgresql/data
7+
ports:
8+
- 127.0.0.1:5435:5432
9+
environment:
10+
- POSTGRES_DB=anyvlm
11+
- POSTGRES_USER=anyvlm
12+
- POSTGRES_PASSWORD=anyvlm-pw
13+
14+
anyvlm_test_db:
15+
image: postgres:17
16+
volumes:
17+
- anyvlm_test_vol:/var/lib/postgresql/data
18+
ports:
19+
- 127.0.0.1:5436:5432
20+
environment:
21+
- POSTGRES_DB=anyvlm_test
22+
- POSTGRES_USER=anyvlm_test
23+
- POSTGRES_PASSWORD=anyvlm-test-pw
24+
25+
volumes:
26+
anyvlm_vol:
27+
external: true
28+
anyvlm_test_vol:
29+
external: true

docs/Makefile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Minimal makefile for Sphinx documentation
2+
#
3+
4+
# You can set these variables from the command line, and also
5+
# from the environment for the first two.
6+
SPHINXOPTS ?=
7+
SPHINXBUILD ?= sphinx-build
8+
SOURCEDIR = source
9+
BUILDDIR = build
10+
11+
# Put it first so that "make" without argument is like "make help".
12+
help:
13+
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
14+
15+
.PHONY: help Makefile
16+
17+
# Catch-all target: route all unknown targets to Sphinx using the new
18+
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
19+
%: Makefile
20+
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

docs/source/conf.py

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# Configuration file for the Sphinx documentation builder.
2+
#
3+
# For the full list of built-in configuration values, see the documentation:
4+
# https://www.sphinx-doc.org/en/master/usage/configuration.html
5+
6+
# -- Project information -----------------------------------------------------
7+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
8+
9+
project = "anyvlm"
10+
author = "GenomicMedLab"
11+
html_title = "AnyVLM"
12+
13+
# -- General configuration ---------------------------------------------------
14+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
15+
16+
extensions = [
17+
"sphinx_rtd_theme",
18+
"sphinx.ext.autodoc",
19+
"sphinx_autodoc_typehints",
20+
"sphinx.ext.linkcode",
21+
"sphinx_copybutton",
22+
"sphinx.ext.autosummary",
23+
"sphinx_github_changelog",
24+
]
25+
26+
templates_path = ["_templates"]
27+
exclude_patterns = []
28+
29+
# -- Options for HTML output -------------------------------------------------
30+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
31+
32+
html_theme = "sphinx_rtd_theme"
33+
html_theme_options = {
34+
"collapse_navigation": False,
35+
}
36+
37+
# -- autodoc things ----------------------------------------------------------
38+
import os
39+
import sys
40+
41+
sys.path.insert(0, os.path.abspath("../../"))
42+
autodoc_preserve_defaults = True
43+
44+
# -- get version -------------------------------------------------------------
45+
from anyvlm import __version__ # noqa: E402
46+
47+
version = release = __version__
48+
49+
50+
# -- linkcode ----------------------------------------------------------------
51+
def linkcode_resolve(domain, info):
52+
if domain != "py":
53+
return None
54+
if not info["module"]:
55+
return None
56+
filename = info["module"].replace(".", "/")
57+
return f"https://github.com/genomicmedlab/anyvlm/blob/main/src/{filename}.py"
58+
59+
60+
# -- code block style --------------------------------------------------------
61+
pygments_style = "default"
62+
pygements_dark_style = "monokai"
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
Configuring Docker Compose
2+
!!!!!!!!!!!!!!!!!!!!!!!!!!
3+
4+
This page describes how to use the provided ``compose.yaml`` file to start AnyVLM alongside its dependencies, and highlights some configuration options you can customize for your environment.
5+
6+
Overview
7+
--------
8+
9+
The compose file defines four main services:
10+
11+
* ``anyvlm_db`` - PostgreSQL database for AnyVLM
12+
* ``anyvlm_test_db`` - PostgreSQL database for AnyVLM Tests
13+
14+
It also defines Docker volumes:
15+
16+
* ``anyvlm_vol`` - storage for the AnyVLM PostgreSQL data directory
17+
* ``anyvlm_test_vol`` - storage for the AnyVLM PostgreSQL Test data directory
18+
19+
These volumes are declared as ``external: true``, so it must exist before
20+
you run ``docker compose up``. For example:
21+
22+
.. code-block:: bash
23+
24+
docker volume create anyvlm_vol
25+
docker volume create anyvlm_test_vol
26+
27+
Running the stack
28+
-----------------
29+
30+
After creating the external volumes and configuring any optional environment variables, you can start the stack with:
31+
32+
.. code-block:: bash
33+
34+
docker compose up
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Example .env File
2+
!!!!!!!!!!!!!!!!!
3+
4+
.. literalinclude:: ../../../.env.example
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
Configuration
2+
!!!!!!!!!!!!!
3+
4+
This section details AnyVLM configuration. It is broken down into the following subsections:
5+
6+
* :doc:`Object Storage <storage>`: define database connection, alter table names, and set parameters for bulk processing
7+
* :doc:`Example .env file <dotenv_example>`: use a ``.env`` file to declare environment variables when running REST API service
8+
* :doc:`Docker Compose <docker_compose>`: edit the provided Docker Compose file to tailor it to your needs
9+
10+
.. toctree::
11+
:maxdepth: 2
12+
:hidden:
13+
14+
Storage<storage>
15+
Example .env file<dotenv_example>
16+
Docker Compose<docker_compose>
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
Object Storage Configuration
2+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!
3+
4+
Storage Connection
5+
==================
6+
7+
Use the ``ANYVLM_STORAGE_URI`` environment variable to pass a `libpq connection string <https://www.postgresql.org/docs/current/libpq.html>`_ to the PostgreSQL connection constructor.
8+
9+
.. list-table::
10+
:widths: 30 70
11+
:header-rows: 1
12+
13+
* - Environment Variable
14+
- Default Value
15+
* - ``ANYVLM_STORAGE_URI``
16+
- ``"postgresql://postgres@localhost:5432/anyvlm"``

docs/source/index.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
AnyVLM
2+
!!!!!!
3+
4+
.. toctree::
5+
:maxdepth: 2
6+
:caption: Contents
7+
:hidden:
8+
9+
Configuration<configuration/index>

pyproject.toml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,15 @@ dev = [
4646
"fastapi[standard]",
4747
"seqrepo-rest-service", # for generating SeqRepo-based tests fixtures
4848
]
49+
docs = [
50+
"sphinx==8.2.3",
51+
"sphinx_rtd_theme==3.0.2",
52+
"sphinx-autodoc-typehints==3.2.0",
53+
"sphinx-autobuild==2024.10.3",
54+
"sphinx-copybutton==0.5.2",
55+
"sphinxext-opengraph==0.10.0",
56+
"sphinx-github-changelog==1.7.1",
57+
]
4958

5059
[project.urls]
5160
Homepage = "https://github.com/genomicmedlab/anyvlm"
@@ -71,10 +80,14 @@ build-backend = "setuptools.build_meta"
7180
addopts = "--cov=anyvlm --cov-report term-missing"
7281
testpaths = ["tests"]
7382
pythonpath = ["src"]
83+
markers = [
84+
"ci_ok: tests safe to run in CI",
85+
]
7486

7587
[tool.ruff]
7688
src = ["src"]
7789
include = ["src/**/*.py", "tests/**/*.py"]
90+
exclude = ["docs/source/"]
7891

7992
[tool.ruff.lint]
8093
select = ["ALL"]

0 commit comments

Comments
 (0)