From 6a5ef9d7e158e99428db052d662642326da1b0e0 Mon Sep 17 00:00:00 2001 From: Seth Cope Date: Thu, 11 Jun 2026 13:42:01 -0500 Subject: [PATCH] Fix sdist source build: setup.py imported the package (pulling typing_extensions) and read a missing requirements.txt; now reads the version statically and guards the file read. Verified: with this change, python -m build (sdist -> wheel from that sdist) succeeds in a clean python:3.12 container; without it, it fails. Co-Authored-By: Claude Fable 5 --- setup.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/setup.py b/setup.py index f004035..5ba528c 100644 --- a/setup.py +++ b/setup.py @@ -1,14 +1,22 @@ #!/usr/bin/env python +import os +import re + from setuptools import find_packages, setup -from resend.version import get_version +# Read the version without importing the package (its deps may not be installed) +with open("resend/version.py", encoding="utf8") as f: + version = re.search(r'__version__ = "([^"]+)"', f.read()).group(1) -install_requires = open("requirements.txt").readlines() +if os.path.exists("requirements.txt"): + install_requires = open("requirements.txt").readlines() +else: + install_requires = ["requests>=2.31.0", "typing_extensions>=4.4.0"] setup( name="resend", - version=get_version(), + version=version, description="Resend Python SDK", long_description=open("README.md", encoding="utf8").read(), long_description_content_type="text/markdown",