Automodule brings in copyright notice

40 views
Skip to first unread message

Tom Diaz

unread,
Mar 6, 2025, 6:49:54 PMMar 6
to sphinx-users
We recently noticed that for every module of ours that we document with the automodule directive,  Sphinx picks up a copyright string if it's in the same file.

For example, consider a module named whatever.py:

"""
Copyright (C) 2023 My Company, Inc.
"""
.
.
class MyWorstNightmare:
"""
This class contains test facilities to avoid serious problems:
"""

Automodule will pick up the docstring "This class..." but also will stick the copyright notice at the top of the generated document.

That isn't a behavior we want, because the code being documented may have a copyright notice a couple of years old, and we don't want readers to confuse it with the copyright of the book that includes the automodule text.

Is there a way to stop or work around this behavior?

Thanks,
Tom

Luc Saffre

unread,
Mar 7, 2025, 4:47:34 AMMar 7
to sphinx-users
You should write your copyright notice as a comment (a # before each line) and not as a docstring. Because the module-level docstring is expected to contain a general description of your module.

Tom Diaz

unread,
Mar 7, 2025, 11:45:20 AMMar 7
to sphinx...@googlegroups.com
Thanks, Luc.

I had that idea, too.  It works sometimes but not every time.  Do you suppose that workaround is undermined by imports and __init.py__ scripts, where the imported objects have docstrings instead of line comments?

Tom

--
You received this message because you are subscribed to a topic in the Google Groups "sphinx-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/sphinx-users/NDZ4-kMVQHM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to sphinx-users...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/sphinx-users/cc2b0854-704f-405b-a5d8-ec405fecf6d5n%40googlegroups.com.


--
_______________________
Thomas R. Díaz
13 Lois Lane
Lexington, Massachusetts 02420

Luc Saffre

unread,
Mar 8, 2025, 12:02:45 AMMar 8
to sphinx-users
I have no chance to know this without running your code on my computer ;-)
Reply all
Reply to author
Forward
0 new messages