Skip to content
This repository has been archived by the owner on Apr 29, 2024. It is now read-only.

Commit

Permalink
Updated files to match project template (#21)
Browse files Browse the repository at this point in the history
  • Loading branch information
spietras authored Oct 18, 2022
1 parent 0d18ff7 commit 3c6f37e
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 89 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.9.7"
python-version: "3.10.6"
- name: Set up pip cache
run: python3 -m pip config set global.cache-dir ${{ env.PIP_CACHE_DIR }}
- name: Install mkdocs
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pypi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.9.7"
python-version: "3.10.6"
- name: Set up pip cache
run: python3 -m pip config set global.cache-dir ${{ env.PIP_CACHE_DIR }}
- name: Install poetry
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-multiplatform.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.9.7"
python-version: "3.10.6"
- name: Set up pip cache
run: python3 -m pip config set global.cache-dir ${{ env.PIP_CACHE_DIR }}
- name: Install poetry
Expand Down
23 changes: 10 additions & 13 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,14 @@ WORKDIR /app/

# install poetry
COPY ./requirements.txt ./requirements.txt
RUN python3 -m pip install --no-cache-dir -r ./requirements.txt
RUN --mount=type=cache,target=/root/.cache \
python3 -m pip install -r ./requirements.txt

# create new environment
# see: https://jcristharif.com/conda-docker-tips.html
# warning: for some reason conda can hang on "Executing transaction" for a couple of minutes
COPY environment.yaml ./environment.yaml
RUN conda env create -f ./environment.yaml && \
conda clean -afy && \
find /opt/conda/ -follow -type f -name '*.a' -delete && \
find /opt/conda/ -follow -type f -name '*.pyc' -delete && \
find /opt/conda/ -follow -type f -name '*.js.map' -delete
RUN --mount=type=cache,target=/opt/conda/pkgs \
conda env create -f ./environment.yaml

# "activate" environment for all commands (note: ENTRYPOINT is separate from SHELL)
SHELL ["conda", "run", "--no-capture-output", "-n", "kilroy-face-twitter", "/bin/bash", "-c"]
Expand All @@ -28,9 +25,9 @@ COPY ./kilroy_face_twitter/pyproject.toml ./kilroy_face_twitter/poetry.lock ./

FROM base AS test

# install dependencies only (notice that no source code is present yet) and delete cache
RUN poetry install --no-root --only main,test && \
rm -rf ~/.cache/pypoetry
# install dependencies only (notice that no source code is present yet)
RUN --mount=type=cache,target=/root/.cache \
poetry install --no-root --only main,test

# add source, tests and necessary files
COPY ./kilroy_face_twitter/src/ ./src/
Expand All @@ -51,9 +48,9 @@ CMD []

FROM base AS production

# install dependencies only (notice that no source code is present yet) and delete cache
RUN poetry install --no-root --only main && \
rm -rf ~/.cache/pypoetry
# install dependencies only (notice that no source code is present yet)
RUN --mount=type=cache,target=/root/.cache \
poetry install --no-root --only main

# add source and necessary files
COPY ./kilroy_face_twitter/src/ ./src/
Expand Down
7 changes: 5 additions & 2 deletions environment.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
name: kilroy-face-twitter
channels:
- defaults
- conda-forge
dependencies:
- python==3.9.7
- pip==21.2.4
- python==3.10.6
- pip==22.2.2
83 changes: 15 additions & 68 deletions kilroy_face_twitter/poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions kilroy_face_twitter/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "kilroy-face-twitter"
version = "0.5.0"
version = "0.5.1"
description = "kilroy face for Twitter 🐦"
readme = "README.md"
authors = ["kilroy <kilroymail@pm.me>"]
Expand All @@ -10,7 +10,7 @@ repository = "https://github.com/kilroybot/kilroy-face-twitter"
documentation = "https://kilroybot.github.io/kilroy-face-twitter"

[tool.poetry.dependencies]
python = "^3.9"
python = "^3.10"
pydantic = { version = "^1.10", extras = ["dotenv"] }
omegaconf = "^2.2"
typer = { version = "^0.6", extras = ["all"] }
Expand Down Expand Up @@ -42,7 +42,7 @@ kilroy-face-twitter-fetch-model = "kilroy_face_twitter.toxicity:fetch_model"

[tool.black]
line-length = 79
target-version = ['py39']
target-version = ['py310']

[tool.poe]
verbosity = -1
Expand Down

0 comments on commit 3c6f37e

Please sign in to comment.