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
-
Open System Properties:
- Press
Win + Pause/Breakor - Right-click on 'This PC' → Properties → Advanced system settings
- Press
-
Click "Environment Variables"
-
Under "System Variables":
- If PYTHONPATH exists: Add
;C:\path\to\githubauthlib - If not: Create new with name
PYTHONPATHand valueC:\path\to\githubauthlib
- If PYTHONPATH exists: Add
Instead 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.rstfrom githubauthlib import get_github_tokenfrom .github_auth import get_github_token-
ModuleNotFoundError
- Verify PYTHONPATH configuration
- Check virtual environment activation
- Confirm package installation
-
ImportError
- Check Python version compatibility
- Verify all dependencies are installed
- Ensure correct file permissions
-
Path Issues
- Use
python -c "import sys; print(sys.path)"to check Python's search path - Verify path separators (/ vs ) are correct for your OS
- Use
If you encounter issues:
-
Check the GitHub Issues page
-
Review error logs
-
Include relevant environment details when reporting issues:
python --version pip list echo $PYTHONPATH
- Use virtual environments for isolation
- Prefer absolute imports over relative imports
- Keep PYTHONPATH modifications temporary when possible
- Document all environment setup requirements
- Use consistent path separators per OS