Opened 18 years ago

Closed 14 years ago

#38 defect closed fixed (fixed)

Should be a way to create documentation aliases

Reported by: radix Owned by:
Priority: high Milestone:
Component: website Keywords: documentation
Cc: radix, spiv, Jean-Paul Calderone, Michael Hudson-Doyle, Nicola Larosa, oubiwann Branch:

Description (last modified by Nicola Larosa)

Ehi... :-)

Change History (29)

comment:1 Changed 18 years ago by radix

Some of the links to API documentation from link
to pages that return 404.

For example, the section that reads "First we look at
the server. This defines an Echoer class (derived from
pb.Root), with a method called remote_echo() ..." links
which is a 404.

WebCVS says that the source doc for this looks like:

<p>First we look at the server. This defines an Echoer
class (derived from
<code class="API"
base="twisted.spread">pb.Root</code>), with a method called

Don't know enough Twisted to say whether this is a bug
in the docs or in Lore or whether the docs are out of date.

comment:2 Changed 18 years ago by spiv

The pb.Root link is broken because Root is actually defined
in twisted/spread/, and is merely imported by, so epydoc doesn't document it.  Unfortunately,
typical use is to import it from pb, so the HOWTO is
correct.  I'm not sure what the right fix for this is.

(This is probably a good reason to avoid nasty "promotion"
hacks where a class is defined in one module, but only
documented publicly as available from another.  Yes, I'm
thinking about flow here ;)

comment:3 Changed 18 years ago by radix

so, you fixed the function thing already, right? then all
that's left is this "alias" thing.

Here are the ways I can think of fixing it.

 * Similar to my idea (that you didn't like) about the
function problem, we could have lore do a o =
namedObject(aliasname), then *actually* like to qual(o). I
know you don't like this.  :-)

 * Manually maintain a list of aliases for lore to look up
all api links in and replace.

 * Add more markup to allow the text of the link to be
different from the actual api link.

comment:4 Changed 18 years ago by spiv

Yep, functions links are fixed (in CVS, anyway).

 * Yep, still don't like it, especially for such a minor bug.

 * Keeping an explicit list of aliases is pretty sucky, but
not as bad as your first suggestion :)

 * Yuck, I don't like the idea of markup for that.  What
about the print form -- epydoc can produce latex, so it
would be possible to make Lore link to API docs in print. 
But if the reader sees "pb.Root (page 434)" and then turns
to 434 and finds the documentation for the flavors module,
they'll be confused.

I think what the best solution would be is to mark the alias
in the *source*.  We should do this anyway; what if some
later maintainer deleted the "from flavors import Root" line
in because it wasn't needed by the code in
anymore?  There should be some sign in the source that a
variable is part of the public API of a module, even if it
is just an import from elsewhere.

If we did that, then we could fix epydoc, not Lore :)

This makes sense to me, because "pb.Root" is an API, and it
should appear in the API docs...

comment:5 Changed 18 years ago by radix

Soo... something like, in

from twisted.python.epysupport import alias
alias('twisted.spread.flavors.Root', 'twisted.spread.pb.Root')

or maybe 
alias(flavors.Root, 'twisted.spread.pb.Root')

or just
alias(flavors.Root) with a hack to look in the caller's
namespace to see which module he's coming from ;)

comment:6 Changed 18 years ago by spiv

Yeah, something like that sounds good.  

I'm assigning this to me... I'll try find some time to see
how easy/hard this is to do sometime in the next few days.

comment:7 Changed 18 years ago by itamarst

How's this going?

comment:8 Changed 18 years ago by radix

Itamar Shtull-Trauring <> added the comment:
> How's this going?

Still no progress, still haven't figured out how to continue.

comment:9 Changed 18 years ago by spiv

So, we could just "fix" this with a nasty hack: just define a trivial subclass
in, e.g.:

    class Root(flavors.Root):

Actually, I guess the proposed alias function could do this... but working with
epydoc rather than hacking around it is probably a better idea.

comment:10 Changed 18 years ago by Moshe Zadka

I thought of this.
It bothered me because of persistence constraints.

comment:11 Changed 18 years ago by teratorn

At #38 this issue wins the prize for oldest unresolved bug ;)

If it's not gonna be fixed, can we just mark it done-cbb and move along?

comment:12 Changed 18 years ago by radix

