René's URL Explorer Experiment


Title: fix: Don't render environment paths in source block labels by cdwilson · Pull Request #338 · mkdocstrings/python · GitHub

Open Graph Title: fix: Don't render environment paths in source block labels by cdwilson · Pull Request #338 · mkdocstrings/python

X Title: fix: Don't render environment paths in source block labels by cdwilson · Pull Request #338 · mkdocstrings/python

Description: For reviewers I did not use AI I used AI and thoroughly reviewed every code/docs change Description of the change This PR is a follow-up to the discussion in #333 (and tinydantic/tinydantic#131): when an object's file lives in an in-project virtual environment, source block labels leaked the environment path, e.g. .venv/lib/python3.10/site-packages/pydantic/main.py The path is relative to the CWD, so it slipped past the is_absolute() check that normally keeps environment paths out of rendered docs. Just a heads up regarding scope vs. what we discussed in the issue: Claude found the same is_absolute()-only pattern at every source label site. Rather than copy the compound condition to five places, the label logic now lives in a single Jinja filter, source_location, used by every source block: paths containing a site-packages segment are truncated to the part below it otherwise, absolute paths fall back to relative_package_filepath as before ordinary project-relative paths render unchanged Truncating below site-packages (instead of switching to relative_package_filepath) also fixes labels for single-file modules installed directly in site-packages, whose package-relative path itself still contains the environment directory: label site before after merged __init__ inherited from an in-project venv .venv/lib/python3.10/site-packages/pydantic/main.py pydantic/main.py class / method labels from an in-project venv .venv/lib/python3.10/site-packages/pydantic/main.py pydantic/main.py single-file module (six.py-style distribution) site-packages/six.py six.py __init__ inherited from the same package src/pkg/base.py src/pkg/base.py (unchanged) Both themes are covered by tests parameterized over three scenarios: Merged __init__ A class with its methods A single-file module Relevant resources Closes #333: #333 Related to tinydantic/tinydantic#131: tinydantic/tinydantic#131 Assisted-by: Claude:claude-fable-5

Open Graph Description: For reviewers I did not use AI I used AI and thoroughly reviewed every code/docs change Description of the change This PR is a follow-up to the discussion in #333 (and tinydantic/tinydantic#13...

X Description: For reviewers I did not use AI I used AI and thoroughly reviewed every code/docs change Description of the change This PR is a follow-up to the discussion in #333 (and tinydantic/tinydantic#13...

Opengraph URL: https://github.com/mkdocstrings/python/pull/338

X: @github

direct link

