Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated install instructions, add shields #2

Merged
merged 2 commits into from
Nov 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,22 @@
# @main

`@main` decorator which runs the tagged function if the current module is being run.
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/python-main)
![PyPI - Version](https://img.shields.io/pypi/v/python-main)


`@main` decorator which runs the tagged function if the current module is being executed as a script.

No more `if __name__ == "__main__":` all over the place.

That's it!

### Installation

```bash
pip install python-main # or
poetry add python-main # ...
```

### Usage

```python
Expand All @@ -17,6 +28,6 @@ B = 20

@main
def do_print():
"""This will run if this module is called directly."""
"""This will run if this module is executed."""
print(A + B)
```
10 changes: 9 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
[tool.poetry]
name = "python-main"
version = "1.0.0"
description = "@main decorator which runs the tagged function if the current module is being run. No more if __name__ == \"__main__\":. That's it!"
homepage = "https://github.com/flipbit03/main"
description = "Decorator which runs the tagged function if the current module is being run as a script. No more `if __name__ == \"__main__\"` madness."
authors = ["Cadu <[email protected]>"]
license = "BSD"
readme = "README.md"

classifiers=[
'Development Status :: 5 - Production/Stable',
'Intended Audience :: Developers',
'License :: OSI Approved :: BSD License',
'Natural Language :: English',
]

[tool.poetry.dependencies]
python = "^3.9"

Expand Down
Loading