It's not done at all, and it stil has to be fixed. :-(

comment:13 Changed 16 years ago by Jean-Paul Calderone

Cc: Jean-Paul Calderone Michael Hudson-Doyle added
Component: website
Owner: changed from spiv to Michael Hudson-Doyle

I think docextractor has a plan to deal with this?

comment:14 Changed 16 years ago by Michael Hudson-Doyle

Well, um, given that we control all the software involved, we could certainly come up with a plan. I don't really have one yet, though. It ought to be easy to recognise this "alias" function.

(wasn't there another bug almost exactly like this? ah, yes #1143)

comment:15 Changed 16 years ago by Jean-Paul Calderone

FWIW, for some reason, I don't really like the alias() plan. We are already annotating the module with its public API, by way of all. Would it be much harder to detect that instead (assuming it is all static and non-magical, of course)? I'd be happy to do some work on this, if we can get everyone to agree it's the right thing.

comment:16 Changed 16 years ago by Michael Hudson-Doyle

twisted/spread/ doesn't define __all__, although it could. I guess you could say I really don't like __all__ for some reason :)

It shouldn't be at all hard to detect, though.

comment:17 Changed 15 years ago by jknight

(Reposting comment from #1653, which was a duplicate of this):

This is an issue for e.g. twisted.internet.stdio. It imports one of _win32stdio or _posixstdio. But those are implementation details. Docs should show up under the t.i.stdio module, somehow. (Let's leave aside that the StandardIO class doesn't currently _have_ documentation: at least the class definition should show up.)

comment:18 Changed 15 years ago by jknight

Summary: Some PB usage HOWTO links are 404sShould be a way to create documentation aliases

comment:19 Changed 15 years ago by Nicola Larosa

Cc: Nicola Larosa added

comment:20 Changed 15 years ago by Michael Hudson-Doyle

Well, I have the _opposite_ of a fix at

(look where the pb.Referenceable link goes).

Sadly, I'm not sure this gets us any closer to a proper fix to the problem.

comment:21 Changed 15 years ago by oubiwann

Cc: oubiwan added

comment:22 Changed 15 years ago by Nicola Larosa

Cc: oubiwann added; oubiwan removed
Description: modified (diff)

comment:23 Changed 15 years ago by Michael Hudson-Doyle

Is there anything even approaching a consensus on how to proceed here? I'm now at a point where I think there are no real technical obstacles. The most likely approach seems to be to be defining an {{all}} in spread/, having pydoctor notice when a name from {{all}} is imported into a module and doing the appropriate magic.

Who knows what should go in pb.all ? Here's an automatically derived guess:

set(['Cacheable', 'portno', 'Copyable', 'RemoteReference', 'Viewable', 
'RemoteCache', 'authIdentity', 'ProtocolError', 'getObjectAt', 'ViewPoint',
'PBServerFactory', 'setUnjellyableForClass', 'Broker', 'Referenceable', 
'setCopierForClassTree', 'setCopierForClass', 'RemoteCopy', 'PBClientFactory', 
'Avatar', 'IPerspective', 'Root', 'failure2Copyable', 'DeadReferenceError', 

comment:24 Changed 15 years ago by Michael Hudson-Doyle

OK, the pydoctor part of this is done. Has some slightly surprising consequences, like SelectReactor becoming part of twisted.internet.default:

comment:25 Changed 15 years ago by Jean-Paul Calderone

+1 on __all__

comment:26 Changed 14 years ago by Glyph

So, the URL that mwh points to here actually doesn't show SelectReactor as part of twisted.internet.default. Maybe it did at one point? Or maybe it's an option or something? We should generate the API docs with a recent version of pydoctor and see what they look like, because this sounds like it might already be done to me.

comment:27 Changed 14 years ago by Glyph

The URL that MWH points to here now does show SelectReactor. Hooray! I think the thing to do now is to close this ticket - our oldest open ticket! - and open a new one that deals with the specific PB documentation links issue.

comment:28 Changed 14 years ago by Glyph

Resolution: fixed
Status: newclosed

See #3139 for the remaining issue originally referred to. I believe the tools now do what we need, which is what this issue was really about.

comment:29 Changed 11 years ago by <automation>

Owner: Michael Hudson-Doyle deleted
Note: See TracTickets for help on using tickets.