This codebase is designed to help a user learn about a topic by first learning the necessary foundational knowledge.
- Python 3.10 or higher
- pip (Python package installer)
- OpenAI api key
- Clone the repository:
git clone https://github.com/yourusername/learn_anything.git
cd learn_anything
- Save OpenAI api key to an env file
echo "OPENAI_API_KEY={key_here}" > .env
- Create and activate a virtual environment:
# Create virtual environment
python3 -m venv venv
# Activate virtual environment
# On macOS/Linux:
source venv/bin/activate
# On Windows:
# .\venv\Scripts\activate
# To deactivate the virtual environment when you're done:
(venv) deactivate
- Install required packages:
(venv) pip install -r requirements.txt
- Run the python scripts (example: graph creation script):
(venv) ./backend/src/graph_creation.py [--optional-arguments]
The project includes several helpful scripts in backend/scripts/
:
# Setup development environment
./backend/scripts/setup.sh
# Format Python files
./backend/scripts/format_python.sh
# Run all code quality checks
./backend/scripts/lint.sh
The project uses several tools to maintain code quality:
- YAPF: Code formatting with custom style rules
- isort: Import sorting
- Flake8: Style guide enforcement
- MyPy: Static type checking
- Pylint: Code quality metrics (minimum score: 8.0)
All these checks can be run using the lint script:
./backend/scripts/lint.sh
Or run individual checks:
# Format code with YAPF
yapf -i -r backend
# Sort imports
isort backend
# Run style checks
flake8 backend
# Run type checks
mypy backend
# Check code quality score
pylint backend
The repository includes a GitHub Actions workflow that runs on Ubuntu and macOS. The workflow:
- Creates a Python virtual environment
- Installs all dependencies
- Runs all code quality checks with detailed output
- Only fails if critical checks fail (e.g., pylint score < 8.0)
- Provides helpful messages about fixing issues
The workflow runs on:
- Pull requests to main branch
- Pushes to main branch
To test GitHub Actions locally, you can use act:
# Install act (on macOS)
brew install act
# Run the workflow locally
act -j code-quality
Documentation is automatically generated using Doxygen for both Python and JavaScript/TypeScript code.
-
Generate documentation locally:
doxygen Doxyfile
-
Open in your browser:
# On macOS open docs/html/index.html # On Linux xdg-open docs/html/index.html