This guide covers various approaches to setting up your Python environment for working with githubauthlib.
PYTHONPATH is an environment variable that tells Python where to look for modules. When you import a module, Python searches through the directories listed in PYTHONPATH.
export PYTHONPATH="${PYTHONPATH}:/path/to/githubauthlib"
set PYTHONPATH=%PYTHONPATH%;C:\path\to\githubauthlib
$env:PYTHONPATH += ";C:\path\to\githubauthlib"
Open your shell configuration file:
# For bash
nano ~/.bashrc
# For zsh
nano ~/.zshrc
Add the export line:
export PYTHONPATH="${PYTHONPATH}:/path/to/githubauthlib"
Apply changes:
source ~/.bashrc # or ~/.zshrc
Win + Pause/Break orClick “Environment Variables”
;C:\path\to\githubauthlibPYTHONPATH and value C:\path\to\githubauthlibInstead of modifying PYTHONPATH, consider using virtual environments:
# Create virtual environment
python -m venv venv
# Activate virtual environment
# Linux/macOS
source venv/bin/activate
# Windows
venv\Scripts\activate
# Install package in development mode
pip install -e .
Recommended project structure for development:
githubauthlib/
│
├── .git/
├── .gitignore
├── README.md
├── AUXILIARY.md
├── LICENSE
├── setup.py
├── requirements.txt
│
├── githubauthlib/
│ ├── __init__.py
│ └── github_auth.py
│
├── tests/
│ ├── __init__.py
│ └── test_github_auth.py
│
└── docs/
├── conf.py
└── index.rst
from githubauthlib import get_github_token
from .github_auth import get_github_token
python -c "import sys; print(sys.path)" to check Python’s search pathIf you encounter issues:
Include relevant environment details when reporting issues:
python --version
pip list
echo $PYTHONPATH