diff --git a/setup.py b/setup.py index 89ded38..40cdd14 100644 --- a/setup.py +++ b/setup.py @@ -4,56 +4,52 @@ See LICENCE.txt for licensing and contact information. """ -from distutils.core import setup -try: # for pip >= 10 - from pip._internal.req import parse_requirements -except ImportError: # for pip <= 9.0.3 - from pip.req import parse_requirements +from setuptools import setup from runpy import run_path -install_reqs = parse_requirements('requirements.txt', session=False) -try: # for pip < 20.1 - install_requires = [str(ir.req) for ir in install_reqs] -except AttributeError: # for pip >= 20.1 - install_requires = [str(ir.requirement) for ir in install_reqs] def get_version(): - namespace = run_path('chumpy/version.py') - return namespace['version'] + namespace = run_path("chumpy/version.py") + return namespace["version"] -setup(name='chumpy', + +# Read requirements directly from requirements.txt +# Don't use pip's internal APIs - they're not meant for setup.py +with open("requirements.txt") as f: + install_requires = [ + line.strip() for line in f if line.strip() and not line.startswith("#") + ] + + +setup( + name="chumpy", version=get_version(), - packages = ['chumpy'], - author='Matthew Loper', - author_email='matt.loper@gmail.com', - url='https://github.com/mattloper/chumpy', - description='chumpy', - license='MIT', + packages=["chumpy"], + author="Matthew Loper", + author_email="matt.loper@gmail.com", + url="https://github.com/mattloper/chumpy", + description="chumpy", + license="MIT", install_requires=install_requires, - + python_requires=">=2.7", # See https://pypi.python.org/pypi?%3Aaction=list_classifiers classifiers=[ # How mature is this project? Common values are # 3 - Alpha # 4 - Beta # 5 - Production/Stable - 'Development Status :: 4 - Beta', - + "Development Status :: 4 - Beta", # Indicate who your project is intended for - 'Intended Audience :: Science/Research', - 'Topic :: Scientific/Engineering :: Mathematics', - + "Intended Audience :: Science/Research", + "Topic :: Scientific/Engineering :: Mathematics", # Pick your license as you wish (should match "license" above) - 'License :: OSI Approved :: MIT License', - + "License :: OSI Approved :: MIT License", # Specify the Python versions you support here. In particular, ensure # that you indicate whether you support Python 2, Python 3 or both. - 'Programming Language :: Python :: 2', - 'Programming Language :: Python :: 2.7', - 'Programming Language :: Python :: 3', - - 'Operating System :: MacOS :: MacOS X', - 'Operating System :: POSIX :: Linux' + "Programming Language :: Python :: 2", + "Programming Language :: Python :: 2.7", + "Programming Language :: Python :: 3", + "Operating System :: MacOS :: MacOS X", + "Operating System :: POSIX :: Linux", ], ) - diff --git a/test_build.sh b/test_build.sh new file mode 100755 index 0000000..50e61da --- /dev/null +++ b/test_build.sh @@ -0,0 +1,74 @@ +#!/usr/bin/env bash +set -e + +echo "════════════════════════════════════════" +echo " Testing chumpy build and install" +echo "════════════════════════════════════════" +echo "" + +# Clean previous artifacts +echo "🧹 Cleaning previous builds..." +rm -rf dist/ build/ *.egg-info test-pip test-uv test-wheel + +echo "" +echo "════════════════════════════════════════" +echo " Test 1: pip install ." +echo "════════════════════════════════════════" +echo "" + +python3 -m venv test-pip +source test-pip/bin/activate +pip install . -q +python -c "import chumpy; print(f'✓ Test 1 PASSED: chumpy {chumpy.__version__} via pip install .')" +deactivate +rm -rf test-pip + +echo "" +echo "════════════════════════════════════════" +echo " Test 2: uv pip install ." +echo "════════════════════════════════════════" +echo "" + +uv venv test-uv +source test-uv/bin/activate +uv pip install . +python -c "import chumpy; print(f'✓ Test 2 PASSED: chumpy {chumpy.__version__} via uv pip install .')" +deactivate +rm -rf test-uv + +echo "" +echo "════════════════════════════════════════" +echo " Test 3: python -m build" +echo "════════════════════════════════════════" +echo "" + +pip install build -q +python -m build + +echo "" +echo "Built artifacts:" +ls -lh dist/ + +echo "" +echo "Testing wheel installation..." +python3 -m venv test-wheel +source test-wheel/bin/activate + +# Install the wheel (use wildcard to match whatever version was built) +WHEEL_FILE=$(ls dist/*.whl | head -n 1) +echo "Installing: $WHEEL_FILE" +pip install "$WHEEL_FILE" -q + +python -c "import chumpy; print(f'✓ Test 3 PASSED: chumpy {chumpy.__version__} from wheel')" +deactivate +rm -rf test-wheel + +echo "" +echo "════════════════════════════════════════" +echo " ✅ All tests PASSED!" +echo "════════════════════════════════════════" +echo "" +echo "Ready to:" +echo " 1. Submit PR to original chumpy repo" +echo " 2. Publish to PyPI (optional)" +echo ""