@@ -131,6 +131,44 @@ def extract_project_dependencies(pyproject_data):
131131 return dependencies_list
132132
133133
134+ def extract_tags_from_url (url ):
135+ """Extract tags from wheel URL"""
136+ tags = set ()
137+
138+ # Python version tags
139+ if "cp313" in url :
140+ tags .add ("cp313" )
141+ if "py3" in url :
142+ tags .add ("py3" )
143+
144+ # Platform tags
145+ if "manylinux" in url :
146+ tags .add ("manylinux" )
147+ if "-none-" in url :
148+ tags .add ("none" )
149+ if "any.whl" in url :
150+ tags .add ("any" )
151+ if "x86_64.whl" in url :
152+ tags .add ("x86_64" )
153+
154+ return tags
155+
156+ def is_compatible_wheel (url ):
157+ """Check if wheel is compatible using tag matching"""
158+ wheel_tags = extract_tags_from_url (url )
159+
160+ # Define compatible tag combinations
161+ compatible_python = {"cp313" , "py3" }
162+ # Architecture-free or linux
163+ compatible_platforms = {"manylinux" , "none" , "any" , "x86_64" }
164+
165+ # Check if wheel has required python version AND compatible platform
166+ has_required_python = not wheel_tags .isdisjoint (compatible_python )
167+ has_compatible_platform = not wheel_tags .isdisjoint (compatible_platforms )
168+
169+ return has_required_python and has_compatible_platform
170+
171+
134172def create_defualt_nix (dependencies_list , meta_dict ):
135173 # Create a default.nix
136174 nix_content = """
@@ -227,11 +265,7 @@ def create_defualt_nix(dependencies_list, meta_dict):
227265 for component in url_section :
228266 if component .get ("packagetype" ) == "bdist_wheel" :
229267 whl_url = component .get ("url" )
230- if (
231- ("cp313" not in whl_url and "py3" not in whl_url )
232- or ("manylinux" not in whl_url and "-none-" not in whl_url )
233- or ("any.whl" not in whl_url and "x86_64.whl" not in whl_url )
234- ):
268+ if not is_compatible_wheel (whl_url ):
235269 continue
236270 whl_sha256 = get_sha256_hash (whl_url )
237271 nix_content += " " + name + " = buildCustomPackage {\n "
0 commit comments