Skip to content

Commit 030d15e

Browse files
Merge pull request #135 from python-discord/poetry-1.2.0
Bump poetry to 1.2.0 in CI & the example project
2 parents 127d0ef + 0293d7c commit 030d15e

File tree

6 files changed

+31
-29
lines changed

6 files changed

+31
-29
lines changed

.github/workflows/docs.yaml

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ concurrency:
1111
group: docs-deployment-${{ github.ref }}
1212
cancel-in-progress: true
1313

14-
1514
jobs:
1615
latest-build:
1716
# We only need to verify that the docs build with no warnings here
@@ -22,16 +21,12 @@ jobs:
2221
- uses: actions/checkout@v2
2322

2423
- name: Install Python Dependencies
25-
uses: HassanAbouelela/actions/setup-python@setup-python_v1.1.0
24+
uses: HassanAbouelela/actions/setup-python@setup-python_v1.3.1
2625
with:
2726
dev: true
2827
python_version: "3.10"
2928
install_args: "--extras async-rediscache"
3029

31-
# Undeclared dependency for `releases`... whoops
32-
# https://github.com/bitprophet/releases/pull/82
33-
- run: pip install six
34-
3530
- name: Generate HTML Site
3631
run: sphinx-build -nW -j auto -b html docs docs/build
3732

@@ -51,16 +46,12 @@ jobs:
5146
fetch-depth: 0 # We need to check out the entire repository to find all tags
5247

5348
- name: Install Python Dependencies
54-
uses: HassanAbouelela/actions/setup-python@setup-python_v1.1.0
49+
uses: HassanAbouelela/actions/setup-python@setup-python_v1.3.1
5550
with:
5651
dev: true
5752
python_version: "3.10"
5853
install_args: "--extras async-rediscache"
5954

60-
# Undeclared dependency for `releases`... whoops
61-
# https://github.com/bitprophet/releases/pull/82
62-
- run: pip install six
63-
6455
- name: Build All Doc Versions
6556
run: sphinx-multiversion docs docs/build -n -j auto
6657
env:

.github/workflows/lint-test.yaml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,19 @@ jobs:
1414
lint:
1515
name: Run Linting & Test Suites
1616
runs-on: ubuntu-latest
17-
1817
steps:
1918
- name: Install Python Dependencies
20-
uses: HassanAbouelela/actions/setup-python@setup-python_v1.1.0
19+
uses: HassanAbouelela/actions/setup-python@setup-python_v1.3.1
2120
with:
2221
# Set dev=true to run pre-commit which is a dev dependency
2322
dev: true
2423
python_version: "3.10"
2524
install_args: "--extras async-rediscache"
2625

2726
# We will not run `flake8` here, as we will use a separate flake8
28-
# action. As pre-commit does not support user installs, we set
29-
# PIP_USER=0 to not do a user install.
27+
# action.
3028
- name: Run pre-commit hooks
31-
run: export PIP_USER=0; SKIP=flake8 pre-commit run --all-files
29+
run: SKIP=flake8 pre-commit run --all-files
3230

3331
# Run flake8 and have it format the linting errors in the format of
3432
# the GitHub Workflow command to register error annotations. This

dev/Dockerfile

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,14 @@
1-
FROM python:3.10-slim
1+
FROM --platform=linux/amd64 ghcr.io/chrislovering/python-poetry-base:3.10-slim
22

3-
# Set pip to have no saved cache
4-
ENV PIP_NO_CACHE_DIR=false \
5-
POETRY_VIRTUALENVS_CREATE=false
6-
7-
# Install poetry
8-
RUN pip install -U poetry
9-
10-
WORKDIR /app
113

124
# Install project dependencies
5+
WORKDIR /app
136
COPY pyproject.toml poetry.lock ./
147
RUN poetry install --no-root
158

169
# Copy the source code in last to optimize rebuilding the image
1710
COPY . .
11+
1812
# Install again, this time with the root project
1913
RUN poetry install
2014

dev/README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ Option 2
4040
3. Configure the environment variables used by the program.
4141
You can set them in an ``.env`` file in the project root directory. The variables are:
4242

43-
- ``TOKEN`` (required): Discord bot token, with all intents enabled
43+
- ``BOT_TOKEN`` (required): Discord bot token, with all intents enabled
4444
- ``GUILD_ID`` (required): The guild the bot should monitor
4545
- ``PREFIX``: The prefix to use for invoking bot commands. Defaults to mentions and ``!``
4646
- ``ALLOWED_ROLES``: A comma seperated list of role IDs which the bot is allowed to mention

dev/bot/__main__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,6 @@ async def main() -> None:
2929
"""Run the bot."""
3030
bot.http_session = aiohttp.ClientSession()
3131
async with bot:
32-
await bot.start(os.getenv("TOKEN"))
32+
await bot.start(os.getenv("BOT_TOKEN"))
3333

3434
asyncio.run(main())

docker-compose.yaml

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,20 @@ services:
1919
timeout: 1s
2020
retries: 5
2121

22+
metricity:
23+
restart: on-failure
24+
depends_on:
25+
postgres:
26+
condition: service_healthy
27+
image: ghcr.io/python-discord/metricity:latest
28+
env_file:
29+
- .env
30+
environment:
31+
DATABASE_URI: postgres://pysite:pysite@postgres/metricity
32+
USE_METRICITY: ${USE_METRICITY-false}
33+
volumes:
34+
- .:/tmp/bot:ro
35+
2236
redis:
2337
<< : *restart_policy
2438
image: redis:5.0.9
@@ -46,15 +60,20 @@ services:
4660
METRICITY_DB_URL: postgres://pysite:pysite@postgres:5432/metricity
4761
SECRET_KEY: suitable-for-development-only
4862
STATIC_ROOT: /var/www/static
63+
depends_on:
64+
- metricity
4965

5066
bot:
5167
<< : *restart_policy
5268
build:
5369
context: .
5470
dockerfile: dev/Dockerfile
55-
volumes:
56-
- .:/app:ro
71+
volumes: # Don't do .:/app here to ensure project venv from host doens't overwrite venv in image
72+
- ./botcore:/app/botcore:ro
73+
- ./bot:/app/bot:ro
5774
tty: true
75+
depends_on:
76+
- web
5877
env_file:
5978
- .env
6079
environment:

0 commit comments

Comments
 (0)