Skip to content

Installation Guide

Requirements

Before installing python-newtype, ensure you have:

  • Python 3.8 or higher
  • pip (Python package installer)
  • A C compiler (for building extensions)

Installation Methods

The simplest way to install python-newtype is via pip:

pip install python-newtype

Development Installation

For development or to access the latest features:

  1. Clone the repository:

    git clone https://github.com/jymchng/python-newtype-dev.git
    cd python-newtype-dev
    

  2. Install in development mode with extra dependencies:

    make install-dev-deps
    

Building from Source

  1. Clone the repository:

    git clone https://github.com/jymchng/python-newtype-dev.git
    cd python-newtype-dev
    

  2. Build the package:

    make build
    

  3. Install the built package:

    pip install dist/*.tar.gz
    

Verifying Installation

To verify the installation:

import newtype
print(newtype.__version__)

Optional Dependencies

Development Dependencies

  • pytest>=3.2
  • pytest-asyncio
  • pytest-memray
  • pandas>=2

Install with:

pip install "python-newtype[dev]"

Troubleshooting

Common Issues

  1. Missing Compiler
  2. Windows: Install Visual Studio Build Tools
  3. Linux: Install gcc (sudo apt-get install gcc or equivalent)
  4. macOS: Install Xcode Command Line Tools

  5. ImportError: No module named 'newtype'

  6. Ensure the package is installed: pip list | grep python-newtype
  7. Check Python path: python -c "import sys; print(sys.path)"

  8. Build Errors

  9. Ensure you have the latest setuptools: pip install --upgrade setuptools
  10. Check compiler installation: gcc --version or equivalent
  11. On Windows, ensure you're using the correct Visual Studio version

Getting Help

If you encounter issues:

  1. Check the GitHub Issues
  2. Search for similar problems in closed issues
  3. Open a new issue with:
  4. Your Python version
  5. Your OS and version
  6. Complete error message
  7. Steps to reproduce