Skip to content

gh-159240: Deprecate __{author,credits,copyright}__ attributes in stdlib modules - #159241

Merged
StanFromIreland merged 4 commits into
python:mainfrom
StanFromIreland:deprecate-attributes
Oct 30, 2026
Merged

StanFromIreland merged 4 commits into
python:mainfrom
StanFromIreland:deprecate-attributes

Conversation

@StanFromIreland

@StanFromIreland StanFromIreland commented Oct 12, 2026 •

Copy link
Copy Markdown
Member

@read-the-docs-community

read-the-docs-community Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

Documentation build overview

📚 cpython-previews | 🛠️ Build #35521056 | 📁 Comparing 2ce1bac against main (cfea838)

  🔍 Preview build  

175 files changed · + 1 added · ± 174 modified

+ Added

± Modified

@gvanrossum

Copy link
Copy Markdown
Member

Please remove me from those attributions that include me. I'm "original author" of half the stdlib, after all, and I don't need to see my name repeated.

Comment thread Lib/optparse.py
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
"""
# Copyright (c) 2001-2006 Gregory P. Ward. All rights reserved.
# Copyright (c) 2002 Python Software Foundation. All rights reserved.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need to retain the licensing though as it's the PSF one (?) otherwise this may conflict with the one that we currently use.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought about this, but I wasn't sure, and I'm no lawyer. @gward would this be alright?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other stdlib modules don't have explicit license text. IANAL, but it does seem either redundant or contradictory to include it. Who would be the PSF licensing person to double-check with?

@malemburg

malemburg commented Oct 13, 2026 via email

Copy link
Copy Markdown
Member

@malemburg malemburg left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, so it looks like you are only removing the attributes from the code and moving the notices to comments. This should be fine. There's one catch, though, you should be aware of: if you put the notices into an attribute, they will be available in the PYCs and the live code when used at runtime as well. Having the notices in comments does not have the same effect.

Personally, I'm fine with not having the notices for e.g. platform.py in attributes anymore, but others may feel differently about this.

@StanFromIreland

Copy link
Copy Markdown
Member Author

Thank you for the review.

Just wanted to mention that removing authorship and copyright notices will most likely not work without the author's consent.

Since we're keeping the information, I think we should generally be alright here?

There's one catch, though, you should be aware of: if you put the notices into an attribute, they will be available in the PYCs and the live code when used at runtime as well.

Yes, but I don't think anyone needs programmatic access to this information, which is often misleading or outdated. At least, no one has expressed such a need in the discussion.

Comment thread Lib/pydoc.py Resolved

@nedbat nedbat left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally we'd resolve the question about the license, but that could also be a follow-on PR.

@malemburg

Copy link
Copy Markdown
Member

Regarding licenses in the code base: Usually, only the copyright holders can give permission to remove those licenses or copyright notices (most licenses require to include the text in all copies).

Also note that unless an author has assigned copyright to the PSF, the PSF only gets redistribution rights via the CLA. The author retains the copyright.

@StanFromIreland

Copy link
Copy Markdown
Member Author

If there are no objections, I'll merge this Friday week.

@hugovk hugovk left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Refactor suggestion: we have a lot of repeated boilerplate, like:

class TestModule(unittest.TestCase):
    def test_deprecated__version__(self):
        with self.assertWarnsRegex(
            DeprecationWarning,
            "'__version__' is deprecated and slated for removal in Python 3.20",
        ) as cm:
            getattr(ttk, "__version__")
        self.assertEqual(cm.filename, __file__)

    def test_deprecated__author__(self):
        with self.assertWarnsRegex(
            DeprecationWarning,
            "'__author__' is deprecated and slated for removal in Python 3.20",
        ) as cm:
            getattr(ttk, "__author__")
        self.assertEqual(cm.filename, __file__)

These two functions target the same removal version and could be merged into a single test_deprecated_dunder_attributes function.

But between this PR and the existing __version__ deprecations, that still means lots of boilerplate across test files.

Let's create a single test helper that takes one or more attribute names and their removal version.

Comment thread Lib/test/test_logging.py Resolved

@vstinner vstinner left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. I'm fine with remove these attributes, and it's good that authors are kept in comments.

Comment thread Lib/tarfile.py
__author__ = "Lars Gust\u00e4bel ([email protected])"
__credits__ = "Gustavo Niemeyer, Niels Gust\u00e4bel, Richard Townsend."
# Original author: Lars Gustäbel ([email protected])
# Credits: Gustavo Niemeyer, Niels Gustäbel, Richard Townsend.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, Unicode!

Comment thread Lib/tarfile.py Resolved

@hugovk hugovk left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!


If there are no objections, I'll merge this Friday week.

I'm not sure if you meant today, Friday 23rd, or next Friday 30th. In my English, "this Friday week" means "a week on Friday", that is, the Friday after the upcoming Friday, so would be the 30th.

(Whereas "Friday this week" means today the 23rd!)

Anyway, either is fine by me :)


(This PR has merge conflicts.)

@StanFromIreland

Copy link
Copy Markdown
Member Author

I'm not sure if you meant today, Friday 23rd, or next Friday 30th. In my English, "this Friday week" means "a week on Friday", that is, the Friday after the upcoming Friday, so would be the 30th.

Sorry for the Irish-English! ;-) I meant Friday the 30th.

(This PR has merge conflicts.)

I presume a few more will pop up till next week, so I'll get them all then.

Thanks for the review!

@StanFromIreland
StanFromIreland enabled auto-merge (squash) October 30, 2026 10:40
@StanFromIreland
StanFromIreland merged commit 6632294 into python:main Oct 30, 2026
56 checks passed
@StanFromIreland
StanFromIreland deleted the deprecate-attributes branch October 30, 2026 11:18
@StanFromIreland

Copy link
Copy Markdown
Member Author

Thanks for all the reviews!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type-feature A feature request or enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants