Skip to content
This repository has been archived by the owner on Feb 22, 2023. It is now read-only.

Commit

Permalink
Use poetry==1.2.0b1 and switch to package groups
Browse files Browse the repository at this point in the history
Poetry 1.2.x introduces a new feature, package groups, which allows us
to split our dependencies much like how you might see projects use
requirements-*.txt or requirements/*.txt to split and/or bundle them
into groups.

Making this change required downgrading to SQLAlchemy==1.4 and
replacing psycopg with psycopg2 as I hit the following bug after
updating poetry: pypa/setuptools#3088

Once this is resolved (or an SQLAlchemy==2 release happens) we'll
return to using sqlalchemy2+psycopg.
  • Loading branch information
jcmdln committed Mar 19, 2022
1 parent c84ce94 commit 1921250
Show file tree
Hide file tree
Showing 9 changed files with 220 additions and 145 deletions.
31 changes: 25 additions & 6 deletions .github/workflows/lint.yaml
@@ -1,7 +1,27 @@
# SPDX-License-Identifier: AGPL-3.0-or-later
---
name: Lint

on: [push, pull_request, workflow_dispatch]
on:
pull_request:
paths:
- .github/workflows/lint.yaml
- poetry.lock
- pyproject.toml
- setup.cfg
- snagctl/**/*.py
- snagd/**/*.py
- snagd/db/alembic/script.py.mako
push:
paths:
- .github/workflows/lint.yaml
- poetry.lock
- pyproject.toml
- setup.cfg
- snagctl/**/*.py
- snagd/**/*.py
- snagd/db/alembic/script.py.mako
workflow_dispatch:

jobs:
test:
Expand All @@ -16,7 +36,6 @@ jobs:

steps:
- uses: actions/checkout@v2

- uses: actions/setup-python@v2
with:
python-version: "3.10"
Expand All @@ -26,11 +45,11 @@ jobs:
sudo apt-get update
sudo apt-get install -y git libpq-dev libsqlite3-dev python3-dev python3-wheel
# FIXME: poetry>=1.2,<2 once released
- name: Install python package dependencies
run: |
pip install poetry tox
poetry install
pip install poetry==1.2.0b1
poetry install --only tox
- name: Run ${{ matrix.name }}
run: |
poetry run tox -e ${{ matrix.name }}
run: poetry run tox -e ${{ matrix.name }}
19 changes: 11 additions & 8 deletions Dockerfile
Expand Up @@ -5,33 +5,36 @@ ENV PYTHONDONTWRITEBYTECODE="true" \
PYTHONPYCACHEPREFIX="/tmp" \
PYTHONUNBUFFERED="true"
RUN dnf --refresh -y upgrade && \
dnf -y install libpq openssl poetry sqlite && \
dnf -y install libpq openssl sqlite && \
dnf -y autoremove && \
dnf clean all && \
ln -sf /usr/share/zoneinfo/UTC /etc/localtime
dnf clean all
RUN ln -sf /usr/share/zoneinfo/UTC /etc/localtime


FROM core AS build
RUN dnf --refresh -y install \
automake cargo cmake gcc-c++ git meson ninja-build patchelf rust \
libpq-devel openssl-devel python3-devel python3-wheel sqlite-devel
libpq-devel openssl-devel python3-devel sqlite-devel
COPY . /opt/snagem
WORKDIR /opt/snagem
RUN python3 -m venv --upgrade-deps /opt/snagem/.venv
ENV PATH="/opt/snagem/.venv/bin:$PATH"
RUN poetry install --no-dev
# FIXME: poetry>=1.2,<2 once released
RUN pip install poetry==1.2.0b1
WORKDIR /opt/snagem


FROM build as build-release
RUN poetry install --only default

FROM core AS release
COPY --from=build --chown=root:root /opt/snagem/.venv /opt/snagem/.venv
COPY --from=build-release --chown=root:root /opt/snagem/.venv /opt/snagem/.venv
ENV PATH="/opt/snagem/.venv/bin:$PATH"
CMD ["snagd"]


FROM build as build-devel
RUN poetry install


FROM core as devel
COPY --from=build-devel --chown=root:root /opt/snagem /opt/snagem
ENV PATH="/opt/snagem/.venv/bin:$PATH"
Expand Down
23 changes: 7 additions & 16 deletions README.md
@@ -1,5 +1,5 @@
`snagem` provides a simple way to track, retrieve, and manage content from sites supported by
[youtube-dl](https://github.com/ytdl-org/youtube-dl) so it may be enjoyed on your schedule.
`snagem` provides a simple way to track, retrieve and manage content so it may be enjoyed on your
schedule.

See the following for subcomponent documentation:
* [snagctl](./snagctl/README.md)
Expand All @@ -8,12 +8,14 @@ See the following for subcomponent documentation:

Quickstart
---
This section outlines how to quickly run Snagem.
This section outlines how to quickly run snagem using Fedora 35 as an example.

### Local
```sh
$ sudo dnf --refresh -y install libpq-devel git poetry python3-devel sqlite-devel
$ poetry install --no-dev
$ sudo dnf --refresh -y install git libpq-devel python3-devel sqlite-devel
# FIXME: poetry>=1.2,<2 once released
$ pip install poetry==1.2.0b1
$ poetry install --only default
$ poetry run snagd
INFO: Started server process [$PID]
INFO: Waiting for application startup.
Expand All @@ -31,14 +33,3 @@ INFO: Waiting for application startup.
INFO: Application startup complete.
INFO: Uvicorn running on http://127.0.0.1:5050 (Press CTRL+C to quit)
```


Contributing
---
### Getting Started
* https://fastapi.tiangolo.com/tutorial/
* https://docs.sqlalchemy.org/en/20/tutorial/index.html
* https://pydantic-docs.helpmanual.io/
* https://alembic.sqlalchemy.org/en/latest/tutorial.html
* https://docs.celeryproject.org/en/stable/getting-started/index.html
* https://docs.celeryproject.org/projects/kombu/en/stable/introduction.html

0 comments on commit 1921250

Please sign in to comment.