File tree Expand file tree Collapse file tree 11 files changed +58
-232
lines changed Expand file tree Collapse file tree 11 files changed +58
-232
lines changed Original file line number Diff line number Diff line change 24
24
- --fix
25
25
- repo : local
26
26
hooks :
27
- - id : pyproject.toml
28
- name : pyproject.toml
27
+ - id : generate_requirements.py
28
+ name : generate_requirements.py
29
29
language : system
30
- entry : python tools/generate_pyproject.toml .py
31
- files : " pyproject.toml|requirements/.*\\ .txt|tools/.*pyproject.* "
30
+ entry : python tools/generate_requirements .py
31
+ files : " pyproject.toml|requirements/.*\\ .txt|tools/generate_requirements.py "
Original file line number Diff line number Diff line change 1
- # ###############################################################################
2
- # DO NOT EDIT
3
- # AUTOGENERATED BY
4
- #
5
- # $ python tools/generate_pyproject.toml.py
6
- #
7
- # EDIT tools/pyproject.toml.in AND RUN THAT SCRIPT.
8
- #
9
- # ###############################################################################
10
-
11
1
[build-system ]
12
2
build-backend = ' setuptools.build_meta'
13
3
requires = [' setuptools>=61.2' ]
@@ -59,6 +49,7 @@ Homepage = 'https://networkx.org/'
59
49
"Bug Tracker" = ' https://github.com/networkx/networkx/issues'
60
50
Documentation = ' https://networkx.org/documentation/stable/'
61
51
"Source Code" = ' https://github.com/networkx/networkx'
52
+
62
53
[project .entry-points ."networkx .plugins" ]
63
54
nx-loopback = ' networkx.classes.tests.dispatch_interface:dispatcher'
64
55
@@ -94,6 +85,7 @@ test = [
94
85
' pytest>=7.2' ,
95
86
' pytest-cov>=4.0' ,
96
87
]
88
+
97
89
[tool .setuptools ]
98
90
zip-safe = false
99
91
include-package-data = false
@@ -131,6 +123,7 @@ platforms = [
131
123
' Windows' ,
132
124
' Unix' ,
133
125
]
126
+
134
127
[tool .setuptools .dynamic .version ]
135
128
attr = ' networkx.__version__'
136
129
Original file line number Diff line number Diff line change 2
2
3
3
## Index
4
4
5
+ These files are generated by ` tools/generate_requirements.py ` from ` pyproject.toml ` .
6
+
5
7
- [ ` default.txt ` ] ( default.txt )
6
8
Default requirements
7
9
- [ ` extra.txt ` ] ( extra.txt )
Original file line number Diff line number Diff line change
1
+ # Generated via tools/generate_requirements.py and pre-commit hook.
2
+ # Do not edit this file; modify pyproject.toml instead.
1
3
numpy>=1.22
2
4
scipy>=1.9,!=1.11.0,!=1.11.1
3
5
matplotlib>=3.5
Original file line number Diff line number Diff line change
1
+ # Generated via tools/generate_requirements.py and pre-commit hook.
2
+ # Do not edit this file; modify pyproject.toml instead.
1
3
pre-commit>=3.2
2
4
mypy>=1.1
3
5
rtoml
Original file line number Diff line number Diff line change
1
+ # Generated via tools/generate_requirements.py and pre-commit hook.
2
+ # Do not edit this file; modify pyproject.toml instead.
1
3
sphinx>=7
2
4
pydata-sphinx-theme>=0.14
3
5
sphinx-gallery>=0.14
Original file line number Diff line number Diff line change
1
+ # Generated via tools/generate_requirements.py and pre-commit hook.
2
+ # Do not edit this file; modify pyproject.toml instead.
1
3
lxml>=4.6
2
4
pygraphviz>=1.11
3
5
pydot>=1.4.2
Original file line number Diff line number Diff line change
1
+ # Generated via tools/generate_requirements.py and pre-commit hook.
2
+ # Do not edit this file; modify pyproject.toml instead.
1
3
pytest>=7.2
2
4
pytest-cov>=4.0
Load Diff This file was deleted.
Original file line number Diff line number Diff line change
1
+ #!/usr/bin/env python
2
+ """Generate requirements/*.txt files from pyproject.toml."""
3
+
4
+ import sys
5
+ from pathlib import Path
6
+
7
+ try : # standard module since Python 3.11
8
+ import tomllib as toml
9
+ except ImportError :
10
+ try : # available for older Python via pip
11
+ import tomli as toml
12
+ except ImportError :
13
+ sys .exit ("Please install `tomli` first: `pip install tomli`" )
14
+
15
+ script_pth = Path (__file__ )
16
+ repo_dir = script_pth .parent .parent
17
+ script_relpth = script_pth .relative_to (repo_dir )
18
+ header = [
19
+ f"# Generated via { script_relpth .as_posix ()} and pre-commit hook." ,
20
+ "# Do not edit this file; modify pyproject.toml instead." ,
21
+ ]
22
+
23
+
24
+ def generate_requirement_file (name : str , req_list : list [str ]) -> None :
25
+ req_fname = repo_dir / "requirements" / f"{ name } .txt"
26
+ req_fname .write_text ("\n " .join (header + req_list ) + "\n " )
27
+
28
+
29
+ def main () -> None :
30
+ pyproject = toml .loads ((repo_dir / "pyproject.toml" ).read_text ())
31
+
32
+ generate_requirement_file ("default" , pyproject ["project" ]["dependencies" ])
33
+
34
+ for key , opt_list in pyproject ["project" ]["optional-dependencies" ].items ():
35
+ generate_requirement_file (key , opt_list )
36
+
37
+
38
+ if __name__ == "__main__" :
39
+ main ()
You can’t perform that action at this time.
0 commit comments