2626def make_doc (ctx ):
2727 with cd ("docs_rst" ):
2828 ctx .run ("cp ../CHANGES.rst change_log.rst" )
29- ctx .run ("sphinx-apidoc --implicit-namespaces --separate -d 7 -o . -f ../pymatgen" )
29+ ctx .run (
30+ "sphinx-apidoc --implicit-namespaces --separate -d 7 -o . -f ../pymatgen"
31+ )
3032 ctx .run ("rm pymatgen*.tests.rst" )
3133 for f in glob .glob ("*.rst" ):
3234 if f .startswith ("pymatgen" ) and f .endswith ("rst" ):
@@ -43,7 +45,9 @@ def make_doc(ctx):
4345 else :
4446 if not clean .endswith ("tests" ):
4547 suboutput .append (line )
46- if clean .startswith ("pymatgen" ) and not clean .endswith ("tests" ):
48+ if clean .startswith ("pymatgen" ) and not clean .endswith (
49+ "tests"
50+ ):
4751 newoutput .extend (suboutput )
4852 subpackage = False
4953 suboutput = []
@@ -61,24 +65,15 @@ def make_doc(ctx):
6165
6266@task
6367def set_ver (ctx ):
64- lines = []
65- with open ("pymatgen/analysis/diffusion/__init__.py" ) as f :
66- for l in f :
67- if "__version__" in l :
68- lines .append ('__version__ = "%s"' % NEW_VER )
69- else :
70- lines .append (l .rstrip ())
71- with open ("pymatgen/analysis/diffusion/__init__.py" , "w" ) as f :
72- f .write ("\n " .join (lines ))
7368
7469 lines = []
75- with open ("setup.py " ) as f :
70+ with open ("pyproject.toml " ) as f :
7671 for l in f :
77- lines .append (re .sub (r"version=([^,]+)," , 'version="%s",' % NEW_VER , l .rstrip ()))
78- with open ("setup.py" , "w" ) as f :
72+ lines .append (
73+ re .sub (r"^version = ([^,]+)" , f'version = "{ NEW_VER } "' , l .rstrip ())
74+ )
75+ with open ("pyproject.toml" , "w" ) as f :
7976 f .write ("\n " .join (lines ))
80- ctx .run ("ruff format pymatgen" )
81- ctx .run ("ruff format setup.py" )
8277
8378
8479@task
0 commit comments