Skip to content

chaojin101/python-project-template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AI Trade Bot - Python Project Template

A modern, robust Python project template designed for building AI-driven trading bots. This template comes pre-configured with industry-standard tools for linting, formatting, testing, and automated environment management.

Key Features

  • Automated Environment Setup: Uses run.sh to automatically create a virtual environment, install dependencies, and run the application.
  • Modern Linting & Formatting: Powered by Ruff, configured in pyproject.toml for lightning-fast code quality checks.
  • Pre-commit Hooks: Automated checks on every commit via .pre-commit-config.yaml to ensure code consistency.
  • Testing Framework: Ready-to-use pytest configuration with example tests in the tests/ directory.
  • Clean Structure: Organized directory layout following Python best practices.

Project Structure

ai-trade-bot/
├── src/                # Source code
│   ├── __init__.py
│   └── main.py         # Entry point
├── tests/              # Test suite
│   ├── __init__.py
│   └── test_main.py
├── .gitignore          # Standard Python git ignore rules
├── .pre-commit-config.yaml # Pre-commit hook definitions
├── pyproject.toml      # Tooling configuration (Ruff, etc.)
├── requirements.txt    # Project dependencies
├── run.sh              # One-click setup and run script
└── README.md           # Project documentation

Getting Started

Prerequisites

  • Python 3.11 or higher
  • Git

Installation & Running

The easiest way to get started is to use the provided shell script:

chmod +x run.sh
./run.sh

This script will:

  1. Create a .venv directory if it doesn't exist.
  2. Activate the virtual environment.
  3. Install dependencies from requirements.txt.
  4. Run the main application (src/main.py).

Development

Linting and Formatting

We use Ruff for both linting and formatting. You can run it manually:

# Linting
ruff check .

# Formatting
ruff format .

Running Tests

Run the test suite using pytest:

pytest

Pre-commit Hooks

To set up pre-commit hooks, run:

pre-commit install

This ensures that Ruff lints and formats your code automatically before every commit.

License

This project is licensed under the MIT License - see the LICENSE file for details (if applicable).

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published