File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3838from typing import Literal , Optional , Tuple
3939from collections .abc import Sequence
4040from warnings import warn
41+ import textwrap
4142
4243from IPython .external .pickleshare import PickleShareDB
4344
@@ -1023,6 +1024,18 @@ def restore_sys_module_state(self):
10231024
10241025 @property
10251026 def banner (self ):
1027+ if (when := os .environ .get ("SOURCE_DATE_EPOCH" , None )) is not None :
1028+ from datetime import datetime
1029+
1030+ date = datetime .fromtimestamp (int (when ))
1031+ return textwrap .dedent (
1032+ f"""
1033+ Python 3.y.z | Packaged with love | (main, { date .strftime ("%A, %d %B %Y" )} ) [Compiler]
1034+ Type 'copyright', 'credits' or 'license' for more information
1035+ IPython 9.y.z -- An enhanced Interactive Python. Type '?' for help.
1036+ Tip: unset SOURCE_DATE_EPOCH to restore dynamic banner.
1037+ """
1038+ ).lstrip ()
10261039 banner = self .banner1
10271040 if self .profile and self .profile != 'default' :
10281041 banner += '\n IPython profile: %s\n ' % self .profile
You can’t perform that action at this time.
0 commit comments