Title: Contextualize scheme registration API · Issue #28 · python-hyper/hyperlink · GitHub
Open Graph Title: Contextualize scheme registration API · Issue #28 · python-hyper/hyperlink
X Title: Contextualize scheme registration API · Issue #28 · python-hyper/hyperlink
Description: hyperlink.register_scheme mutates global state. That's convenient but amounts to an import time side effect. If I do this in module a: from hyperlink import register_scheme register_scheme("blah") I have to do this in module b: from hype...
Open Graph Description: hyperlink.register_scheme mutates global state. That's convenient but amounts to an import time side effect. If I do this in module a: from hyperlink import register_scheme register_scheme("blah") ...
X Description: hyperlink.register_scheme mutates global state. That's convenient but amounts to an import time side effect. If I do this in module a: from hyperlink import register_scheme register_scheme(&quo...
Opengraph URL: https://github.com/python-hyper/hyperlink/issues/28
X: @github
Domain: github.com
IPv4 address: 140.82.113.4
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Contextualize scheme registration API","articleBody":"`hyperlink.register_scheme` mutates global state. That's convenient but amounts to an import time side effect. If I do this in module `a`:\r\n\r\n```python\r\nfrom hyperlink import register_scheme\r\nregister_scheme(\"blah\")\r\n```\r\n\r\nI have to do this in module `b`:\r\n\r\n```python\r\nfrom hyperlink import URL\r\nimport a\r\n\r\nu = URL.from_text(\"blah://blah.com\")\r\n```\r\n\r\nScheme registration should be localized, returning a new `URL`-like object that knows about the registered schemes. That would let `a` look like this:\r\n\r\n```python\r\nimport hyperlink.URL as _URL\r\n\r\nURL = _URL.schemes({\"blah\": \"blah\"})\r\n```\r\n\r\nSo that `b` could do this:\r\n\r\n```python\r\nfrom a import URL\r\n\r\nu = URL.from_text({\"blah\": \"blah\"})\r\n```\r\n\r\nA context manager might be useful, too:\r\n\r\n```python\r\nwith URL.schemes({\"blah\": \"blah\"}) as blah_url:\r\n u = blah_url.from_text(\"blah://blah.com\")\r\n```","author":{"url":"https://github.com/markrwilliams","@type":"Person","name":"markrwilliams"},"datePublished":"2017-07-03T07:22:13Z","url":"https://github.com/python-hyper/hyperlink/issues/28"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:2d48c0b2-c0a1-3a23-af1b-af583f2ab158 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C566:1F21:5E343B:809613:6B06E89E |
| html-safe-nonce | 5951ec1e710d75ad29074b97647208f23d1a00113f6983f7b9d3438ca43cb023 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDNTY2OjFGMjE6NUUzNDNCOjgwOTYxMzo2QjA2RTg5RSIsInZpc2l0b3JfaWQiOiIyMTIzMTc5MzQwNDAwNjE3NjMwIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 074b6ad8c2b979222d740592c60e9b50fadf616232edfad3da51676379988121 |
| hovercard-subject-tag | issue:240086992 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python-hyper/hyperlink/28/issue_layout |
| twitter:image | https://opengraph.githubassets.com/92102758d774dace25114ff58a4d082e724a0c77e4f8cb618a1790bc79894fd2/python-hyper/hyperlink/issues/28 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/92102758d774dace25114ff58a4d082e724a0c77e4f8cb618a1790bc79894fd2/python-hyper/hyperlink/issues/28 |
| og:image:alt | hyperlink.register_scheme mutates global state. That's convenient but amounts to an import time side effect. If I do this in module a: from hyperlink import register_scheme register_scheme("blah") ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | markrwilliams |
| hostname | github.com |
| expected-hostname | github.com |
| None | 351ea5ca38a5758919d44ee52c70fe9003c0c2dfa20f04effd7fac0c5330c16b |
| turbo-cache-control | no-preview |
| go-import | github.com/python-hyper/hyperlink git https://github.com/python-hyper/hyperlink.git |
| octolytics-dimension-user_id | 13035907 |
| octolytics-dimension-user_login | python-hyper |
| octolytics-dimension-repository_id | 82321340 |
| octolytics-dimension-repository_nwo | python-hyper/hyperlink |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 82321340 |
| octolytics-dimension-repository_network_root_nwo | python-hyper/hyperlink |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | af8913cd0f2f77c41796be449ac66a9108825abc |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width