Domain: github.com

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react-reconciler,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@d5750093facf
route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:9780afc3-0b08-8ebe-a52b-c0b1d0c36f6f
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-id89C6:5B1A8:BBA8BC:F7C8E9:6AF85D31
html-safe-nonce9420e32f14985286f2971bcf6b8e1aad41f023a3788d634d9bd6c649664b4593
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4OUM2OjVCMUE4OkJCQThCQzpGN0M4RTk6NkFGODVEMzEiLCJ2aXNpdG9yX2lkIjoiODU1NzgyODIwNTcyMzU0MDc4NSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac9a1ad86b1ec647106f6dd9b00fad1586553c37bb2d492c88e4fc2554af2ed068
hovercard-subject-tagpull_request:4293855744
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/mkdocstrings/python/pull/338/files
twitter:imagehttps://avatars.githubusercontent.com/u/14631?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/14631?s=400&v=4
og:image:altFor reviewers I did not use AI I used AI and thoroughly reviewed every code/docs change Description of the change This PR is a follow-up to the discussion in #333 (and tinydantic/tinydantic#13...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None5713ecd83001b2f55c3509fb7a292bf7d66d0f167c7ae87a9f7eaec5a52bf8db
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/mkdocstrings/python git https://github.com/mkdocstrings/python.git
octolytics-dimension-user_id75664361
octolytics-dimension-user_loginmkdocstrings
octolytics-dimension-repository_id422878404
octolytics-dimension-repository_nwomkdocstrings/python
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id422878404
octolytics-dimension-repository_network_root_nwomkdocstrings/python
turbo-body-classeslogged-out env-production page-responsive full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release653be32ff5c755082a4db662491bfbbcfc9112c1
ui-targetcanary-2
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/mkdocstrings/python/pull/338/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmkdocstrings%2Fpython%2Fpull%2F338%2Ffiles
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmkdocstrings%2Fpython%2Fpull%2F338%2Ffiles
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=mkdocstrings%2Fpython
Reloadhttps://github.com/mkdocstrings/python/pull/338/files
Reloadhttps://github.com/mkdocstrings/python/pull/338/files
Reloadhttps://github.com/mkdocstrings/python/pull/338/files
mkdocstringshttps://github.com/mkdocstrings
pythonhttps://github.com/mkdocstrings/python
Codehttps://github.com/mkdocstrings/python
Issues6 (6)https://github.com/mkdocstrings/python/issues
Pull requestshttps://github.com/mkdocstrings/python/pulls
Discussionshttps://github.com/mkdocstrings/python/discussions
Actionshttps://github.com/mkdocstrings/python/actions
Security and qualityhttps://github.com/mkdocstrings/python/security
Insightshttps://github.com/mkdocstrings/python/pulse
Sign up for GitHub https://github.com/signup?return_to=%2Fmkdocstrings%2Fpython%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2Fmkdocstrings%2Fpython%2Fissues%2Fnew%2Fchoose
pawamoyhttps://github.com/pawamoy
mkdocstrings:mainhttps://github.com/mkdocstrings/python/tree/main
cdwilson:fix/class-source-blockhttps://github.com/cdwilson/mkdocstrings-python/tree/fix/class-source-block
Conversation 1 https://github.com/mkdocstrings/python/pull/338
Commits 3 https://github.com/mkdocstrings/python/pull/338/commits
Checks 33 https://github.com/mkdocstrings/python/pull/338/checks
Files changed https://github.com/mkdocstrings/python/pull/338/files
Please reload this pagehttps://github.com/mkdocstrings/python/pull/338/files
fix: Don't render environment paths in source block labels https://github.com/mkdocstrings/python/pull/338/files#top
Show all changes 3 commits https://github.com/mkdocstrings/python/pull/338/files
5400e1c fix: Don't render environment paths in source block labels cdwilson Aug 14, 2026 https://github.com/mkdocstrings/python/pull/338/commits/5400e1c5981cac0dd7ce2d85ac01a2552d68eee4
c7b79ba fixup! fix: Don't render environment paths in source block labels cdwilson Aug 17, 2026 https://github.com/mkdocstrings/python/pull/338/commits/c7b79ba1b56c4b3af3fe932e29b06c52abdeb257
e2daa43 fixup! fix: Don't render environment paths in source block labels pawamoy Aug 17, 2026 https://github.com/mkdocstrings/python/pull/338/commits/e2daa4346693bf11b0274e73f4a14ea0078c804c
Clear filters https://github.com/mkdocstrings/python/pull/338/files
Please reload this pagehttps://github.com/mkdocstrings/python/pull/338/files
Please reload this pagehttps://github.com/mkdocstrings/python/pull/338/files
__init__.py https://github.com/mkdocstrings/python/pull/338/files#diff-65f5bff7a2afbd0487ac219d55bdab1870889ba3607cac54a8f3716c82014bc9
handler.py https://github.com/mkdocstrings/python/pull/338/files#diff-bb7e17dc823a4b1952764063ea285bc78f278c89a6f59e65fcdf8878c37a67ef
rendering.py https://github.com/mkdocstrings/python/pull/338/files#diff-1ccbf30e401944525f251064ddfa4089853f665a175f64b18317c942a71547a0
class.html.jinja https://github.com/mkdocstrings/python/pull/338/files#diff-5ec724d8e1ca85c2bcb316a9346702134311ad5038af773d1d30c942397a3302
function.html.jinja https://github.com/mkdocstrings/python/pull/338/files#diff-2298bf70fc99c4a7dff53e58c675b88df155f4922e564be44faffa903980b4ac
class.html.jinja https://github.com/mkdocstrings/python/pull/338/files#diff-1e885d34b76df4ad24a22804cb517c491c073cfa9fa3d113d25f0fa0fc8d38fd
test_handler.py https://github.com/mkdocstrings/python/pull/338/files#diff-3f86b181ab338949acfc1d27ff975b666acd3f0b016eb4bcce7c79fab09e463b
src/mkdocstrings_handlers/python/__init__.pyhttps://github.com/mkdocstrings/python/pull/338/files#diff-65f5bff7a2afbd0487ac219d55bdab1870889ba3607cac54a8f3716c82014bc9
View file https://github.com/cdwilson/mkdocstrings-python/blob/e2daa4346693bf11b0274e73f4a14ea0078c804c/src/mkdocstrings_handlers/python/__init__.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/mkdocstrings/python/pull/338/{{ revealButtonHref }}
https://github.com/mkdocstrings/python/pull/338/files#diff-65f5bff7a2afbd0487ac219d55bdab1870889ba3607cac54a8f3716c82014bc9
https://github.com/mkdocstrings/python/pull/338/files#diff-65f5bff7a2afbd0487ac219d55bdab1870889ba3607cac54a8f3716c82014bc9
https://github.com/mkdocstrings/python/pull/338/files#diff-65f5bff7a2afbd0487ac219d55bdab1870889ba3607cac54a8f3716c82014bc9
https://github.com/mkdocstrings/python/pull/338/files#diff-65f5bff7a2afbd0487ac219d55bdab1870889ba3607cac54a8f3716c82014bc9
src/mkdocstrings_handlers/python/_internal/handler.pyhttps://github.com/mkdocstrings/python/pull/338/files#diff-bb7e17dc823a4b1952764063ea285bc78f278c89a6f59e65fcdf8878c37a67ef
View file https://github.com/cdwilson/mkdocstrings-python/blob/e2daa4346693bf11b0274e73f4a14ea0078c804c/src/mkdocstrings_handlers/python/_internal/handler.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/mkdocstrings/python/pull/338/{{ revealButtonHref }}
https://github.com/mkdocstrings/python/pull/338/files#diff-bb7e17dc823a4b1952764063ea285bc78f278c89a6f59e65fcdf8878c37a67ef
https://github.com/mkdocstrings/python/pull/338/files#diff-bb7e17dc823a4b1952764063ea285bc78f278c89a6f59e65fcdf8878c37a67ef
src/mkdocstrings_handlers/python/_internal/rendering.pyhttps://github.com/mkdocstrings/python/pull/338/files#diff-1ccbf30e401944525f251064ddfa4089853f665a175f64b18317c942a71547a0
View file https://github.com/cdwilson/mkdocstrings-python/blob/e2daa4346693bf11b0274e73f4a14ea0078c804c/src/mkdocstrings_handlers/python/_internal/rendering.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/mkdocstrings/python/pull/338/{{ revealButtonHref }}
https://github.com/mkdocstrings/python/pull/338/files#diff-1ccbf30e401944525f251064ddfa4089853f665a175f64b18317c942a71547a0
https://github.com/mkdocstrings/python/pull/338/files#diff-1ccbf30e401944525f251064ddfa4089853f665a175f64b18317c942a71547a0
https://github.com/mkdocstrings/python/pull/338/files#diff-1ccbf30e401944525f251064ddfa4089853f665a175f64b18317c942a71547a0
https://github.com/mkdocstrings/python/pull/338/files#diff-1ccbf30e401944525f251064ddfa4089853f665a175f64b18317c942a71547a0
src/mkdocstrings_handlers/python/templates/material/_base/class.html.jinjahttps://github.com/mkdocstrings/python/pull/338/files#diff-5ec724d8e1ca85c2bcb316a9346702134311ad5038af773d1d30c942397a3302
View file https://github.com/cdwilson/mkdocstrings-python/blob/e2daa4346693bf11b0274e73f4a14ea0078c804c/src/mkdocstrings_handlers/python/templates/material/_base/class.html.jinja
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/mkdocstrings/python/pull/338/{{ revealButtonHref }}
https://github.com/mkdocstrings/python/pull/338/files#diff-5ec724d8e1ca85c2bcb316a9346702134311ad5038af773d1d30c942397a3302
https://github.com/mkdocstrings/python/pull/338/files#diff-5ec724d8e1ca85c2bcb316a9346702134311ad5038af773d1d30c942397a3302
src/mkdocstrings_handlers/python/templates/material/_base/function.html.jinjahttps://github.com/mkdocstrings/python/pull/338/files#diff-2298bf70fc99c4a7dff53e58c675b88df155f4922e564be44faffa903980b4ac
View file https://github.com/cdwilson/mkdocstrings-python/blob/e2daa4346693bf11b0274e73f4a14ea0078c804c/src/mkdocstrings_handlers/python/templates/material/_base/function.html.jinja
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/mkdocstrings/python/pull/338/{{ revealButtonHref }}
https://github.com/mkdocstrings/python/pull/338/files#diff-2298bf70fc99c4a7dff53e58c675b88df155f4922e564be44faffa903980b4ac
https://github.com/mkdocstrings/python/pull/338/files#diff-2298bf70fc99c4a7dff53e58c675b88df155f4922e564be44faffa903980b4ac
src/mkdocstrings_handlers/python/templates/readthedocs/_base/class.html.jinjahttps://github.com/mkdocstrings/python/pull/338/files#diff-1e885d34b76df4ad24a22804cb517c491c073cfa9fa3d113d25f0fa0fc8d38fd
View file https://github.com/cdwilson/mkdocstrings-python/blob/e2daa4346693bf11b0274e73f4a14ea0078c804c/src/mkdocstrings_handlers/python/templates/readthedocs/_base/class.html.jinja
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/mkdocstrings/python/pull/338/{{ revealButtonHref }}
https://github.com/mkdocstrings/python/pull/338/files#diff-1e885d34b76df4ad24a22804cb517c491c073cfa9fa3d113d25f0fa0fc8d38fd
https://github.com/mkdocstrings/python/pull/338/files#diff-1e885d34b76df4ad24a22804cb517c491c073cfa9fa3d113d25f0fa0fc8d38fd
tests/test_handler.pyhttps://github.com/mkdocstrings/python/pull/338/files#diff-3f86b181ab338949acfc1d27ff975b666acd3f0b016eb4bcce7c79fab09e463b
View file https://github.com/cdwilson/mkdocstrings-python/blob/e2daa4346693bf11b0274e73f4a14ea0078c804c/tests/test_handler.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/mkdocstrings/python/pull/338/{{ revealButtonHref }}
https://github.com/mkdocstrings/python/pull/338/files#diff-3f86b181ab338949acfc1d27ff975b666acd3f0b016eb4bcce7c79fab09e463b
https://github.com/mkdocstrings/python/pull/338/files#diff-3f86b181ab338949acfc1d27ff975b666acd3f0b016eb4bcce7c79fab09e463b
https://github.com/mkdocstrings/python/pull/338/files#diff-3f86b181ab338949acfc1d27ff975b666acd3f0b016eb4bcce7c79fab09e463b
Please reload this pagehttps://github.com/mkdocstrings/python/pull/338/files
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.