From f3038ba661b9e8bb0da0eb53538c60f069fbba7e Mon Sep 17 00:00:00 2001 From: Mohammadreza Amani Date: Sun, 24 Nov 2024 03:52:46 +0330 Subject: [PATCH] fit(CLI): add cli tools to code. --- .github/workflows/pipy_release.yml | 15 +++----- inui/__main__.py | 16 +++++++-- inui/__version__ | 1 + pyproject.toml | 2 +- setup.py | 58 ++++++++++++++++++++++++++++++ 5 files changed, 77 insertions(+), 15 deletions(-) create mode 100644 inui/__version__ create mode 100644 setup.py diff --git a/.github/workflows/pipy_release.yml b/.github/workflows/pipy_release.yml index f3c05c1..70a300f 100644 --- a/.github/workflows/pipy_release.yml +++ b/.github/workflows/pipy_release.yml @@ -4,27 +4,20 @@ on: push: branches: - main - jobs: build-n-publish: name: Publish to PyPI runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - name: Set up Python 3.12 uses: actions/setup-python@v3 with: python-version: "3.12" - - - name: Upgrade pip and install tools - run: | - python -m pip install --upgrade pip - python -m pip install build twine uv - - - name: Build the package - run: uv build - + - name: Install dependencies + run: python -m pip install setuptools wheel + - name: Build a binary wheel + run: python setup.py sdist bdist_wheel - name: Publish to PyPI uses: pypa/gh-action-pypi-publish@master with: diff --git a/inui/__main__.py b/inui/__main__.py index 7a0ae6a..106f564 100644 --- a/inui/__main__.py +++ b/inui/__main__.py @@ -4,7 +4,10 @@ from inui import build from inui.toinui import convert import logging -from inui import __version__ +import os + +INUI_PATH = os.path.dirname(os.path.realpath(__file__)) + logging.basicConfig( level=logging.INFO, format="%(asctime)s - %(levelname)s - %(message)s" @@ -78,7 +81,7 @@ }, ], }, - "version": {"alias": ["v"], "help": "Version of INUI.", "args": []}, + "version": {"aliases": ["v"], "help": "Version of INUI.", "args": []}, } @@ -143,7 +146,14 @@ def main(): indent=args.indent, ) if args.command == "version": - print(__version__) + print(__version__()) + + +def __version__() -> str: + config_path = os.path.join(INUI_PATH, "__version__") + with open(config_path, encoding="utf-8") as f: + text = f.read() + return text.strip() if __name__ == "__main__": diff --git a/inui/__version__ b/inui/__version__ new file mode 100644 index 0000000..090eef7 --- /dev/null +++ b/inui/__version__ @@ -0,0 +1 @@ +1.0.0.5 \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 296dc63..5c659cd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,7 +6,7 @@ build-backend = "setuptools.build_meta" [project] name = "inui" -version = "1.0.0.4" +version = "1.0.0.5" description = "Powerful and Highly Customizable Python Library for UI" readme = "README.md" authors = [{ name = "Mohammadreza Amani", email = "more.amani@yahoo.com" }] diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..4f96e91 --- /dev/null +++ b/setup.py @@ -0,0 +1,58 @@ +import codecs +import os + +from setuptools import find_packages, setup + +here = os.path.abspath(os.path.dirname(__file__)) +with codecs.open(os.path.join(here, "README.md"), encoding="utf-8") as fh: + long_description = "\n" + fh.read() + + +INUI_PATH = os.path.join(os.path.dirname(os.path.realpath(__file__)), "inui") + + +def __version__() -> str: + config_path = os.path.join(INUI_PATH, "__version__") + with open(config_path, encoding="utf-8") as f: + text = f.read() + return text.strip() + + +VERSION = "0.9.7.2" + +PACKAGE_NAME = "inui" +DESCRIPTION = "" +LONG_DESCRIPTION = "Powerful and Highly Customizable Python Library for UI" +AUTHOR_NAME = "Mohammadreza Amani" +AUTHOR_EMAIL = "more.amani@yahoo.com" +PROJECT_URL = "https://github.com/MohammadrezaAmani/INUI/" +REQUIRED_PACKAGES = [] +PROJECT_KEYWORDS = ["ui", "python", "html", "framework", "frontend", "bootstrap"] + +CLASSIFIERS = [ + "Development Status :: 1 - Planning", + "Intended Audience :: Developers", + "Programming Language :: Python :: 3", + "Operating System :: Unix", + "Operating System :: MacOS :: MacOS X", + "Operating System :: Microsoft :: Windows", +] +setup( + name=PACKAGE_NAME, + version=VERSION, + author=AUTHOR_NAME, + author_email=AUTHOR_EMAIL, + description=DESCRIPTION, + url=PROJECT_URL, + long_description_content_type="text/markdown", + long_description=long_description, + packages=find_packages(), + install_requires=REQUIRED_PACKAGES, + keywords=PROJECT_KEYWORDS, + classifiers=CLASSIFIERS, + entry_points={ + "console_scripts": [ + "inui=inui.hotreload:main", + ], + }, +)