{"id":24159391,"url":"https://github.com/izzatkarimov/pyframekit","last_synced_at":"2026-02-06T03:32:16.862Z","repository":{"id":272131867,"uuid":"914065470","full_name":"izzatkarimov/pyframekit","owner":"izzatkarimov","description":"PyFrameKit - Python Web Framework built for learning purposes","archived":false,"fork":false,"pushed_at":"2025-01-21T12:06:05.000Z","size":13122,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-12-06T00:48:34.116Z","etag":null,"topics":["framework","python"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/pyframekit","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/izzatkarimov.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":"2025-01-08T22:04:53.000Z","updated_at":"2025-03-02T20:58:05.000Z","dependencies_parsed_at":null,"dependency_job_id":"1c6ca436-b2eb-4f82-b0a9-e988e5b5574f","html_url":"https://github.com/izzatkarimov/pyframekit","commit_stats":null,"previous_names":["izzatkarimov/pyframekit"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/izzatkarimov/pyframekit","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/izzatkarimov%2Fpyframekit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/izzatkarimov%2Fpyframekit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/izzatkarimov%2Fpyframekit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/izzatkarimov%2Fpyframekit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/izzatkarimov","download_url":"https://codeload.github.com/izzatkarimov/pyframekit/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/izzatkarimov%2Fpyframekit/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29148159,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-06T02:39:25.012Z","status":"ssl_error","status_checked_at":"2026-02-06T02:37:22.784Z","response_time":59,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: 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":["framework","python"],"created_at":"2025-01-12T15:16:57.482Z","updated_at":"2026-02-06T03:32:16.855Z","avatar_url":"https://github.com/izzatkarimov.png","language":"Python","readme":"# PyFrameKit\n\n![Image](https://github.com/user-attachments/assets/4f346d16-b4a2-468b-83c4-2a7326c0b91e)\n\n![purpose](https://img.shields.io/badge/purpose-learning-green)\n![PyPI - Version](https://img.shields.io/pypi/v/pyframekit)\n\nPyFrameKit is a lightweight Python web framework built for learning. It's WSGI-compliant and can be used with servers like Gunicorn.\n\n## Installation\n\nTo install PyFrameKit, use pip:\n\n```\npip install pyframekit\n```\n\n## Hot to Use\n\n### Quick Start Example\n\nHere's how you can createa a basic PyFrameKit application:\n\n```\nfrom pyframekit.app import PyFrameKitApp\n\napp = PyFrameKitApp()\n\n@app.route(\"/home\")\ndef home(request, response):\n    response.text = \"Hello! This is the Home Page\"\n\n@app.route(\"/hello/{name}\")\ndef greeting(request, response, name):\n    response.text = f\"Hello {name}\"\n\n@app.route(\"/books\")\nclass Books:\n    def get(self, request, response):\n        response.text = \"Book Page\"\n\n    def post(self, request, response):\n        response.text = \"Endpoint to create a book\"\n```\n\n### Advanced Features\n\n#### Template Rendering\nPyFrameKit supports template rendering for dynamic HTML content:\n```\n@app.route(\"/template\")\ndef template_handler(req, resp):\n    resp.html = app.template(\n        \"home.html\",\n        context={\"new_title\": \"New Title\", \"new_body\": \"New Body\"}\n    )\n```\n\n\n#### JSON Response\nEasily handle JSON data:\n```\n@app.route(\"/json\")\ndef json_handler(req, resp):\n    response_data = {\"name\": \"some name\", \"type\": \"json\"}\n    resp.body = json.dumps(response_data).encode()\n    resp.content_type = \"application/json\"\n\n```\n\n\n### Unit Tests\n\nThe recommended way of writing unit tests is with [pytest](https://docs.pytest.org/en/latest/). There are two built in fixtures that you may want to use when writing unit tests with PyFrameKit.\n```\ndef test_duplicate_routes_throws_exception(app):\n    @app.route(\"/home\")\n    def home(req, resp):\n        resp.text = \"Hello from Home\"\n\n    with pytest.raises(AssertionError):\n        @app.route(\"/home\")\n        def home2(req, resp):\n            resp.text = \"Hello from Home2\"\n```\n\nThe other one is client that you can use to send HTTP requests to your handlers. It is based on the famous [request](https://requests.readthedocs.io/en/latest/) and it should feel very familiar:\n```\ndef test_parameterized_routing(app, test_client):\n    @app.route(\"/hello/{name}\")\n    def greeting(request, response, name):\n        response.text = f\"Hello {name}\"\n```\n\n## Templates\nThe default folder for templates is templates. You can customize this location:\n```\napp = PyFrameKitApp(templates_dir=\"path/to/your/templates\")\n```\nThen you can use HTML files in that folder like so in a handler:\n```\n@app.route(\"/template\")\ndef template_handler(req, resp):\n    resp.html = app.template(\n        \"home.html\",\n        context={\"new_title\": \"New Title\", \"new_body\": \"New Body\"}\n    )\n```\n\n## Static Files\nStatic files are served from the static directory by default. This location is also configurable:\n```\napp = PyFrameKitApp(static_dir=\"path/to/your/static\")\n```\nThen you can use the files inside this folder in HTML files:\n```\n\u003c!DOCTYPE html\u003e\n\u003chtml lang=\"en\"\u003e\n\u003chead\u003e\n    \u003cmeta charset=\"UTF-8\"\u003e\n    \u003ctitle\u003e{{title}}\u003c/title\u003e\n    \u003clink rel=\"stylesheet\" href=\"/static/home.css\"\u003e\n\u003c/head\u003e\n\u003cbody\u003e\n    \u003ch1\u003e{{body}}\u003c/h1\u003e\n    \u003cp\u003eThis is a paragraph\u003c/p\u003e\n\u003c/body\u003e\n\u003c/html\u003e\n```\n\n## Middleware\nAdd custom middleware to process requests and responses. Middleware classes inherit from `pyframekit.middleware.Middleware` and override the `process_request` and `process_response` methods:\n```\nfrom pyframekit.app import PyFrameKitApp\nfrom pyframekit.middleware import Middleware\n\napp = PyFrameKitApp()\n\nclass Middleware:\n    def process_request(self, req):\n        print(\"Before dispatch\", req.url)\n\n    def process_response(self, req, resp):\n        print(\"After dispatch\", req.url)\n\napp.add_middleware(Middleware)\n\n```","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fizzatkarimov%2Fpyframekit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fizzatkarimov%2Fpyframekit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fizzatkarimov%2Fpyframekit/lists"}