Add `py` and `py3` to Python aliases by rvben · Pull Request #7791 · github-linguist/linguist · GitHub
Skip to content

Add py and py3 to Python aliases#7791

Merged
lildude merged 2 commits into
github-linguist:mainfrom
rvben:add-py-python-alias
Mar 2, 2026
Merged

Add py and py3 to Python aliases#7791
lildude merged 2 commits into
github-linguist:mainfrom
rvben:add-py-python-alias

Conversation

@rvben

@rvben rvben commented Feb 4, 2026

Copy link
Copy Markdown
Contributor

Summary

Add py as an alias for Python, matching how other popular languages handle short aliases.

Motivation

Python is the only major language without its common short alias:

Language Short Alias
JavaScript js
TypeScript ts
Ruby rb
Rust rs
Python py

In #4026 (2018), adding py was discussed and the response was:

"Let's keep the python3 alias only for now. We can always add new aliases if/when we see them being used."

Seven years later, py is extensively used in code blocks across GitHub. The alias is so expected that GitHub's markdown renderer added extension-based fallback to support ```py even without it being an official alias.

Impact

  • Tools using Linguist's find_by_alias() will recognize py
  • Aligns official aliases with GitHub's rendering behavior
  • Zero risk: no other language uses py

Changes

Add py to the Python aliases in lib/linguist/languages.yml.

@rvben rvben requested a review from a team as a code owner February 4, 2026 18:48
Comment thread lib/linguist/languages.yml
Co-authored-by: John Gardner <gardnerjohng@gmail.com>
@Alhadis Alhadis changed the title Add py as Python alias Add py and py3 to Python aliases Feb 5, 2026

@lildude lildude left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM. Thanks.

Important

The changes in this PR will not appear on GitHub until the next release has been made and deployed. See here for more details.

@lildude lildude added this pull request to the merge queue Mar 2, 2026
Merged via the queue into github-linguist:main with commit 6fc1cc6 Mar 2, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants