legomaheggo Claude Opus 4.6 commited on
Commit
71df507
·
1 Parent(s): a9b6601

feat: Prepare for Hugging Face Spaces deployment

Browse files

- Add HF Spaces YAML frontmatter to README (sdk: streamlit, app_file, python_version)
- Strip dev dependencies from requirements.txt for leaner cloud installs
- Add st.secrets → env var bridge in settings.py for platform portability
- Add runtime.txt pinning Python 3.12

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

Files changed (4) hide show
  1. README.md +11 -0
  2. requirements.txt +2 -14
  3. runtime.txt +1 -0
  4. src/config/settings.py +15 -0
README.md CHANGED
@@ -1,3 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
1
  # Devil's Dozen 🎲
2
 
3
  A medieval-themed multiplayer dice game supporting 2-4 players across two distinct game modes.
 
1
+ ---
2
+ title: Devil's Dozen
3
+ emoji: 🎲
4
+ colorFrom: red
5
+ colorTo: yellow
6
+ sdk: streamlit
7
+ app_file: src/ui/app.py
8
+ python_version: "3.12"
9
+ pinned: false
10
+ ---
11
+
12
  # Devil's Dozen 🎲
13
 
14
  A medieval-themed multiplayer dice game supporting 2-4 players across two distinct game modes.
requirements.txt CHANGED
@@ -1,5 +1,5 @@
1
- # Devil's Dozen - Dependencies
2
- # Python 3.11+ required
3
 
4
  # Core Framework
5
  streamlit>=1.32.0
@@ -15,15 +15,3 @@ pydantic-settings>=2.2.0
15
  # UI Enhancements
16
  streamlit-lottie>=0.0.5
17
  Pillow>=10.2.0
18
-
19
- # Testing
20
- pytest>=8.0.0
21
- pytest-cov>=4.1.0
22
- pytest-asyncio>=0.23.0
23
-
24
- # Type Checking
25
- mypy>=1.8.0
26
-
27
- # Development
28
- black>=24.2.0
29
- isort>=5.13.0
 
1
+ # Devil's Dozen - Production Dependencies
2
+ # Python 3.12+ required
3
 
4
  # Core Framework
5
  streamlit>=1.32.0
 
15
  # UI Enhancements
16
  streamlit-lottie>=0.0.5
17
  Pillow>=10.2.0
 
 
 
 
 
 
 
 
 
 
 
 
runtime.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ python-3.12
src/config/settings.py CHANGED
@@ -2,13 +2,27 @@
2
  Devil's Dozen - Application Settings
3
 
4
  Loads configuration from environment variables using Pydantic Settings.
 
5
  """
6
 
 
7
  from functools import lru_cache
8
 
9
  from pydantic_settings import BaseSettings
10
 
11
 
 
 
 
 
 
 
 
 
 
 
 
 
12
  class Settings(BaseSettings):
13
  """Application settings loaded from environment variables."""
14
 
@@ -32,4 +46,5 @@ class Settings(BaseSettings):
32
  @lru_cache(maxsize=1)
33
  def get_settings() -> Settings:
34
  """Cached singleton settings instance."""
 
35
  return Settings()
 
2
  Devil's Dozen - Application Settings
3
 
4
  Loads configuration from environment variables using Pydantic Settings.
5
+ On Streamlit Cloud, bridges st.secrets into env vars so Pydantic can read them.
6
  """
7
 
8
+ import os
9
  from functools import lru_cache
10
 
11
  from pydantic_settings import BaseSettings
12
 
13
 
14
+ def _load_streamlit_secrets() -> None:
15
+ """Bridge Streamlit Cloud secrets into environment variables."""
16
+ try:
17
+ import streamlit as st
18
+
19
+ for key in ("SUPABASE_URL", "SUPABASE_ANON_KEY", "DEBUG", "LOG_LEVEL", "ENABLE_SOUNDS"):
20
+ if key not in os.environ and key in st.secrets:
21
+ os.environ[key] = str(st.secrets[key])
22
+ except Exception:
23
+ pass
24
+
25
+
26
  class Settings(BaseSettings):
27
  """Application settings loaded from environment variables."""
28
 
 
46
  @lru_cache(maxsize=1)
47
  def get_settings() -> Settings:
48
  """Cached singleton settings instance."""
49
+ _load_streamlit_secrets()
50
  return Settings()