{"id":22872368,"url":"https://github.com/k-kumar-01/python-api-to-server-cli","last_synced_at":"2026-04-27T23:32:46.248Z","repository":{"id":125102203,"uuid":"390524872","full_name":"K-Kumar-01/Python-API-to-Server-CLI","owner":"K-Kumar-01","description":"Converts Python API to Server","archived":false,"fork":false,"pushed_at":"2021-07-29T00:11:33.000Z","size":14,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-31T12:09:57.374Z","etag":null,"topics":["argparse","fastapi","python","uvicorn"],"latest_commit_sha":null,"homepage":"https://my-library-zeta.vercel.app/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/K-Kumar-01.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2021-07-28T22:26:01.000Z","updated_at":"2021-07-29T00:11:35.000Z","dependencies_parsed_at":null,"dependency_job_id":"94c9f348-c495-42e4-aad5-11dac2ca8163","html_url":"https://github.com/K-Kumar-01/Python-API-to-Server-CLI","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/K-Kumar-01/Python-API-to-Server-CLI","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/K-Kumar-01%2FPython-API-to-Server-CLI","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/K-Kumar-01%2FPython-API-to-Server-CLI/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/K-Kumar-01%2FPython-API-to-Server-CLI/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/K-Kumar-01%2FPython-API-to-Server-CLI/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/K-Kumar-01","download_url":"https://codeload.github.com/K-Kumar-01/Python-API-to-Server-CLI/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/K-Kumar-01%2FPython-API-to-Server-CLI/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32360110,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-27T20:07:02.737Z","status":"ssl_error","status_checked_at":"2026-04-27T20:07:00.910Z","response_time":128,"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":["argparse","fastapi","python","uvicorn"],"created_at":"2024-12-13T13:34:57.834Z","updated_at":"2026-04-27T23:32:46.231Z","avatar_url":"https://github.com/K-Kumar-01.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"Converts Python API to Server\n\n## How to Use\n1. Clone the repo `git@github.com:K-Kumar-01/Python-API-to-Server-CLI.git`.\n2. Change the directory `cd Python-API-to-Server-CLI`\n3. Create a virtual environment `virtualenv -p python3 venv`.\n4. Activate the virtual environment source `venv/bin/activate`.\n5. Run `python3 setup.py install`\n\n## Commands\n`mylibrary --build \u003cfileName.py\u003e`\n\nBuilds the file i.e. converts the file to a fastapi code.\nCurrently single file with no custom imports is only available.\n\n## Structure of file\n1. Should not contain custom imports\n2. Should contain a class and some functions in it.\n3. A decorator which adds the attributes (mentioned in the sample file)  on the used function. \n   These attributes are compulsory. Apart from these any other attribute may be added but \n   they won't be used.\n\nA Sample structure of the file\n```python\ndef api(route, http_methods, *args, **kwargs):\n    def decorator(func):\n        setattr(func, 'is_api', True)\n        setattr(func, \"_api_route\", route)\n        setattr(func, 'http_methods', http_methods)\n        return func\n    return decorator\n\n\nclass MyService():\n    @api(route=\"/\", http_methods=['GET'])\n    def predict():\n        return {'Hello': 'World'}\n\n    def withoutApi():\n        return {'I am': 'without api'}\n\n```\n\nRunning the above command will generate a `build` folder in the **current working directory**.\n\nThe build can be run locally by doing the following:\n1. While in virtual environment, `pip install fastapi` and `pip install uvicorn[standard]`.\n2. `cd build`.\n3. Run `uvicorn main:app --reload`\n\nThe server will be running on `localhost:8000` \n\n\n`mylibrary --deploy`\nThis command deploys the build folder on `vercel`.\n**Note**: Be sure to install `vercel` globally using `npm i -g vercel` or `yarn global add vercel`.\nThe command runs `vercel ./build` internally.\nSome questions will be asked by vercel-cli.\nIf successful, one can visit the url and see the project running.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fk-kumar-01%2Fpython-api-to-server-cli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fk-kumar-01%2Fpython-api-to-server-cli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fk-kumar-01%2Fpython-api-to-server-cli/lists"}