{"id":17929596,"url":"https://github.com/angrybayblade/ph7","last_synced_at":"2025-03-24T04:31:04.799Z","repository":{"id":220908644,"uuid":"752122629","full_name":"angrybayblade/ph7","owner":"angrybayblade","description":"💧 Python native HTML rendering","archived":false,"fork":false,"pushed_at":"2024-09-22T03:28:48.000Z","size":3070,"stargazers_count":6,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-19T01:46:28.316Z","etag":null,"topics":["css","django","flask","html","js","template-engine","web"],"latest_commit_sha":null,"homepage":"https://angrybayblade.github.io/ph7/","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/angrybayblade.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}},"created_at":"2024-02-03T04:56:06.000Z","updated_at":"2025-01-21T13:22:08.000Z","dependencies_parsed_at":"2024-02-05T05:28:32.381Z","dependency_job_id":"779db7ab-cbe7-45df-b9d8-8aad6fd18035","html_url":"https://github.com/angrybayblade/ph7","commit_stats":null,"previous_names":["angrybayblade/ph7"],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/angrybayblade%2Fph7","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/angrybayblade%2Fph7/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/angrybayblade%2Fph7/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/angrybayblade%2Fph7/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/angrybayblade","download_url":"https://codeload.github.com/angrybayblade/ph7/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245210939,"owners_count":20578318,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["css","django","flask","html","js","template-engine","web"],"created_at":"2024-10-28T21:09:45.963Z","updated_at":"2025-03-24T04:31:04.312Z","avatar_url":"https://github.com/angrybayblade.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":" \u003cdiv style=\"display:flex; align-items: center; justify-content: center;\"\u003e\n    \u003ch1\u003e💧 PH7\u003c/h1\u003e\n\u003c/div\u003e\n\u003cdiv style=\"display:flex; align-items: center; justify-content: center;\"\u003e\n    Python native HTML templates\n\u003c/div\u003e\n\n## Why PH7?\n\n* Native to python\n* More code modularity\n* Easy to write reusable components\n* Out of the box editor support\n    * Syntax highlighting\n    * Code navvigation tools\n    * Auto-completion\n*  Type safety using MyPy\n\n\n## Install\n```\npip3 install ph7\n```\n\n## Quickstart\n\nWrite your first block of markup\n\n\u003c!-- {\"type\": \"html\", \"file\": \"examples/hello.py\"} --\u003e\n```python\nfrom ph7.html import body, div, html\n\ntemplate = html(\n    body(\n        div(\n            \"Hello, World!\",\n        )\n    )\n)\n\nprint(template)\n```\n\n```html\n\u003chtml\u003e\n  \u003cbody\u003e\n    \u003cdiv\u003eHello, World!\u003c/div\u003e\n  \u003c/body\u003e\n\u003c/html\u003e\n```\n\u003c!-- end --\u003e\n\nOr write a CSS class\n\n\u003c!-- {\"type\": \"css\", \"file\": \"examples/css_example.py\"} --\u003e\n```python\nfrom ph7.css import CSSObject\n\n\nclass flex_center(CSSObject):\n    \"\"\"Flex center\"\"\"\n\n    display = \"flex\"\n    align_items = \"center\"\n    justify_content = \"center\"\n\n\nprint(flex_center())\n```\n\n```css\n.flex-center {\n  display: flex;\n  align-items: center;\n  justify-content: center;\n}\n```\n\u003c!-- end --\u003e\n\nOr use python function as JavaScript function\n\n\n\u003c!-- {\"type\": \"js\", \"file\": \"examples/js_example.py\"} --\u003e\n```python\nfrom ph7.js import as_js, console, document, fetch\n\n\nasync def fetchDog():\n    response = await fetch(\n        \"https://dog.ceo/api/breeds/image/random\",\n        {\"method\": \"GET\"},\n    )\n    if response.status != 200:\n        response_body = await response.text()\n        console.log(f\"Error fetching dog; {response_body}\")\n        return\n    data = await response.json()\n    document.getElementById(\"image\").src = data.message\n\n\nprint(as_js(fetchDog))\n```\n\n```js\nasync function fetchDog() {\n  let response = await fetch('https://dog.ceo/api/breeds/image/random', {\n    'method': 'GET'\n  });\n  if (response.status != 200) {\n    let response_body = await response.text();\n    console.log('Error fetching dog; ' + response_body);\n    return;\n  };\n  let data = await response.json();\n  document.getElementById('image').src = data.message;\n};\n```\n\u003c!-- end --\u003e\n\nPH7 is still in beta-development. It will be production ready with following enhancements\n\n- [ ] Remove performance bottlenecks\n- [ ] Unit testing support\n\nFurther improvements\n\n- [ ] Typed context for type safety\n\nLinks:\n\n* [Documentation](http://ph7.angrybayblade.me)\n* [Changelog](https://github.com/angrybayblade/ph7/blob/main/docs/CHANGELOG)\n* [Issue Tracker](https://github.com/angrybayblade/ph7/issues)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fangrybayblade%2Fph7","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fangrybayblade%2Fph7","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fangrybayblade%2Fph7/lists"}