Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8427201
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T04:43:32+00:00 2026-06-10T04:43:32+00:00

I have a module that goes something like this: #!/usr/bin/env python #: Documentation here.

  • 0

I have a module that goes something like this:

#!/usr/bin/env python

#: Documentation here.
#: blah blah blah
foobar = r'Some really long regex here.'

def myfunc(val=foobar):
    '''Blah blah blah'''
    pass

…and I have a .rst file that goes something like this:

:mod:`my_module` Module
-----------------------

..automodule:: my_module
    :members:
    :private-members:
    :show-inheritance:

When I build the documentation, I get an html file with a snippet that goes like this:

mymodule.foobar.foobar = ‘Some absurdly long and ugly regex here’

Extra documentation here

mymodule.myfunc(val=’Some absurdly long and ugly regex here’)

blah blah blah

Based on this stackoverflow post, I thought I could change it by altering my module to:

#!/usr/bin/env python

#: .. data:: my_module.foobar
#: Extra documentation here
foobar = 'Some really long regex here.'

def myfunc(val=foobar):
    '''.. function:: my_module.myfunc(val=foobar)

    Blah blah blah'''
    pass

…but that didn’t do the trick, and just appended the signature I wanted under the ugly one as part of the body. Does anybody know how I can properly override this?

(I’m using Sphinx v1.1.3, btw.)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T04:43:33+00:00Added an answer on June 10, 2026 at 4:43 am

    You have a module-level variable that is used as the default value of a keyword argument in a function. Sphinx displays the value (instead of the name) of that variable in the function signature. This problem is discussed in another question, and the OP has also submitted an issue ticket at GitHub about it.

    However, you can work around this in two ways:

    1. Override the signature in the .rst file by using autofunction, as explained in the answer to the linked question.

    2. If the first line of the docstring looks like a signature and if the autodoc_docstring_signature configuration variable is set to True (which it is by default), then Sphinx will use that line as the signature.

      So if you have a docstring that looks as follows,

      def myfunc(val=foobar):
          '''myfunc(val=foobar)
      
          Blah blah blah'''
          pass
      

      it should work in the way you want it.

      In the question, you have this first line in the docstring:

      .. function:: my_module.myfunc(val=foobar) 
      

      This does not work because it does not look like a proper signature.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this module pattern that stores a bunch of vars. I want to
I have a python module that imports a module generated with swig. When I
I have a python module that I've been using over the years to process
This is probably a shot in the dark but here goes nothing... I have
I have module that implements custom content type via NodeAPI hooks ( hook_insert ,
I have a module that is being used to create only a few page
I have a module that reads the StandardError of a process. Everything works fine,
Suppose you have a module that you know is safe. You want to mark
Let's say that I have a module that has a Queue in it. For
I have a war module that is being built and is including a few

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.