{"id":43242225,"url":"https://github.com/nekitdev/entrypoint","last_synced_at":"2026-02-01T11:38:55.175Z","repository":{"id":38207937,"uuid":"383644471","full_name":"nekitdev/entrypoint","owner":"nekitdev","description":"Decorated functions as entry points.","archived":false,"fork":false,"pushed_at":"2024-06-16T16:07:15.000Z","size":600,"stargazers_count":4,"open_issues_count":5,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-01-14T12:27:12.104Z","etag":null,"topics":["entry","entrypoint","python"],"latest_commit_sha":null,"homepage":"https://nekitdev.github.io/entrypoint","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nekitdev.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":["nekitdev"],"custom":"https://nekit.dev/funding"}},"created_at":"2021-07-07T01:51:36.000Z","updated_at":"2024-09-12T09:52:32.000Z","dependencies_parsed_at":"2024-03-15T21:03:19.045Z","dependency_job_id":null,"html_url":"https://github.com/nekitdev/entrypoint","commit_stats":{"total_commits":95,"total_committers":2,"mean_commits":47.5,"dds":"0.13684210526315788","last_synced_commit":"a275109b12ad7c2b93e9e911131b64ce87e1d585"},"previous_names":["nekitdev/entrypoint.py"],"tags_count":26,"template":false,"template_full_name":null,"purl":"pkg:github/nekitdev/entrypoint","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nekitdev%2Fentrypoint","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nekitdev%2Fentrypoint/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nekitdev%2Fentrypoint/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nekitdev%2Fentrypoint/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nekitdev","download_url":"https://codeload.github.com/nekitdev/entrypoint/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nekitdev%2Fentrypoint/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28977334,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-01T11:31:13.034Z","status":"ssl_error","status_checked_at":"2026-02-01T11:30:25.558Z","response_time":56,"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":["entry","entrypoint","python"],"created_at":"2026-02-01T11:38:55.089Z","updated_at":"2026-02-01T11:38:55.169Z","avatar_url":"https://github.com/nekitdev.png","language":"Python","funding_links":["https://github.com/sponsors/nekitdev","https://nekit.dev/funding"],"categories":[],"sub_categories":[],"readme":"# `entrypoint`\n\n[![License][License Badge]][License]\n[![Version][Version Badge]][Package]\n[![Downloads][Downloads Badge]][Package]\n[![Discord][Discord Badge]][Discord]\n\n[![Documentation][Documentation Badge]][Documentation]\n[![Check][Check Badge]][Actions]\n[![Test][Test Badge]][Actions]\n[![Coverage][Coverage Badge]][Coverage]\n\n\u003e *Decorated functions as entry points.*\n\nIn python, an *entry point* can be thought of as an explicit function\nthat gets called when the script is run directly from the console.\n\nDefining an entry point requires some boilerplate code, which is\nabstracted away by this library.\n\n## Installing\n\n**Python 3.8 or above is required.**\n\n### pip\n\nInstalling the library with `pip` is quite simple:\n\n```console\n$ pip install entrypoint\n```\n\nAlternatively, the library can be installed from source:\n\n```console\n$ git clone https://github.com/nekitdev/entrypoint.git\n$ cd entrypoint\n$ python -m pip install .\n```\n\n### poetry\n\nYou can add `entrypoint` as a dependency with the following command:\n\n```console\n$ poetry add entrypoint\n```\n\nOr by directly specifying it in the configuration like so:\n\n```toml\n[tool.poetry.dependencies]\nentrypoint = \"^2.1.0\"\n```\n\nAlternatively, you can add it directly from the source:\n\n```toml\n[tool.poetry.dependencies.entrypoint]\ngit = \"https://github.com/nekitdev/entrypoint.git\"\n```\n\n## Examples\n\n### Decorated\n\nDeclare the `main` function as an *entry point*:\n\n```python\nfrom entrypoint import entrypoint\n\n@entrypoint(__name__)\ndef main() -\u003e None:\n    print(\"Hello, world!\")\n```\n\nRun the script directly from the console:\n\n```console\n$ python file.py\nHello, world!\n```\n\nWhen importing the module, `main` does not get called:\n\n```python\n\u003e\u003e\u003e import file\n\u003e\u003e\u003e # no output\n```\n\n### Note\n\nNote that `main` gets called **immediately, before any code below can be executed**.\n\n```python\n@entrypoint(__name__)\ndef main() -\u003e None:\n    print(\"-\u003e in main\")\n\nprint(\"\u003c- outside\")\n```\n\n```console\n$ python note.py\n-\u003e in main\n\u003c- outside\n```\n\n### Direct\n\nIt is possible to run `main` directly:\n\n```python\nentrypoint(__name__).call(main)\n```\n\nThis method allows to take control over where and when the function gets called.\n\n### Check\n\n`entrypoint` also provides `is_main` function that resembles\nthe common (and de-facto standard) way of implementing *entry points*:\n\n```python\nfrom entrypoint import is_main\n\nif is_main(__name__):\n    print(\"Hello, world!\")\n```\n\n### Return\n\n`entrypoint` expects `main` functions to not have arguments and return nothing.\nEven though this is *not* checked at *runtime*, returning from `main` will cause\n*type-checkers* to *error*!\n\n### Async\n\n`entrypoint` does not provide any specific functionality to run async functions.\n\nInstead, you can specify, for example, a `main` function that runs its `async_main` counterpart:\n\n```python\nfrom async_extensions import run\n\nasync def async_main() -\u003e None:\n    print(\"Hello, world!\")\n\n@entrypoint(__name__)\ndef main() -\u003e None:\n    run(async_main())\n```\n\n### Implicit\n\nIn case an entry point gets created without `__name__` given, it is going to attempt\nto fetch the module from the `main` function provided.\n\n```python\n@entrypoint()\ndef main() -\u003e None:\n    print(\"Hello, world!\")\n```\n\nPlease keep in mind that calling functions defined outside the `__main__` module\nwill not work with implicit fetching.\n\n## Documentation\n\nYou can find the documentation [here][Documentation].\n\n## Support\n\nIf you need support with the library, you can send an [email][Email]\nor refer to the official [Discord server][Discord].\n\n## Changelog\n\nYou can find the changelog [here][Changelog].\n\n## Security Policy\n\nYou can find the Security Policy of `entrypoint` [here][Security].\n\n## Contributing\n\nIf you are interested in contributing to `entrypoint`, make sure to take a look at the\n[Contributing Guide][Contributing Guide], as well as the [Code of Conduct][Code of Conduct].\n\n## License\n\n`entrypoint` is licensed under the MIT License terms. See [License][License] for details.\n\n[Email]: mailto:support@nekit.dev\n\n[Discord]: https://nekit.dev/chat\n\n[Actions]: https://github.com/nekitdev/entrypoint/actions\n\n[Changelog]: https://github.com/nekitdev/entrypoint/blob/main/CHANGELOG.md\n[Code of Conduct]: https://github.com/nekitdev/entrypoint/blob/main/CODE_OF_CONDUCT.md\n[Contributing Guide]: https://github.com/nekitdev/entrypoint/blob/main/CONTRIBUTING.md\n[Security]: https://github.com/nekitdev/entrypoint/blob/main/SECURITY.md\n\n[License]: https://github.com/nekitdev/entrypoint/blob/main/LICENSE\n\n[Package]: https://pypi.org/project/entrypoint\n[Coverage]: https://codecov.io/gh/nekitdev/entrypoint\n[Documentation]: https://nekitdev.github.io/entrypoint\n\n[Discord Badge]: https://img.shields.io/discord/728012506899021874\n[License Badge]: https://img.shields.io/pypi/l/entrypoint\n[Version Badge]: https://img.shields.io/pypi/v/entrypoint\n[Downloads Badge]: https://img.shields.io/pypi/dm/entrypoint\n\n[Documentation Badge]: https://github.com/nekitdev/entrypoint/workflows/docs/badge.svg\n[Check Badge]: https://github.com/nekitdev/entrypoint/workflows/check/badge.svg\n[Test Badge]: https://github.com/nekitdev/entrypoint/workflows/test/badge.svg\n[Coverage Badge]: https://codecov.io/gh/nekitdev/entrypoint/branch/main/graph/badge.svg\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnekitdev%2Fentrypoint","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnekitdev%2Fentrypoint","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnekitdev%2Fentrypoint/lists"}