From 0f82e5f7791b993d8e54d3852a09bea8a983cb1a Mon Sep 17 00:00:00 2001 From: Samuel Doghor <56834362+samdoghor@users.noreply.github.com> Date: Tue, 23 Jan 2024 15:53:07 +0100 Subject: [PATCH] feat: release v0.0.1 --- README.md | 5 ++-- myte/__init__.py | 1 + myte/create_project.py | 2 +- myte/setup_project.py | 4 ++++ myte/utils/__init__.py | 2 ++ {utils => myte/utils}/errors.py | 2 +- myte/{ => utils}/secret_key_generator.py | 8 +++---- pyproject.toml | 30 +++++++++++++++++++++--- setup.cfg | 24 +++++++++++++++++++ utils/__init__.py | 1 - 10 files changed, 67 insertions(+), 12 deletions(-) create mode 100644 myte/utils/__init__.py rename {utils => myte/utils}/errors.py (90%) rename myte/{ => utils}/secret_key_generator.py (63%) create mode 100644 setup.cfg delete mode 100644 utils/__init__.py diff --git a/README.md b/README.md index 0e3cd26..6eb57f8 100644 --- a/README.md +++ b/README.md @@ -42,6 +42,7 @@ Install `Myte` once without a virtual environment so it would be available to bo ### How to start your web project in any of the frameworks - Create a virtual environment +- Activate the virtual environment - Run the code below ```Bash Copy @@ -54,7 +55,7 @@ myte start project $ myte start project Compatible Note: -Myte requires at least Python 3.11. However, the tool may still work +Myte requires at least Python 3.8. However, the tool may still work fine in lower versions. If you encounter any error, do well to report them here https://cutt.ly/1wSR7LW0 Thank you @@ -106,7 +107,7 @@ and run the pip instructions there $ myte start project Compatible Note: -Myte requires at least Python 3.11. However, the tool may still work +Myte requires at least Python 3.8. However, the tool may still work fine in lower versions. If you encounter any error, do well to report them here https://cutt.ly/1wSR7LW0 Thank you diff --git a/myte/__init__.py b/myte/__init__.py index 1a618c5..1d159ef 100644 --- a/myte/__init__.py +++ b/myte/__init__.py @@ -1,3 +1,4 @@ +from .main import main from .constants import template_folder, current_dir from .setup_project import SetupProject from .create_project import CreateProject diff --git a/myte/create_project.py b/myte/create_project.py index f8f7a07..7e12091 100644 --- a/myte/create_project.py +++ b/myte/create_project.py @@ -11,7 +11,7 @@ from rich import print as mprint from rich.console import Console from rich.text import Text -from secret_key_generator import GenerateSecretKey +from utils import GenerateSecretKey class CreateProject: diff --git a/myte/setup_project.py b/myte/setup_project.py index bb19421..e30dc83 100644 --- a/myte/setup_project.py +++ b/myte/setup_project.py @@ -10,6 +10,7 @@ from delete_project import DeleteProject from rich import print as mprint from rich.prompt import Prompt +from utils import UKeyboardInterrupt class SetupProject: @@ -46,6 +47,9 @@ def project_setup(): mprint(f"[green] ✅ {selected_framework['framework']}, selected [/green]") # noqa mprint("\n") + except UKeyboardInterrupt as e: + mprint(f"{e.message}") # noqa + raise typer.Abort() except KeyboardInterrupt as e: mprint(f"The Programme was terminated due to {e} Error") # noqa raise typer.Abort() diff --git a/myte/utils/__init__.py b/myte/utils/__init__.py new file mode 100644 index 0000000..3e4dabd --- /dev/null +++ b/myte/utils/__init__.py @@ -0,0 +1,2 @@ +from .errors import UKeyboardInterrupt +from .secret_key_generator import GenerateSecretKey diff --git a/utils/errors.py b/myte/utils/errors.py similarity index 90% rename from utils/errors.py rename to myte/utils/errors.py index 7b97007..25d4c14 100644 --- a/utils/errors.py +++ b/myte/utils/errors.py @@ -5,7 +5,7 @@ """ -class KeyboardInterrupt(Exception): +class UKeyboardInterrupt(Exception): """ This class represents Keyboard Interruption """ def __init__(self) -> None: diff --git a/myte/secret_key_generator.py b/myte/utils/secret_key_generator.py similarity index 63% rename from myte/secret_key_generator.py rename to myte/utils/secret_key_generator.py index b8602f8..0bd477f 100644 --- a/myte/secret_key_generator.py +++ b/myte/utils/secret_key_generator.py @@ -6,16 +6,16 @@ import secrets -import string class GenerateSecretKey: """ This class is use to generate secret key to be used for security purposes """ - def generate_secret_key(length=32): + def generate_secret_key(): """ The function generates a 32 character secret key """ - alphabet = string.ascii_letters + string.digits - secret_key = ''.join(secrets.choice(alphabet) for _ in range(length)) + length = 32 + secret_key = secrets.token_urlsafe(length) + return secret_key diff --git a/pyproject.toml b/pyproject.toml index a39fc5a..3e520a2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,30 @@ [build-system] -requires = ["hatchling"] -build-backend = "hatchling.build" +requires = ["setuptools>=61.0", "wheel"] +build-backend = "setuptools.build_meta" [project] -name = "Myte" \ No newline at end of file +name = "Myte" +version = "0.0.1" +dependencies = [ + "typer", + "inquirer", +] +authors = [ + { name="Samuel Doghor", email="talkto@samdoghor.com" }, +] +description = "Myte allows users to choose from popular web frameworks like Flask, FastAPI, and Tornado etc when initializing a new project. After entering a project name, the user selects their preferred framework which then generates the basic directory structure and boilerplate code to get started." +readme = "README.md" +requires-python = ">=3.8" +classifiers = [ + "Programming Language :: Python :: 3", + "License :: OSI Approved :: MIT License", + "Operating System :: OS Independent", + "Intended Audience :: Developers", + "Topic :: Software Development :: Boilerplate", + "Environment :: Console", +] +keywords = ["Myte", "Flask", "FastAPI", "Tornado", "Bottle", "Pyramid", "CherryPy", "Boilerplate", "Python web framework", "Project bootstrapping", "Framework"] + +[project.urls] +Homepage = "https://github.com/samdoghor/myte" +Issues = "https://github.com/samdoghor/myte/issues" \ No newline at end of file diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000..4d7f9c4 --- /dev/null +++ b/setup.cfg @@ -0,0 +1,24 @@ +[metadata] +name = Myte +version = 0.0.1 +author = Samuel Doghor +author_email = talkto@samdoghor.com +description = Myte allows users to choose from popular web frameworks like Flask, FastAPI, and Tornado etc when initializing a new project +long_description = file: README.rst, CHANGELOG.rst, LICENSE.rst +keywords = one, two +license = MIT License +license_files = LICENSE +keywords = Myte, Flask, FastAPI, Tornado, Bottle, Pyramid, CherryPy, Boilerplate, Python web framework, Project bootstrapping, Framework + + +[options] +packages = find: +python_requires = >=3.8 +include_package_data = True +install_requires = + typer + inquirer + +[options.entry_points] +console_scripts = + myte-start = myte.main:main \ No newline at end of file diff --git a/utils/__init__.py b/utils/__init__.py deleted file mode 100644 index 083a5e0..0000000 --- a/utils/__init__.py +++ /dev/null @@ -1 +0,0 @@ -from .errors import KeyboardInterrupt