diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..335ea9d --- /dev/null +++ b/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2018 The Python Packaging Authority + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..a4e03f2 --- /dev/null +++ b/README.md @@ -0,0 +1,24 @@ +# smack +_Smack is a cli application to create package folder structures for packages based on PyPi specifications_ + +## Installation +```bash +pip install smack +``` + +## Usage +```bash +smack [project-name] +``` +## Folder structure +```bash +[name]_project + -src + -[name] + -__init__.py + -[name].py + -tests + -LICENSE.txt + -pyproject.toml + -README.md +``` \ No newline at end of file diff --git a/dist/smack-0.2.4-py3-none-any.whl b/dist/smack-0.2.4-py3-none-any.whl new file mode 100644 index 0000000..d88b4b6 Binary files /dev/null and b/dist/smack-0.2.4-py3-none-any.whl differ diff --git a/dist/smack-0.2.4.tar.gz b/dist/smack-0.2.4.tar.gz new file mode 100644 index 0000000..fa32775 Binary files /dev/null and b/dist/smack-0.2.4.tar.gz differ diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..d28acde --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,25 @@ +[project] +name = "smack" +version = "0.2.4" +authors = [ + { name="Jacen Fossey", email="jhfossey@fossey.ca" }, +] +description = "Creates a basic folder structure for PyPi projects" +readme = "README.md" +requires-python = ">=3.7" +classifiers = [ + "Programming Language :: Python :: 3", + "License :: OSI Approved :: MIT License", + "Operating System :: OS Independent", +] + +dependencies = [ + "click" +] + +[project.urls] +"Homepage" = "https://github.com/JacenFossey/smack" +"Bug Tracker" = "https://github.com/JacenFossey/smack/issues" + +[project.scripts] +smack = "smack.smack:main" \ No newline at end of file diff --git a/src/smack.egg-info/PKG-INFO b/src/smack.egg-info/PKG-INFO new file mode 100644 index 0000000..ba1a233 --- /dev/null +++ b/src/smack.egg-info/PKG-INFO @@ -0,0 +1,38 @@ +Metadata-Version: 2.1 +Name: smack +Version: 0.2.4 +Summary: Creates a basic folder structure for PyPi projects +Author-email: Jacen Fossey +Project-URL: Homepage, https://github.com/JacenFossey/smack +Project-URL: Bug Tracker, https://github.com/JacenFossey/smack/issues +Classifier: Programming Language :: Python :: 3 +Classifier: License :: OSI Approved :: MIT License +Classifier: Operating System :: OS Independent +Requires-Python: >=3.7 +Description-Content-Type: text/markdown +License-File: LICENSE + +# smack +_Smack is a cli application to create package folder structures for packages based on PyPi specifications_ + +## Installation +```bash +pip install smack +``` + +## Usage +```bash +smack [project-name] +``` +## Folder structure +```bash +[name]_project + -src + -[name] + -__init__.py + -[name].py + -tests + -LICENSE.txt + -pyproject.toml + -README.md +``` diff --git a/src/smack.egg-info/SOURCES.txt b/src/smack.egg-info/SOURCES.txt new file mode 100644 index 0000000..d7cd205 --- /dev/null +++ b/src/smack.egg-info/SOURCES.txt @@ -0,0 +1,11 @@ +LICENSE +README.md +pyproject.toml +src/smack/__init__.py +src/smack/smack.py +src/smack.egg-info/PKG-INFO +src/smack.egg-info/SOURCES.txt +src/smack.egg-info/dependency_links.txt +src/smack.egg-info/entry_points.txt +src/smack.egg-info/requires.txt +src/smack.egg-info/top_level.txt \ No newline at end of file diff --git a/src/smack.egg-info/dependency_links.txt b/src/smack.egg-info/dependency_links.txt new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/src/smack.egg-info/dependency_links.txt @@ -0,0 +1 @@ + diff --git a/src/smack.egg-info/entry_points.txt b/src/smack.egg-info/entry_points.txt new file mode 100644 index 0000000..7cb2dab --- /dev/null +++ b/src/smack.egg-info/entry_points.txt @@ -0,0 +1,2 @@ +[console_scripts] +smack = smack.smack:main diff --git a/src/smack.egg-info/requires.txt b/src/smack.egg-info/requires.txt new file mode 100644 index 0000000..dca9a90 --- /dev/null +++ b/src/smack.egg-info/requires.txt @@ -0,0 +1 @@ +click diff --git a/src/smack.egg-info/top_level.txt b/src/smack.egg-info/top_level.txt new file mode 100644 index 0000000..c69f819 --- /dev/null +++ b/src/smack.egg-info/top_level.txt @@ -0,0 +1 @@ +smack diff --git a/src/smack/__init__.py b/src/smack/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/src/smack/smack.py b/src/smack/smack.py new file mode 100644 index 0000000..e869f89 --- /dev/null +++ b/src/smack/smack.py @@ -0,0 +1,105 @@ +import click +import os + +@click.command() +@click.argument('project_name', required=True) + +def main(project_name: str): + + project_title = project_name+"_project" + # creates the main folder + def create_main_folder(): + try: + os.mkdir(project_title) + print(f"Directory /{project_title} created") + except FileExistsError: + print(f"Directory /{project_title} already exists") + + + + # creates the src folder + def create_src_folder(): + + # current_dir/project_name + cwdir = os.getcwd()+"/"+project_title + + try: + os.mkdir(cwdir+"/src") + print("Directory /src created") + except FileExistsError: + print("The folder /src already exists") + + # creates the subsrc folder + def create_subsrc_folder(): + cwdir = os.getcwd()+"/"+project_title+"/src" + try: + os.mkdir(cwdir+"/"+project_name) + print(f"Directory /{project_name} created") + except FileExistsError: + print(f"Directory /{project_name} already exists") + + def create_init(): + cwdir = os.getcwd()+"/"+project_title+"/src/"+project_name + try: + file = open(cwdir+"/__init__.py", "x") + print("File __init__.py created") + except FileExistsError: + print("File __init__.py already exists") + + def create_main_file(): + cwdir = os.getcwd()+"/"+project_title+"/src/"+project_name + try: + file = open(cwdir+"/"+project_name+".py", "x") + print(f"File {project_name}.py created") + except FileExistsError: + print(f"File {project_name}.py already exists") + + create_init() + create_main_file() + + create_subsrc_folder() + + def create_tests_folder(): + cwdir = os.getcwd()+"/"+project_title + + try: + os.mkdir(cwdir+"/tests") + print("Directory /tests created") + except FileExistsError: + print("Directory /tests already exists") + + def create_license(): + cwdir = os.getcwd()+"/"+project_title + try: + file = open(cwdir+"/LICENSE.txt", "x") + print("File LICENSE created") + except FileExistsError: + print("File LICENSE already exists") + + def create_pyprojecttoml(): + cwdir = os.getcwd()+"/"+project_title + try: + file = open(cwdir+"/pyproject.toml", "x") + print("File pyproject.toml created") + except: + print("File pyproject.toml already exists") + + def create_readme(): + cwdir = os.getcwd()+"/"+project_title + try: + file = open(cwdir+"/README.md", "x") + print("File README.md created") + except: + print("File README.md already exists") + + create_main_folder() + create_src_folder() + create_tests_folder() + create_license() + create_pyprojecttoml() + create_readme() + + + +if __name__ == '__main__': + main() \ No newline at end of file