Skip to content

Initial full TOC structure for typing docs content #919

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 21, 2021

Conversation

shannonzhu
Copy link
Contributor

Happy to see initial content landing for type system documentation. In order to avoid repeat topics or a tangled refactoring job later on, I'm looking to propose an initial TOC structure for topics we think are valuable to cover. Hopefully this can serve as a starting point to branch off of, and to fill in as we go.

The existing two pages have content that we may want to split up in the future, i.e., the current "libraries" page tackles general topics like type aliases, decorators, etc. I've left that content untouched and just linked to those pages for now, to avoid tackling too much in this PR discussion.

RFC on the details of the contents and structure here. I'm hoping we can settle on something that is both clear and easy to skim for a developer who is just starting to familiarize with the basics, but that also provides organized in-depth guidance for developers who work with types but need to iron out a complex typing issue or understand an advanced topic. Is anything missing?

For easier visualization of initial TOC structure proposed here:
Screen Shot 2021-11-02 at 5 37 24 PM

Copy link
Collaborator

@hauntsaninja hauntsaninja left a comment

Choose a reason for hiding this comment

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

Hooray! I left a random sprinkling of thoughts, none particularly important. Overall this matches up fairly well with the existing mypy docs :-)

@@ -0,0 +1,3 @@
**********
The Basics
Copy link
Collaborator

Choose a reason for hiding this comment

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

mypy's cheat sheet (https://mypy.readthedocs.io/en/latest/cheat_sheet_py3.html) is the most visited page in mypy's documentation, I'm assuming this will be something similar?

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


Runtime Considerations
Copy link
Collaborator

Choose a reason for hiding this comment

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

If it's useful, I recently rewrote mypy's documentation for this: https://mypy.readthedocs.io/en/latest/runtime_troubles.html

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

Advanced Types
--------------
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm guessing Literal goes in here?

-----------


Protocols and Duck Typing
Copy link
Collaborator

Choose a reason for hiding this comment

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

I assume this is where we cover int <: float <: complex and the other special cases?

Classes
=======

Overloads and Overrides
Copy link
Collaborator

Choose a reason for hiding this comment

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

Overloads feels more functions-y, is overrides meant to talk about Liskov Substitution Principle? Potentially worth separating

The Class Hierarchy
===================

Mutable Containers
Copy link
Collaborator

Choose a reason for hiding this comment

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

It might make sense to move the section to where we introduce generics, since it's hard to have any discussion of variance without examples.

=============


Type Variables
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe type variables should be introduced before generic types?

@sirosen
Copy link
Contributor

sirosen commented Dec 21, 2021

I've been waiting until this lands to work on python/mypy#11506 , but it looks like it's maybe stalled.
Can I help push this forward? e.g. I can do another revision on top of this.

@shannonzhu
Copy link
Contributor Author

@sirosen Thanks for pinging on this PR again!

Would love to unblock documentation work and any changes on top of this initial structure - if no objections, can we merge it?

cc @JelleZijlstra (not sure what the best way is to flag to someone with write access)

@JelleZijlstra JelleZijlstra merged commit 80cfad0 into python:master Dec 21, 2021
@shannonzhu
Copy link
Contributor Author

shannonzhu commented Dec 21, 2021

Thanks Jelle! :)

I'll plan on putting up another iteration of TOC with some more details and a few of @hauntsaninja's suggestions from above. Will wait on @sirosen to stack anything first.

@srittau
Copy link
Collaborator

srittau commented Dec 21, 2021

It seems that the links to the two existing documents and the reference documentation have vanished. Could we please restore them?

@srittau
Copy link
Collaborator

srittau commented Dec 21, 2021

Also, I'm not too happy that we have only empty documents now. I suggest to comment out all links to non-existing documentation for now. Empty documents are worse than non-existing documentation, as they lower the confidence of users coming across this page that there is useful content behind the links.

@sirosen
Copy link
Contributor

sirosen commented Dec 21, 2021

I'll look at doing a cleanup PR now, ahead of doing any further work. I'm just "claiming" this to hopefully save others the duplicate work.

I suggest to comment out all links to non-existing documentation for now.

I'm going to remove these from toctree directives, but leave the old docs in place. Sphinx will warn about the pages being built but not included in any toctrees, but I think that's best.

Where appropriate, I can comment out whole toctrees. I'll try to figure out something which works.

It seems that the links to the two existing documents and the reference documentation have vanished. Could we please restore them?

I only see the link to https://docs.python.org/3/library/typing.html having been removed. Was there another one I'm missing in the diff?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA signed topic: documentation Documentation-related issues and PRs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants