Installation¶
Requirements¶
twod requires Python 3.10 or higher. You can check your Python version with:
Install from PyPI¶
The easiest way to install twod is from PyPI using pip:
To upgrade to the latest version:
Install from Source¶
To install the latest development version from GitHub:
Development Installation¶
If you want to contribute to twod or modify the source code, you'll need a development installation:
1. Clone the Repository¶
2. Install Dependencies¶
The project uses uv for dependency management. Install it first:
Then sync the development dependencies:
3. Verify Installation¶
Run the tests to ensure everything is working:
Check code coverage:
Run type checking:
Virtual Environment¶
We recommend using a virtual environment to avoid conflicts with other packages:
Using venv¶
python -m venv twod-env
source twod-env/bin/activate # On Windows: twod-env\Scripts\activate
pip install twod
Using conda¶
Verification¶
After installation, verify that twod is working correctly:
from twod import Point, Rect, Line
# Test basic functionality
p1 = Point(0, 0)
p2 = Point(3, 4)
distance = p1.distance(p2)
print(f"Distance: {distance}") # Should print: Distance: 5.0
# Test complex number implementation
from twod import CPoint
cp = CPoint(3+4j)
print(f"CPoint radius: {cp.radius}") # Should print: CPoint radius: 5.0
If this runs without errors, twod is successfully installed!
Troubleshooting¶
Python Version Issues¶
If you encounter issues with Python version compatibility:
# Check your Python version
python --version
# If you have multiple Python versions, try:
python3.10 -m pip install twod
# or
python3.11 -m pip install twod
Import Errors¶
If you get import errors, ensure you're in the correct environment:
Development Dependencies¶
For development, ensure all dependency groups are installed:
Next Steps¶
Now that you have twod installed, check out the quickstart guide to learn how to use it!