GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Add a Sphinx role to link to GitHub labels by hugovk · Pull Request #932 · python/devguide

Conversation

@hugovk

@hugovk hugovk commented Aug 8, 2022

Copy link
Copy Markdown
Member

This adds a :gh-label: role to link to a GitHub label on https://github.com/python/cpython.

For example:

  • `:gh-label:`docs` -> https://github.com/python/cpython/issues?q=is%3Aopen+sort%3Aupdated-desc+label%3Adocs

  • :gh-label:`skip news` -> https://github.com/python/cpython/issues?q=is%3Aopen+sort%3Aupdated-desc+label%3A%22skip+news%22

This makes it easy to click through to see recent examples of the actual label in use.

It also helps #821 because we can click through and find which labels have since been deleted (e.g. invalid) or renamed (library).

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

erlend-aasland reacted with thumbs up emoji erlend-aasland reacted with rocket emoji
All reactions
  • 👍 1 reaction
  • 🚀 1 reaction
@hugovk
Add a Sphinx role to link to GitHub labels
47d0ca7
erlend-aasland
erlend-aasland approved these changes Aug 8, 2022
View reviewed changes

@erlend-aasland erlend-aasland left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Neat!

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@ezio-melotti

ezio-melotti commented Aug 8, 2022

Copy link
Copy Markdown
Member

This makes it easy to click through to see recent examples of the actual label in use.

This might also be helpful in a couple of other places in the devguide that link e.g. to doc or easy issues, but I wonder if it's a bit overkill to create a role just for it 🤔

It also helps #821 because we can click through and find which labels have since been deleted (e.g. invalid) or renamed (library).

This will only work by clicking through the links manually, right? Even invalid labels will return a valid search page with no results, so we won't be able to detect them automatically. Also, FWIW, I'm fixing that section in #930.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@hugovk

hugovk commented Aug 9, 2022

Copy link
Copy Markdown
Member Author

This might also be helpful in a couple of other places in the devguide that link e.g. to doc or easy issues, but I wonder if it's a bit overkill to create a role just for it 🤔

My thinking behind creating a role was that we can define all the params stuff in a single place, and it'll then also be consistent. Using GitHub's defaults here:

https://github.com/python/cpython/issues?q=is%3Aopen+sort%3Aupdated-desc+label%3Afoo

It also deals with escaping and quoting labels that contains spaces.


This will only work by clicking through the links manually, right?

Yep.

Even invalid labels will return a valid search page with no results, so we won't be able to detect them automatically.

Correct, just for manual checking.

Also, FWIW, I'm fixing that section in #930.

Great, I knew you were working on it somewhere, thank you!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@terryjreedy

terryjreedy commented Aug 9, 2022

Copy link
Copy Markdown
Member

Any particular reason to sort by last update rather than the default of opening time? I don't know if it makes any difference on the load on GH. docs takes several seconds to return about 1200. Seems like overkill for examples.

erlend-aasland reacted with eyes emoji
All reactions
  • 👀 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@hugovk

hugovk commented Aug 9, 2022

Copy link
Copy Markdown
Member Author

I used the default options GitHub gave me after clicking one of the labels in the issue list, at https://github.com/python/devguide/issues

Here's timings in a fresh Incognito window with local cache disabled, 3 loads for each.

The URLs used in this PR:

  • https://github.com/python/cpython/issues?q=is%3Aopen+sort%3Aupdated-desc+label%3Adocs
  • 5.81s
  • 6.25s
  • 6.55s
  • Average: 6.20s

image

The same but removing the sort%3Aupdated-desc parameter:

  • https://github.com/python/cpython/issues?q=is%3Aopen+label%3Adocs
  • Resolved to https://github.com/python/cpython/labels/docs in the URL bar
  • 4.71s
  • 8.03s
  • 5.98s
  • Average: 6.24s

image

About the same?

But perhaps using the https://github.com/python/cpython/labels/docs form is the neatest?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@erlend-aasland

erlend-aasland commented Aug 9, 2022

Copy link
Copy Markdown
Contributor

But perhaps using the https://github.com/python/cpython/labels/docs form is the neatest?

Definitely; I'd go for that.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

hugovk added 2 commits August 10, 2022 08:27
@hugovk
Link to https://github.com/python/cpython/labels/{LABEL-NAME}
8928ba6
@hugovk
Add a working example for 'needs backport to X.Y'
cb31138
@hugovk

hugovk commented Aug 10, 2022

Copy link
Copy Markdown
Member Author

Updated!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ezio-melotti

ezio-melotti commented Aug 10, 2022

Copy link
Copy Markdown
Member

This might also be helpful in a couple of other places in the devguide that link e.g. to doc or easy issues

I searched through the devguide and I can confirm these are the only two places where they are currently used, but they link to issues only so we might not be able to use the new role if it links to https://github.com/python/cpython/labels/{LABEL-NAME}:

devguide/documentation/help-documenting.rst

Line 66 in e807042

.. _documentation issues: https://github.com/python/cpython/issues?q=is%3Aissue+is%3Aopen+label%3Adocs

devguide/getting-started/fixing-issues.rst

Line 25 in e807042

.. _"easy" issues: https://github.com/python/cpython/issues?q=is%3Aissue+is%3Aopen+label%3Aeasy

In #930 I can add links to all the labels (the currently proposed link would work fine there), and I was also planning to add a page with several useful search queries (there it won't work). In addition in #930 I have another link that won't be able to use the role: https://github.com/python/cpython/labels?q=expert.

IOW, it looks like this role will be only useful in the page that lists the label, unless we make it more flexible.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@hugovk

hugovk commented Oct 5, 2022

Copy link
Copy Markdown
Member Author

Yep, that's right.

Originally this PR used ugly links like https://github.com/python/cpython/issues?q=is%3Aopen+sort%3Aupdated-desc+label%3Adocs, but now has nicer ones like https://github.com/python/cpython/labels/docs

So it's less useful than before, but I think it's more readable to see :gh-label:docs` than a long link.

But I'm happy to close this, or replace with normal links, or wait for normal links in #930 :)

ezio-melotti reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ezio-melotti ezio-melotti self-assigned this Oct 7, 2022
@ezio-melotti
ezio-melotti merged commit 7a2a18b into python:main Oct 7, 2022
@ezio-melotti ezio-melotti mentioned this pull request Oct 7, 2022
Add links to files in internals/parser.rst #960
Closed
@hugovk
hugovk deleted the label-role branch October 7, 2022 16:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@erlend-aasland erlend-aasland erlend-aasland approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@ezio-melotti ezio-melotti

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@hugovk @ezio-melotti @terryjreedy @erlend-aasland
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.