refactor!: use SQLite and SQLAlchemy for database backend (#332)

* use sqlite + sqlalchemy as a database backend

* change entries getter

* page filterstate.page_size persistent

* add test for entry.id filter

* fix closing library

* fix tag search, adding field

* add field position

* add fields reordering

* use folder

* take field position into consideration

* fix adding tag

* fix test

* try to catch the correct exception, moron

* dont expunge subtags

* DRY models

* rename LibraryField, add is_default property

* remove field.position unique constraint
This commit is contained in:
yed
2024-09-09 12:06:01 +07:00
committed by GitHub
parent 67f7e4dcf9
commit e5e7b8afc6
85 changed files with 4803 additions and 6752 deletions

View File

@@ -1,51 +0,0 @@
name: PySide App Test
on: [ push, pull_request ]
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
cache: 'pip'
- name: Install system dependencies
run: |
# dont run update, it is slow
# sudo apt-get update
sudo apt-get install -y --no-install-recommends \
libxkbcommon-x11-0 \
x11-utils \
libyaml-dev \
libegl1-mesa \
libxcb-icccm4 \
libxcb-image0 \
libxcb-keysyms1 \
libxcb-randr0 \
libxcb-render-util0 \
libxcb-xinerama0 \
libopengl0 \
libxcb-cursor0 \
libpulse0
- name: Install dependencies
run: |
pip install -Ur requirements.txt
- name: Run TagStudio app and check exit code
run: |
xvfb-run --server-args="-screen 0, 1920x1200x24 -ac +extension GLX +render -noreset" python tagstudio/tag_studio.py --ci -o /tmp/
exit_code=$?
if [ $exit_code -eq 0 ]; then
echo "TagStudio ran successfully"
else
echo "TagStudio failed with exit code $exit_code"
exit 1
fi

View File

@@ -24,7 +24,7 @@ jobs:
- name: Install dependencies
run: |
pip install -r requirements.txt
pip install mypy==1.10.0
pip install mypy==1.11.2
mkdir tagstudio/.mypy_cache
- uses: tsuyoshicho/action-mypy@v4

View File

@@ -1,6 +1,6 @@
name: pytest
on: [push, pull_request]
on: [ push, pull_request ]
jobs:
pytest:
@@ -11,12 +11,64 @@ jobs:
- name: Checkout repo
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
cache: 'pip'
- name: Install system dependencies
run: |
# dont run update, it is slow
# sudo apt-get update
sudo apt-get install -y --no-install-recommends \
libxkbcommon-x11-0 \
x11-utils \
libyaml-dev \
libegl1-mesa \
libxcb-icccm4 \
libxcb-image0 \
libxcb-keysyms1 \
libxcb-randr0 \
libxcb-render-util0 \
libxcb-xinerama0 \
libopengl0 \
libxcb-cursor0 \
libpulse0
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -r requirements-dev.txt
python -m pip install --upgrade uv
uv pip install --system -r requirements.txt
uv pip install --system -r requirements-dev.txt
- name: Run tests
- name: Run pytest
run: |
pytest tagstudio/tests/
xvfb-run pytest --cov-report xml --cov=tagstudio
- name: Store coverage
uses: actions/upload-artifact@v4
with:
name: 'coverage'
path: 'coverage.xml'
coverage:
name: Check Code Coverage
runs-on: ubuntu-latest
needs: pytest
steps:
- name: Load coverage
uses: actions/download-artifact@v4
with:
name: 'coverage'
- name: Check Code Coverage
uses: yedpodtrzitko/coverage@main
with:
thresholdAll: 0.5
thresholdNew: 0.5
thresholdModified: 0.5
coverageFile: coverage.xml
token: ${{ secrets.GITHUB_TOKEN }}
sourceDir: tagstudio/src

View File

@@ -1,11 +1,20 @@
name: Ruff
on: [ push, pull_request ]
jobs:
ruff:
ruff-format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: chartboost/ruff-action@v1
with:
version: 0.4.2
version: 0.6.4
args: 'format --check'
ruff-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: chartboost/ruff-action@v1
with:
version: 0.6.4
args: 'check'