diff --git a/Helper/git-steps-multiple-origin.txt b/Helper/git-steps-multiple-origin.txt index da017c3..e2df4db 100644 --- a/Helper/git-steps-multiple-origin.txt +++ b/Helper/git-steps-multiple-origin.txt @@ -2,4 +2,8 @@ git remote add all REMOTE-URL-1 git remote set-url --add --push all REMOTE-URL-1 git remote set-url --add --push all REMOTE-URL-2 git push all BRANCH -git fetch --all \ No newline at end of file +git fetch --all + +build setup : python setup.py sdist bdist_wheel + +upload : twine upload dist/* \ No newline at end of file diff --git a/README.md b/README.md index da8bf59..beec90e 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,8 @@ app.sow(server=True)
+banner + https://pypi.org/project/createapp/ diff --git a/Test/main.py b/Test/main.py new file mode 100644 index 0000000..f82c406 --- /dev/null +++ b/Test/main.py @@ -0,0 +1,5 @@ +from createflask import createapp + +app = createapp.Create('app') + +app.sow(server=False) \ No newline at end of file diff --git a/build/lib/createflask/createapp.py b/build/lib/createflask/createapp.py index efae2e3..48d8eb9 100644 --- a/build/lib/createflask/createapp.py +++ b/build/lib/createflask/createapp.py @@ -1,48 +1,81 @@ -import time import subprocess -from tqdm import tqdm import time +from rich.console import* +from rich.theme import* +from rich.progress import track +from rich.markdown import Markdown + +custome_theme = Theme({'success': 'green', 'error': 'bold red', 'normal': 'yellow'}) + +console = Console(theme=custome_theme) class Create: def __init__(self, name): self.name = name start = time.time() - - tasks1 = ['mkdir static', 'mkdir templates', 'cd templates', 'echo from flask import Flask > app.py', 'echo app=Flask(__name__) >> app.py', 'echo @app.route("/") >> app.py', 'echo def index(): >> app.py', 'echo return "Hello world this is flask app" >> app.py', 'echo if __name__=="__main__": >> app.py', 'echo app.run(debug=True) >> app.py', 'echo click==8.0.1 >> requirements.txt', 'echo Flask==2.0.1 >> requirements.txt', 'echo importlib-metadata==4.8.1 >> requirements.txt', 'echo itsdangerous==2.0.1 >> requirements.txt', 'echo Jinja2==3.0.1 >> requirements.txt', 'echo MarkupSafe==2.0.1 >> requirements.txt', 'echo typing-extensions==3.10.0.2 >> requirements.txt', 'echo Werkzeug==2.0.1 >> requirements.txt', 'echo zipp==3.5.0 >> requirements.txt', 'echo colorama==0.4.4 >> requirements.txt'] + tasks1 = ['mkdir static', 'mkdir templates', 'cd templates', 'echo from flask import Flask > app.py', 'echo app=Flask(__name__) >> app.py', 'echo @app.route("/") >> app.py', 'echo def index(): >> app.py', 'echo return "Hello world this is flask app" >> app.py', 'echo if __name__=="__main__": >> app.py', 'echo app.run(debug=True) >> app.py', 'echo click==8.0.1 >> requirements.txt', 'echo Flask==2.0.1 >> requirements.txt', 'echo importlib-metadata==4.8.1 >> requirements.txt', 'echo itsdangerous==2.0.1 >> requirements.txt', 'echo Jinja2==3.0.1 >> requirements.txt', 'echo MarkupSafe==2.0.1 >> requirements.txt', 'echo typing-extensions==3.10.0.2 >> requirements.txt', 'echo Werkzeug==2.0.1 >> requirements.txt', 'echo zipp==3.5.0 >> requirements.txt', 'echo colorama==0.4.4 >> requirements.txt'] def sow(self,server): execution = "run" - print('build starting...') + console_ = Console() + + now = datetime.now() + + current_time = now.strftime("%H:%M:%S") + + MARKDOWN = f''' + +# Flask app build starting at {current_time} - for task in self.tasks1: - p1 = subprocess.run(task, shell=True) +''' + + md = Markdown(MARKDOWN) + + console_.print(md) + + try: + for task in self.tasks1: + p1 = subprocess.run(task, shell=True) - if p1.returncode != 0: - execution = "dismiss" - break + if p1.returncode != 0: + execution = "dismiss" + break + + show_ = ['app.py', 'requirements.txt', 'static dir', 'template dir'] + + with console_.status("[bold green]Working on tasks...") as status: + while show_: + task_ = show_.pop(0) + time.sleep(1) + console_.log(f"Building {task_} complete") + + except: + console.print('Build Failed :bangbang:', style='error') + if execution == "run": - for i in tqdm (range (len(self.tasks1)), - desc="Creating…", - ascii=False, ncols=75): - time.sleep(0.02) finish = time.time() final_task = ['pip install --upgrade flask','start http://127.0.0.1:5000/', 'python app.py'] - - print(f'flask app created in {round(finish-self.start, 2)} seconds') + + console.print('Build success :heavy_check_mark:', style='success') + console.print(f'flask app created in {round(finish-self.start, 2)} seconds', style='success') + time.sleep(1) if server==True: + console.print('Installing Dependencies...', style='normal') for task in final_task: - p2 = subprocess.run(task, shell=True) + p2 = subprocess.run(task, shell=True , stderr=subprocess.DEVNULL) + if final_task.index(task) == 1: + console.print('Running server on port 5000', style='success') if __name__ == "__main__": app = Create('app') - app.sow(server=True) \ No newline at end of file + app.sow(server=False) \ No newline at end of file diff --git a/build/lib/flask-createapp/__init__.py b/build/lib/flask-createapp/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/build/lib/flask-createapp/flask_create.py b/build/lib/flask-createapp/flask_create.py new file mode 100644 index 0000000..d463fcf --- /dev/null +++ b/build/lib/flask-createapp/flask_create.py @@ -0,0 +1,50 @@ +import time +import subprocess +from tqdm import tqdm +import time + +class Create: + def __init__(self, name): + self.name = name + + start = time.time() + + tasks1 = ['mkdir static', 'mkdir templates', 'cd templates', 'echo from flask import Flask > app.py', 'echo app=Flask(__name__) >> app.py', 'echo @app.route("/") >> app.py', 'echo def index(): >> app.py', 'echo return "Hello world this is flask app" >> app.py', 'echo if __name__=="__main__": >> app.py', 'echo app.run(debug=True) >> app.py', 'echo click==8.0.1 >> requirements.txt', 'echo Flask==2.0.1 >> requirements.txt', 'echo importlib-metadata==4.8.1 >> requirements.txt', 'echo itsdangerous==2.0.1 >> requirements.txt', 'echo Jinja2==3.0.1 >> requirements.txt', 'echo MarkupSafe==2.0.1 >> requirements.txt', 'echo typing-extensions==3.10.0.2 >> requirements.txt', 'echo Werkzeug==2.0.1 >> requirements.txt', 'echo zipp==3.5.0 >> requirements.txt', 'echo colorama==0.4.4 >> requirements.txt'] + + + def sow(self,server): + execution = "run" + + print('build starting...') + + for task in self.tasks1: + p1 = subprocess.run(task, shell=True) + + if p1.returncode != 0: + execution = "dismiss" + break + + if execution == "run": + for i in tqdm (range (len(self.tasks1)), + desc="Creating…", + ascii=False, ncols=75): + time.sleep(0.02) + + finish = time.time() + + final_task = ['start http://127.0.0.1:5000/', 'python app.py'] + + print(f'flask app created in {round(finish-self.start, 2)} seconds') + + if server==True: + for task in final_task: + subprocess.run(task, shell=True) + + + + + +if __name__ == "__main__": + app = Create('app') + + app.sow(server=False) \ No newline at end of file diff --git a/createflask.egg-info/PKG-INFO b/createflask.egg-info/PKG-INFO index 6c35a7b..e620ddd 100644 --- a/createflask.egg-info/PKG-INFO +++ b/createflask.egg-info/PKG-INFO @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: createflask -Version: 0.0.5.1 +Version: 1.7.5 Summary: Python package for creating flaskapp Home-page: UNKNOWN Author: Throttlerz (Siddhartha Roy) @@ -22,6 +22,7 @@ License-File: LICENSE ![PyPI - Python Version](https://img.shields.io/pypi/pyversions/createflask) + ## `pip install flask-createapp` @@ -45,6 +46,8 @@ app.sow(server=True)
+https://pypi.org/project/createapp/ + diff --git a/createflask.egg-info/SOURCES.txt b/createflask.egg-info/SOURCES.txt index 00deeac..791795c 100644 --- a/createflask.egg-info/SOURCES.txt +++ b/createflask.egg-info/SOURCES.txt @@ -7,4 +7,6 @@ createflask.egg-info/PKG-INFO createflask.egg-info/SOURCES.txt createflask.egg-info/dependency_links.txt createflask.egg-info/requires.txt -createflask.egg-info/top_level.txt \ No newline at end of file +createflask.egg-info/top_level.txt +flask-createapp/__init__.py +flask-createapp/flask_create.py \ No newline at end of file diff --git a/createflask.egg-info/requires.txt b/createflask.egg-info/requires.txt index 78620c4..3f382dd 100644 --- a/createflask.egg-info/requires.txt +++ b/createflask.egg-info/requires.txt @@ -1 +1 @@ -tqdm +rich diff --git a/createflask.egg-info/top_level.txt b/createflask.egg-info/top_level.txt index 49d5398..df227ad 100644 --- a/createflask.egg-info/top_level.txt +++ b/createflask.egg-info/top_level.txt @@ -1 +1,2 @@ createflask +flask-createapp diff --git a/createflask/createapp.py b/createflask/createapp.py index efae2e3..48d8eb9 100644 --- a/createflask/createapp.py +++ b/createflask/createapp.py @@ -1,48 +1,81 @@ -import time import subprocess -from tqdm import tqdm import time +from rich.console import* +from rich.theme import* +from rich.progress import track +from rich.markdown import Markdown + +custome_theme = Theme({'success': 'green', 'error': 'bold red', 'normal': 'yellow'}) + +console = Console(theme=custome_theme) class Create: def __init__(self, name): self.name = name start = time.time() - - tasks1 = ['mkdir static', 'mkdir templates', 'cd templates', 'echo from flask import Flask > app.py', 'echo app=Flask(__name__) >> app.py', 'echo @app.route("/") >> app.py', 'echo def index(): >> app.py', 'echo return "Hello world this is flask app" >> app.py', 'echo if __name__=="__main__": >> app.py', 'echo app.run(debug=True) >> app.py', 'echo click==8.0.1 >> requirements.txt', 'echo Flask==2.0.1 >> requirements.txt', 'echo importlib-metadata==4.8.1 >> requirements.txt', 'echo itsdangerous==2.0.1 >> requirements.txt', 'echo Jinja2==3.0.1 >> requirements.txt', 'echo MarkupSafe==2.0.1 >> requirements.txt', 'echo typing-extensions==3.10.0.2 >> requirements.txt', 'echo Werkzeug==2.0.1 >> requirements.txt', 'echo zipp==3.5.0 >> requirements.txt', 'echo colorama==0.4.4 >> requirements.txt'] + tasks1 = ['mkdir static', 'mkdir templates', 'cd templates', 'echo from flask import Flask > app.py', 'echo app=Flask(__name__) >> app.py', 'echo @app.route("/") >> app.py', 'echo def index(): >> app.py', 'echo return "Hello world this is flask app" >> app.py', 'echo if __name__=="__main__": >> app.py', 'echo app.run(debug=True) >> app.py', 'echo click==8.0.1 >> requirements.txt', 'echo Flask==2.0.1 >> requirements.txt', 'echo importlib-metadata==4.8.1 >> requirements.txt', 'echo itsdangerous==2.0.1 >> requirements.txt', 'echo Jinja2==3.0.1 >> requirements.txt', 'echo MarkupSafe==2.0.1 >> requirements.txt', 'echo typing-extensions==3.10.0.2 >> requirements.txt', 'echo Werkzeug==2.0.1 >> requirements.txt', 'echo zipp==3.5.0 >> requirements.txt', 'echo colorama==0.4.4 >> requirements.txt'] def sow(self,server): execution = "run" - print('build starting...') + console_ = Console() + + now = datetime.now() + + current_time = now.strftime("%H:%M:%S") + + MARKDOWN = f''' + +# Flask app build starting at {current_time} - for task in self.tasks1: - p1 = subprocess.run(task, shell=True) +''' + + md = Markdown(MARKDOWN) + + console_.print(md) + + try: + for task in self.tasks1: + p1 = subprocess.run(task, shell=True) - if p1.returncode != 0: - execution = "dismiss" - break + if p1.returncode != 0: + execution = "dismiss" + break + + show_ = ['app.py', 'requirements.txt', 'static dir', 'template dir'] + + with console_.status("[bold green]Working on tasks...") as status: + while show_: + task_ = show_.pop(0) + time.sleep(1) + console_.log(f"Building {task_} complete") + + except: + console.print('Build Failed :bangbang:', style='error') + if execution == "run": - for i in tqdm (range (len(self.tasks1)), - desc="Creating…", - ascii=False, ncols=75): - time.sleep(0.02) finish = time.time() final_task = ['pip install --upgrade flask','start http://127.0.0.1:5000/', 'python app.py'] - - print(f'flask app created in {round(finish-self.start, 2)} seconds') + + console.print('Build success :heavy_check_mark:', style='success') + console.print(f'flask app created in {round(finish-self.start, 2)} seconds', style='success') + time.sleep(1) if server==True: + console.print('Installing Dependencies...', style='normal') for task in final_task: - p2 = subprocess.run(task, shell=True) + p2 = subprocess.run(task, shell=True , stderr=subprocess.DEVNULL) + if final_task.index(task) == 1: + console.print('Running server on port 5000', style='success') if __name__ == "__main__": app = Create('app') - app.sow(server=True) \ No newline at end of file + app.sow(server=False) \ No newline at end of file diff --git a/dist/createflask-0.1.7.5-py3-none-any.whl b/dist/createflask-0.1.7.5-py3-none-any.whl new file mode 100644 index 0000000..a5c2d60 Binary files /dev/null and b/dist/createflask-0.1.7.5-py3-none-any.whl differ diff --git a/dist/createflask-0.1.7.5.tar.gz b/dist/createflask-0.1.7.5.tar.gz new file mode 100644 index 0000000..e78bdf5 Binary files /dev/null and b/dist/createflask-0.1.7.5.tar.gz differ diff --git a/dist/createflask-1.7.5-py3-none-any.whl b/dist/createflask-1.7.5-py3-none-any.whl new file mode 100644 index 0000000..7004866 Binary files /dev/null and b/dist/createflask-1.7.5-py3-none-any.whl differ diff --git a/dist/createflask-1.7.5.tar.gz b/dist/createflask-1.7.5.tar.gz new file mode 100644 index 0000000..c4f16cc Binary files /dev/null and b/dist/createflask-1.7.5.tar.gz differ diff --git a/setup.py b/setup.py index 4c917c6..27dd0ee 100644 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ with codecs.open(os.path.join(here, "README.md"), encoding="utf-8") as fh: long_description = "\n" + fh.read() -VERSION = '0.0.5.1' +VERSION = '1.7.5' DESCRIPTION = 'Python package for creating flaskapp' LONG_DESCRIPTION = 'Now create your flask development environment with 2 simple commands' @@ -22,7 +22,7 @@ long_description_content_type="text/markdown", long_description=long_description, packages=find_packages(), - install_requires=['tqdm'], + install_requires=['rich'], keywords=['python', 'web development', 'createapp', 'automation', 'flask', 'python flask'], classifiers=[