Skip to content

Commit ac45f4c

Browse files
authored
Merge pull request #142 from python-discord/jb3/dep-bumps
Bump Poetry Python version to 3.12
2 parents 06ae7a2 + 2078972 commit ac45f4c

File tree

10 files changed

+272
-275
lines changed

10 files changed

+272
-275
lines changed

.github/workflows/lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
- name: Install Python Dependencies
1414
uses: HassanAbouelela/actions/setup-python@setup-python_v1.4.2
1515
with:
16-
python_version: '3.11'
16+
python_version: '3.12'
1717

1818
- name: Run pre-commit hooks
1919
run: SKIP=ruff pre-commit run --all-files

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM --platform=linux/amd64 ghcr.io/owl-corp/python-poetry-base:3.11-slim
1+
FROM --platform=linux/amd64 ghcr.io/owl-corp/python-poetry-base:3.12-slim
22

33
ENV PYTHONHASHSEED=random
44

alembic/env.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,15 @@
3030

3131
config.set_main_option("sqlalchemy.url", build_db_uri())
3232

33+
3334
def do_run_migrations(connection: Connection) -> None:
3435
"""Run migrations."""
3536
context.configure(connection=connection, target_metadata=target_metadata)
3637

3738
with context.begin_transaction():
3839
context.run_migrations()
3940

41+
4042
async def run_async_migrations() -> None:
4143
"""Run migrations asynchronously using the asyncpg driver."""
4244
connectable = async_engine_from_config(
@@ -50,6 +52,7 @@ async def run_async_migrations() -> None:
5052

5153
await connectable.dispose()
5254

55+
5356
def run_migrations_offline() -> None:
5457
"""
5558
Run migrations in 'offline' mode.

create_metricity_db.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Ensures the metricity db exists before running migrations."""
2+
23
import asyncio
34
from urllib.parse import SplitResult, urlsplit
45

@@ -18,6 +19,7 @@ def parse_db_url(db_url: str) -> SplitResult:
1819
raise ValueError("The given db_url is not a valid PostgreSQL database URL.")
1920
return db_url_parts
2021

22+
2123
async def create_db() -> None:
2224
"""Create the Metricity database if it does not exist."""
2325
parts = parse_db_url(build_db_uri())
@@ -45,5 +47,8 @@ async def create_db() -> None:
4547

4648
await sys_conn.close()
4749

50+
4851
if __name__ == "__main__":
52+
loop = asyncio.new_event_loop()
53+
asyncio.set_event_loop(loop)
4954
asyncio.get_event_loop().run_until_complete(create_db())

docker-compose.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
version: "3.8"
2-
31
x-logging: &logging
42
driver: "json-file"
53
options:

metricity/database.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
log = logging.getLogger(__name__)
1414

15+
1516
def build_db_uri() -> str:
1617
"""Build the database uri from the config."""
1718
if DatabaseConfig.uri:
@@ -27,9 +28,11 @@ def build_db_uri() -> str:
2728
f"@{DatabaseConfig.host}:{DatabaseConfig.port}/{DatabaseConfig.database}"
2829
)
2930

31+
3032
engine: AsyncEngine = create_async_engine(build_db_uri(), echo=DatabaseConfig.log_queries)
3133
async_session = async_sessionmaker(engine, expire_on_commit=False)
3234

35+
3336
class TZDateTime(TypeDecorator):
3437
"""
3538
A db type that supports the use of aware datetimes in user-land.

metricity/exts/event_listeners/guild_listeners.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
log = logging.get_logger(__name__)
1818

19+
1920
class GuildListeners(commands.Cog):
2021
"""Listen for guild (and guild channel) events and sync them to the database."""
2122

metricity/exts/event_listeners/member_listeners.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,6 @@ async def on_member_update(self, _before: discord.Member, member: discord.Member
125125
await sess.commit()
126126

127127

128-
129128
async def setup(bot: Bot) -> None:
130129
"""Load the MemberListeners cog."""
131130
await bot.add_cog(MemberListeners(bot))

poetry.lock

Lines changed: 253 additions & 265 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,21 @@ authors = ["Joe Banks <joseph@josephbanks.me>"]
66
license = "MIT"
77

88
[tool.poetry.dependencies]
9-
python = "3.11.*"
9+
python = "3.12.*"
1010

1111
# See https://bot-core.pythondiscord.com/ for docs.
12-
pydis-core = "10.7.0"
12+
pydis-core = "11.1.0"
1313

1414
alembic = "1.13.1"
1515
coloredlogs = "15.0.1"
1616
deepmerge = "1.1.1"
17-
sqlalchemy = { extras = ["asyncio"], version = "2.0.25" }
17+
sqlalchemy = { extras = ["asyncio"], version = "2.0.29" }
1818
python-dotenv = "1.0.1"
1919
asyncpg = "0.29.0"
2020

2121
[tool.poetry.dev-dependencies]
22-
pre-commit = "3.6.0"
23-
ruff = "0.2.0"
22+
pre-commit = "3.7.0"
23+
ruff = "0.3.5"
2424

2525
[tool.poetry.scripts]
2626
start = "metricity.__main__:start"

0 commit comments

Comments
 (0)