Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace requirements.txt with Pipfile #194

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,17 @@ jobs:
python-version: 3.7
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pylint pylint-exit pytest
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
pip install pipenv
pipenv install --deploy --dev
- name: Setup flake8 annotations
uses: rbialon/flake8-annotations@v1
- name: Add pylint annotator
uses: pr-annotators/pylint-pr-annotator@v0.0.1
- name: Lint with flake8 and pylint
run: |
flake8 .
pylint PlexAniSync.py TautulliSyncHelper.py ./plexanisync || pylint-exit --error-fail --warn-fail $?
- run: pytest
pipenv run flake8 .
pipenv run pylint PlexAniSync.py TautulliSyncHelper.py ./plexanisync || pipenv run pylint-exit --error-fail --warn-fail $?
- run: pipenv run pytest

build-docker-plexanisync:
needs: lint-and-test
Expand Down
15 changes: 7 additions & 8 deletions Docker/PlexAniSync/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,24 +1,23 @@
FROM python:3.11 AS builder

RUN pip install pipenv
RUN apt-get update && \
apt-get install -y \
build-essential \
&& apt-get clean && rm -rf /var/lib/apt/lists/*

COPY requirements.txt .
# install dependencies to the local user directory (eg. /root/.local)
RUN pip install --user --no-warn-script-location -r requirements.txt
COPY Pipfile Pipfile.lock /
# Create /.venv with dependencies
RUN PIPENV_VENV_IN_PROJECT=1 pipenv install --deploy

FROM python:3.11-slim

WORKDIR /plexanisync

# copy only the dependencies installation from the 1st stage image
COPY --from=builder /root/.local /root/.local
RUN chmod -R a+rX /root
# Copy virtual env from builder
COPY --from=builder /.venv /.venv
# update PATH environment variable
ENV PATH=/root/.local:$PATH
ENV PYTHONPATH=/root/.local/lib/python3.11/site-packages
ENV PATH="/.venv/bin:$PATH"

ENV PLEX_SECTION=Anime \
PLEX_URL=http://127.0.0.1:32400 \
Expand Down
15 changes: 7 additions & 8 deletions Docker/Tautulli/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,24 +1,23 @@
FROM python:3.9 AS builder

RUN pip install pipenv
RUN apt-get update && \
apt-get install -y \
build-essential \
&& apt-get clean && rm -rf /var/lib/apt/lists/*

COPY requirements.txt .
# install dependencies to the local user directory (eg. /root/.local)
RUN pip install --user --no-warn-script-location -r requirements.txt
COPY Pipfile Pipfile.lock /
# Create /.venv with dependencies
RUN PIPENV_VENV_IN_PROJECT=1 pipenv install --deploy

FROM tautulli/tautulli

WORKDIR /plexanisync

# copy only the dependencies installation from the 1st stage image
COPY --from=builder /root/.local /root/.local
RUN chmod -R a+rX /root
# Copy virtual env from builder
COPY --from=builder /.venv /.venv
# update PATH environment variable
ENV PATH=/root/.local:$PATH
ENV PYTHONPATH=/root/.local/lib/python3.9/site-packages
ENV PATH="/.venv/bin:$PATH"

ENV PLEX_SECTION=Anime \
PLEX_URL=http://127.0.0.1:32400 \
Expand Down
21 changes: 21 additions & 0 deletions Pipfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"

[packages]
coloredlogs = "*"
jsonschema = "~=4.17"
plexapi = "~=4.13"
requests = "*"
ruyaml = "~=0.91"
sgqlc = "~=16.1"
inflect = "*"

[dev-packages]
flake8 = "*"
pylint = "*"
pylint-exit = "*"
pytest = "*"

[requires]
572 changes: 572 additions & 0 deletions Pipfile.lock

Large diffs are not rendered by default.

9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,16 +132,19 @@ access_token = iLikeToastyGoblins.

### Step 4 - Install requirements

Install the addtional requirements using the Python package installer (pip) from within the project folder:
Install the addtional requirements using the Python package installer (pip) and pipenv from within the project folder:

`pip install -r requirements.txt`
```
pip install pipenv
pipenv install
```


### Step 5 - Start syncing

Now that configuration is finished and requirements have been installed we can finally start the sync script:

`python PlexAniSync.py`
`pipenv run python PlexAniSync.py`

Depending on library size and server can take a few minutes to finish, for scheduled syncing you can create a cronjob, systemd timer or windows task which runs it every 30 minutes for instance.

Expand Down
16 changes: 0 additions & 16 deletions requirements.txt

This file was deleted.