Ability to link to third-party projects

Bug #1246713 reported by Laurens Van Houtven
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
pydoctor
New
Undecided
Unassigned

Bug Description

There should be a way to link to code that isn't in the current project or in the stdlib. I ran into this in http://tm.tl/6803 when trying to document twisted.conch; it links to stuff in PyCrypto.

Revision history for this message
Glyph Lefkowitz (glyph) wrote :

I ran into this again on <https://tm.tl/7098>.

Revision history for this message
Michael Hudson-Doyle (mwhudson) wrote :

The way to fix this is to support sphinx's "objects.inv" format.

I'm not sure when the spare time and the spare enthusiasm are going to coincide to get this done, unfortunately :/

Revision history for this message
Adi Roiban (adiroiban) wrote :

OK. How do you want this to be solved?

I think that this needs to be split into 2 tickets:
One for something similar to intersphinx and another similar for extlinks

---------------

For intersphix, we need some sort of configuration:

intersphinx_mapping = {
      'Crypto' : ('http://py.crypto.com/api', None)
      'twisted: ('http://tm.tld/documentation/current/api', None)
      }

When it fails to resole L{Crypto.some.stuff} it can check intersphinx inventory.
Same for unresolved L{twisted.some.other.stuff}.

Note that this only works for project using Sphinx for api...

--------

For extlinks, we need a mapping

extlinks = {'Crypto': 'http://pythonhosted.org/pycrypto/%s.html'}

So that unresolved L{Crypto.some.thing} will link to http://pythonhosted.org/pycrypto/Crypto.some.thing.html

One option for extlinks is to map it to a function:

extlinks = {'Crypto': 'plugin:crypto_resolver.mapper'}

def crypto_resolver(name):
    return '%s/%s' % ('http://base', '/'.join(name.split('.')))

crypt_resolver could then do a trial and error and check remote URL for name-module.html or name-class.html and return only valid links... this will be slow... but should be flexible.

If exlinkg mapping start with plugin: it will try to import that method.

---------

I see that PyCrypto uses epydocs and not pydoctor... so it does not have an objects.inv...

Also, epydocs produces some ugly urls ... Crypto.Cipher.AES.AESCipher-class.html and Crypto.Cipher.blockalgo-module.html .. so is not easy to create a simple mapping

---------

I will keep this ticket for linking to generic 3rd party apis and will create a new ticket targeted for supporting intersphinx objects.inv

Revision history for this message
Michael Hudson-Doyle (mwhudson) wrote : Re: [Bug 1246713] Re: Ability to link to third-party projects

Adi Roiban <email address hidden> writes:

> OK. How do you want this to be solved?
>
> I think that this needs to be split into 2 tickets:
> One for something similar to intersphinx and another similar for extlinks

Ah yes. I'd only really been thinking about intersphinx.

> ---------------
>
> For intersphix, we need some sort of configuration:
>
> intersphinx_mapping = {
> 'Crypto' : ('http://py.crypto.com/api', None)
> 'twisted: ('http://tm.tld/documentation/current/api', None)
> }
>
> When it fails to resole L{Crypto.some.stuff} it can check intersphinx inventory.
> Same for unresolved L{twisted.some.other.stuff}.
>
> Note that this only works for project using Sphinx for api...
>
> --------
>
> For extlinks, we need a mapping
>
> extlinks = {'Crypto': 'http://pythonhosted.org/pycrypto/%s.html'}
>
> So that unresolved L{Crypto.some.thing} will link to
> http://pythonhosted.org/pycrypto/Crypto.some.thing.html
>
> One option for extlinks is to map it to a function:
>
> extlinks = {'Crypto': 'plugin:crypto_resolver.mapper'}
>
> def crypto_resolver(name):
> return '%s/%s' % ('http://base', '/'.join(name.split('.')))
>
> crypt_resolver could then do a trial and error and check remote URL for
> name-module.html or name-class.html and return only valid links... this
> will be slow... but should be flexible.
>
> If exlinkg mapping start with plugin: it will try to import that
> method.
>
> ---------
>
> I see that PyCrypto uses epydocs and not pydoctor... so it does not have an objects.inv...
>
> Also, epydocs produces some ugly urls ... Crypto.Cipher.AES.AESCipher-class.html and Crypto.Cipher.blockalgo-module.html .. so is not easy to create a simple mapping

How many different things do we want to support here? Can we just add
support for intersphinx and then add support for epydoc? (I guess
epydoc is hard because you don't know from
L{Crypto.Cipher.AES.AESCipher} that it's a class. Does epydoc itself
support x-project linking?).

> I will keep this ticket for linking to generic 3rd party apis and will
> create a new ticket targeted for supporting intersphinx objects.inv

Cool, thanks.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.