Skip to content

Commit f8c2b70

Browse files
authored
chore: try to make railway happy even though local is happy (#101)
1 parent fe4de8a commit f8c2b70

File tree

12 files changed

+55
-352
lines changed

12 files changed

+55
-352
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
uses: astral-sh/setup-uv@v3
1717

1818
- name: Set up Python
19-
run: uv python install 3.11
19+
run: uv python install 3.12
2020

2121
- name: Create virtual environment
2222
run: uv sync --all-extras --dev
@@ -50,7 +50,7 @@ jobs:
5050
uses: astral-sh/setup-uv@v3
5151

5252
- name: Set up Python
53-
run: uv python install 3.11
53+
run: uv python install 3.12
5454

5555
- name: Create virtual environment
5656
run: uv sync --all-extras --dev
@@ -76,7 +76,7 @@ jobs:
7676
uses: astral-sh/setup-uv@v3
7777

7878
- name: Set up Python
79-
run: uv python install 3.11
79+
run: uv python install 3.12
8080

8181
- name: Create virtual environment
8282
run: uv sync --all-extras --dev

.github/workflows/docs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
uses: astral-sh/setup-uv@v3
2525

2626
- name: Set up Python
27-
run: uv python install 3.11
27+
run: uv python install 3.12
2828

2929
- name: Install dependencies
3030
run: uv sync --all-extras --dev

.prettierignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
*.min.*
22
.git/COMMIT_EDITMSG
3+
style.css

.python-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.11
1+
3.12

.sourcery.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ rule_settings:
1515
- refactoring
1616
- suggestion
1717
- comment
18-
python_version: "3.11"
18+
python_version: "3.12"
1919

2020
rules: []
2121

.tool-versions

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
python 3.11
21
python 3.12

byte_bot/byte/plugins/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""Pluggable modules for Byte."""
22

3-
from byte_bot.byte.plugins import admin, astral, custom, events, forums, general, github, python, testing
3+
from . import admin, astral, custom, events, forums, general, github, python, testing
44

55
__all__ = [
66
"admin",

byte_bot/byte/plugins/admin.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313

1414
__all__ = ("AdminCommands", "setup")
1515

16-
from byte_bot.byte.lib.checks import is_byte_dev
1716
from byte_bot.byte.lib import settings
17+
from byte_bot.byte.lib.checks import is_byte_dev
1818
from byte_bot.byte.lib.log import get_logger
1919
from byte_bot.server.lib.settings import ServerSettings
2020

@@ -101,47 +101,47 @@ async def tree_sync(self, interaction: Interaction) -> None:
101101
@is_byte_dev()
102102
async def bootstrap_guild(self, ctx: Context, guild_id: int | None = None) -> None:
103103
"""Bootstrap an existing guild to the database.
104-
104+
105105
Args:
106106
ctx: Context object.
107107
guild_id: Guild ID to bootstrap. If not provided, uses current guild.
108108
"""
109109
guild = await self._get_target_guild(ctx, guild_id)
110110
if not guild:
111111
return
112-
112+
113113
await ctx.send(f"🔄 Bootstrapping guild {guild.name} (ID: {guild.id})...")
114-
114+
115115
await self._sync_guild_commands(guild)
116116
await self._register_guild_in_database(ctx, guild)
117117

118118
async def _get_target_guild(self, ctx: Context, guild_id: int | None) -> discord.Guild | None:
119119
"""Get the target guild for bootstrapping."""
120120
target_guild_id = guild_id or (ctx.guild.id if ctx.guild else None)
121-
121+
122122
if not target_guild_id:
123123
await ctx.send("❌ No guild ID provided and command not used in a guild.")
124124
return None
125-
125+
126126
guild = self.bot.get_guild(target_guild_id)
127127
if not guild:
128128
await ctx.send(f"❌ Bot is not in guild with ID {target_guild_id}")
129129
return None
130-
130+
131131
return guild
132132

133133
async def _sync_guild_commands(self, guild: discord.Guild) -> None:
134134
"""Sync commands to the guild."""
135135
try:
136136
await self.bot.tree.sync(guild=guild)
137137
logger.info("Commands synced to guild %s (id: %s)", guild.name, guild.id)
138-
except Exception as e:
139-
logger.error("Failed to sync commands to guild %s: %s", guild.name, e)
138+
except Exception:
139+
logger.exception("Failed to sync commands to guild %s", guild.name)
140140

141141
async def _register_guild_in_database(self, ctx: Context, guild: discord.Guild) -> None:
142142
"""Register guild in database via API."""
143143
api_url = f"http://{server_settings.HOST}:{server_settings.PORT}/api/guilds/create?guild_id={guild.id}&guild_name={guild.name}"
144-
144+
145145
try:
146146
async with httpx.AsyncClient() as client:
147147
response = await client.post(api_url)
@@ -180,11 +180,11 @@ async def _notify_dev_channel(self, guild: discord.Guild) -> None:
180180
dev_guild = self.bot.get_guild(settings.discord.DEV_GUILD_ID)
181181
if not dev_guild:
182182
return
183-
183+
184184
dev_channel = dev_guild.get_channel(settings.discord.DEV_GUILD_INTERNAL_ID)
185185
if not dev_channel or not hasattr(dev_channel, "send"):
186186
return
187-
187+
188188
embed = discord.Embed(
189189
title="Guild Bootstrapped",
190190
description=f"Guild {guild.name} (ID: {guild.id}) was manually bootstrapped",

byte_bot/cli.py

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@
2626

2727
def frontend() -> None:
2828
"""Run the tailwind compiler."""
29+
if settings.project.ENVIRONMENT == "prod" or not settings.project.DEV_MODE:
30+
logger.info("🎨 Skipping Tailwind Compiler in production environment.")
31+
return
32+
2933
log.config.configure()
3034
logger.info("🎨 Starting Tailwind Compiler.")
3135
try:
@@ -198,15 +202,18 @@ def run_all(
198202
"""Runs both the bot and the web server."""
199203
bot_process = multiprocessing.Process(target=bot)
200204
web_process = multiprocessing.Process(target=web, args=(host, port, http_workers, reload, verbose, debug))
201-
frontend_process = multiprocessing.Process(target=frontend)
202205

203-
bot_process.start()
204-
web_process.start()
205-
frontend_process.start()
206+
processes = [bot_process, web_process]
206207

207-
bot_process.join()
208-
web_process.join()
209-
frontend_process.join()
208+
if settings.project.ENVIRONMENT != "prod" and settings.project.DEV_MODE:
209+
frontend_process = multiprocessing.Process(target=frontend)
210+
processes.append(frontend_process)
211+
212+
for process in processes:
213+
process.start()
214+
215+
for process in processes:
216+
process.join()
210217

211218

212219
def _convert_uvicorn_args(args: dict[str, Any]) -> list[str]:

pyproject.toml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,17 @@ dependencies = [
2020
"alembic>=1.13.0",
2121
"pre-commit>=3.6.2",
2222
"ruff>=0.1.7",
23+
"python-dateutil>=2.9.0.post0",
2324
]
24-
requires-python = ">=3.11,<4.0"
25+
requires-python = ">=3.12,<4.0"
2526
#readme = "README.md"
2627
license = { text = "MIT" }
2728
classifiers = [
2829
'Development Status :: 2 - Pre-Alpha',
2930
'Programming Language :: Python',
3031
'Programming Language :: Python :: 3',
3132
'Programming Language :: Python :: 3 :: Only',
32-
'Programming Language :: Python :: 3.11',
33+
'Programming Language :: Python :: 3.12',
3334
'Intended Audience :: Developers',
3435
'Intended Audience :: Information Technology',
3536
'Intended Audience :: System Administrators',
@@ -138,7 +139,7 @@ exclude = [
138139
"tools",
139140
"docs",
140141
]
141-
pythonVersion = "3.11"
142+
pythonVersion = "3.12"
142143
reportOptionalMemberAccess = false
143144
reportUnknownMemberType = false
144145
reportGeneralTypeIssues = true

0 commit comments

Comments
 (0)