A Blackjack web application built with Streamlit, powered by the blackjack-engine package.
This project demonstrates the usage of the blackjack-engine package — a custom-built Python library that implements the core logic of the Blackjack card game, including deck management, hand evaluation, and game state handling.
The frontend is built with Streamlit, providing an interactive browser-based UI where players can place bets, hit, stand, and play through full rounds of Blackjack.
blackjack_demo/
├── .gitignore # Git ignore rules
├── .python-version # Python version pin for tooling
├── README.md # Project documentation
├── main.py # Streamlit UI — page layout, styling, and game interaction
├── pyproject.toml # Project metadata and dependencies managed by uv
└── uv.lock # Locked dependency versions generated by uv
main.py is responsible for all frontend presentation:
- Loads a background image and applies custom CSS styling
- Renders the header with player balance and a "New Game" button
- Handles bet input (including an All In option)
- Displays dealer and player cards during a round
- Supports Hit, Stand, Double Down, and Split actions
- Shows round results and allows continuing to the next round
All underlying game logic (deck, hand evaluation, game state) is handled by the blackjack-engine package.
- Interactive Blackjack gameplay in the browser
- Bet management with a starting balance
- Hit, Stand, Double Down, and Split support
- Powered by the
blackjack-enginepackage for all game logic
- uv package manager
1. Create a new project
uv init blackjack_demo
cd blackjack_demo2. Create and activate a virtual environment
uv venv
# Windows
.venv\Scripts\activate
# macOS/Linux
source .venv/bin/activate3. Install dependencies
uv add --default-index https://test.pypi.org/simple/ --index https://pypi.org/simple blackjack-engine
uv add streamlituv run streamlit run main.pyThe browser will open automatically at http://localhost:8501.
The core game logic is provided by the blackjack-engine package, published on TestPyPI:
https://test.pypi.org/project/blackjack-engine/