{"id":25477425,"url":"https://github.com/stupidcodefactory/pydn2","last_synced_at":"2026-02-16T14:33:01.405Z","repository":{"id":277052517,"uuid":"931179022","full_name":"StupidCodeFactory/pydn2","owner":"StupidCodeFactory","description":"python wrapper for libidn2","archived":false,"fork":false,"pushed_at":"2025-02-12T17:38:00.000Z","size":21,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-29T05:24:19.353Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/StupidCodeFactory.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-02-11T21:00:50.000Z","updated_at":"2025-02-12T17:37:15.000Z","dependencies_parsed_at":null,"dependency_job_id":"210bad32-e29e-4405-ac20-660d260e68d4","html_url":"https://github.com/StupidCodeFactory/pydn2","commit_stats":null,"previous_names":["stupidcodefactory/pydn2"],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/StupidCodeFactory/pydn2","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StupidCodeFactory%2Fpydn2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StupidCodeFactory%2Fpydn2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StupidCodeFactory%2Fpydn2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StupidCodeFactory%2Fpydn2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/StupidCodeFactory","download_url":"https://codeload.github.com/StupidCodeFactory/pydn2/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StupidCodeFactory%2Fpydn2/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29510190,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-16T09:05:14.864Z","status":"ssl_error","status_checked_at":"2026-02-16T08:55:59.364Z","response_time":115,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-02-18T13:47:10.470Z","updated_at":"2026-02-16T14:33:01.391Z","avatar_url":"https://github.com/StupidCodeFactory.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pydn2\n\n**pydn2** is a Python binding for [libidn2](https://libidn.gitlab.io/libidn2/), the GNU implementation of the Internationalized Domain Names (IDNA) protocol (IDNA2008/TR46). This extension enables you to perform various domain name conversions—such as converting between Unicode (U-label) and ASCII-compatible (A-label) representations—and supports the full public API of libidn2.\n\n## Features\n\n- **Conversion Functions**\n  - Convert Unicode domain names to their ASCII (Punycode) equivalents.\n  - Convert Punycode domains back to Unicode.\n  - Perform lookup conversions for registration and DNS lookup.\n- **Error Handling**\n  - Retrieve human-readable error messages and error code names.\n- **Compliance with IDNA2008/TR46**\n  - Uses flags to control normalization and processing (e.g. NFC, transitional/non-transitional).\n\n## Requirements\n\n- **libidn2**\n  Make sure [libidn2](https://www.gnu.org/software/libidn/libidn2/manual/libidn2.html) is installed on your system. On macOS with Homebrew, you can install it via:\n  ```bash\n  brew install libidn2\n  ```\n  On linux debian based system:\n  ```bash\n  sudo apt-get -y install libidn2-0 libidn2-dev\n  ```\n- A C compiler that supports building Python C extensions.\n- Python 3.9–3.12 (and possibly newer versions if you update the CI matrix).\n\n## Installation\n\n```bash\npip install pydn2\n```\n\n## Usage\n\n```python\nimport pydn2\n\n# Convert a Unicode domain to its ASCII (Punycode) representation:\nascii_domain = pydn2.to_ascii_8z(\"bücher\", 0)\nprint(ascii_domain)  # e.g., \"xn--bcher-kva\"\n\n# Convert a Punycode domain back to Unicode:\nunicode_domain = pydn2.to_unicode_8z8z(\"xn--bcher-kva\", 0)\nprint(unicode_domain)  # e.g., \"bücher\"\n\n# You can also use flags for additional processing:\nascii_domain_transitional = pydn2.to_ascii_8z(\"☮️.com\", pydn2.IDN2_NFC_INPUT | pydn2.IDN2_TRANSITIONAL)\nprint(ascii_domain_transitional)\n```\n\n## Module Constants\n\nThe extension exposes several flag constants for controlling conversion behavior:\n- IDN2_NFC_INPUT – Apply NFC normalization on input.\n- IDN2_ALABEL_ROUNDTRIP – Apply additional round-trip conversion of A-label inputs.\n- IDN2_TRANSITIONAL – Perform Unicode TR46 transitional processing.\n- IDN2_NONTRANSITIONAL – Perform Unicode TR46 non-transitional processing (default).\n- IDN2_NO_TR46 – Disable any TR46 transitional or non-transitional processing.\n- IDN2_USE_STD3_ASCII_RULES – Use STD3 ASCII rules.\n\n\n## Benchmark\n\n| Method                    | Conversion Output | Single-thread Benchmark (sec, 1,000,000 iterations) | Multi-thread Benchmark (sec, 1,000,000 iterations) |\n|---------------------------|-------------------|----------------------------------------------------:|---------------------------------------------------:|\n| **pydn2 (IDNA2008/TR46)** | `xn--i-n3p.com`   |                                            1.170304 |                                           1.156370 |\n| **builtin (IDNA2003)**    | `xn--i-n3p.com`   |                                            6.716825 |                                           6.674858 |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstupidcodefactory%2Fpydn2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstupidcodefactory%2Fpydn2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstupidcodefactory%2Fpydn2/lists"}