Current status
Every file has a copyright comment section on top of each file but after the module docstring. I tlooks like this:
"""Time handling module. .. versionadded:: 7.5 """ # # (C) Pywikibot team, 2007-2026 # # Distributed under the terms of the MIT license. #
Problem
isort linter does not always preserve the import section and adds import section between docstring and copyright section.
Solution
Move the copyright section on top of the file but behind the sheban if any. The result should be:
# # (C) Pywikibot team, 2007-2026 # # Distributed under the terms of the MIT license. # """Time handling module. .. versionadded:: 7.5 """
If a file contains a shebang line (usually for scripts) ithis line should be kept on top. For example:
#!/usr/bin/env python3 """Script to create user-config.py. Other file names are not supported.""" # # (C) Pywikibot team, 2010-2026 # # Distributed under the terms of the MIT license. #
should become
#!/usr/bin/env python3 # # (C) Pywikibot team, 2010-2026 # # Distributed under the terms of the MIT license. # """Script to create user-config.py. Other file names are not supported."""