from pyparsing import quotedString
from datetime import datetime

nw = datetime.utcnow()
nowstring = '"%s"' % (nw.strftime("%d %b %Y %X")[:-3] + " UTC")
print(nowstring)

quoted_time = quotedString()
quoted_time.setParseAction(lambda: nowstring)

version_time = "__versionTime__ = " + quoted_time
with open("pyparsing.py", encoding="utf-8") as oldpp:
    orig_code = oldpp.read()
    new_code = version_time.transformString(orig_code)

with open("pyparsing.py", "w", encoding="utf-8") as newpp:
    newpp.write(new_code)

from datetime import datetime
from pathlib import Path
from pyparsing import quoted_string

nw = datetime.utcnow()
now_string = '"%s"' % (nw.strftime("%d %b %Y %X")[:-3] + " UTC")
print(now_string)

quoted_time = quoted_string()
quoted_time.set_parse_action(lambda: now_string)

version_time = "__version_time__ = " + quoted_time

pp_init = Path("pyparsing/__init__.py")
orig_code = pp_init.read_text()
new_code = version_time.transform_string(orig_code)
pp_init.write_text(new_code)

Update update_pyparsing_timestamp.py to new code structure