Created
December 18, 2023 16:29
-
-
Save derekpappas/e01cd57be54beade7c484fe2d461a7e7 to your computer and use it in GitHub Desktop.
Revisions
-
derekpappas created this gist
Dec 18, 2023 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,55 @@ #!/usr/bin/python3 import os from pathlib import Path def create_project_structure(): # Define project structure project_structure = [ 'bin', 'classes', 'json', 'jobs', 'resources', 'tests' # Add more directories as needed ] # Create directories for directory in project_structure: create_directory(directory) # Define boilerplate files boilerplate_files = { 'README.md': '# Project Title', 'main.py': '# Your main Python script', 'tests/__init__.py': '', 'requirements.txt': '', '.gitignore': '*.pyc\n__pycache__\n*.pyo\n*.pyd\n.env\n' # Add more files as needed } # Create boilerplate files for file, content in boilerplate_files.items(): create_file(file, content) def create_directory(directory): # Check if the directory already exists if not os.path.exists(directory): os.makedirs(directory) print(f'Created directory: {directory}') else: print(f'Directory already exists: {directory}') def create_file(file, content): # Check if the file already exists file_path = Path(file) if not file_path.is_file(): with open(file, 'w') as f: f.write(content) print(f'Created file: {file}') else: print(f'File already exists: {file}') if __name__ == "__main__": create_project_structure()