Skip to content

Commit bc6e167

Browse files
authored
Merge pull request #199 from BrainCOGS/fixing_broken_url_in_setup
Fixed broken URL for CaImAn requirements; Added a non-toml parse beca…
2 parents cd55f53 + a7291f3 commit bc6e167

File tree

1 file changed

+30
-6
lines changed

1 file changed

+30
-6
lines changed

setup.py

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,37 @@
1313
with open(path.join(here, pkg_name, "version.py")) as f:
1414
exec(f.read())
1515

16-
with urllib.request.urlopen(
17-
"https://raw.githubusercontent.com/flatironinstitute/CaImAn/master/requirements.txt"
18-
) as f:
19-
caiman_requirements = f.read().decode("UTF-8").split("\n")
16+
# TODO: Replace with `tomllib` once Python 3.10 support is dropped
17+
def fetch_and_parse_dependencies(url):
18+
# Fetch the pyproject.toml file
19+
with urllib.request.urlopen(url) as f:
20+
toml_content = f.read().decode("UTF-8")
21+
22+
# Manually parse the dependencies section
23+
lines = toml_content.split('\n')
24+
dependencies = []
25+
start_collecting = False
26+
27+
for line in lines:
28+
line = line.strip()
29+
if line.startswith('dependencies = ['):
30+
start_collecting = True
31+
continue
32+
if start_collecting:
33+
if line.startswith(']'):
34+
break
35+
dependency = line.strip(',').strip('"')
36+
dependencies.append(dependency)
37+
38+
return dependencies
39+
40+
# URL of CaImAn's pyproject.toml file
41+
caiman_url = "https://raw.githubusercontent.com/flatironinstitute/CaImAn/main/pyproject.toml"
42+
43+
# Fetch and parse dependencies
44+
caiman_requirements = fetch_and_parse_dependencies(caiman_url )
45+
2046

21-
caiman_requirements.remove("")
22-
caiman_requirements.append("future")
2347

2448
setup(
2549
name=pkg_name.replace("_", "-"),

0 commit comments

Comments
 (0)