Advertisement
RapidMod

Default Python Application Script

Apr 4th, 2024
893
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.04 KB | None | 0 0
  1. """
  2. Project Structure Creation Script
  3.  
  4. Description:
  5. This script is designed to automatically generate a default directory structure for Python projects,
  6. aimed at ensuring a clean and efficient organization for development. It creates a series of directories
  7. and files that form the foundation of a well-structured application, including places for libraries,
  8. utilities, services, and tests, along with the initial setup for gitignore, requirements, and README files.
  9.  
  10. Getting Started:
  11. 1. Ensure Python 3.x is installed on your system.
  12. 2. Save this script to your desired project root directory.
  13. 3. Run the script using the command `python <script_name>.py` in your terminal or command prompt.
  14. 4. The script will create the basic project structure under your current directory, including:
  15.   - A source directory (`src`) with a subdirectory for the app, libraries (`libs`), utilities (`utils`),
  16.     and services (`services`).
  17.   - Placeholder files for the main application (`run.py`), project requirements (`requirements.txt`),
  18.     and documentation (`README.md`).
  19. 5. After running, proceed to populate the generated files and directories with your project's code and documentation.
  20.  
  21. This script is provided by RapidMod, a platform dedicated to enhancing the development workflow through
  22. streamlined project setup and management tools. For more tools and resources, visit https://rapidmod.io/.
  23.  
  24. Note: This is an initial structure setup. Depending on the project's evolution, modifications might be required
  25. to accommodate specific needs or preferences.
  26.  
  27. Author: RapidMod
  28. Website: https://rapidmod.io/
  29. """
  30.  
  31. import os
  32.  
  33. dirs = [
  34.     "src/app/libs",
  35.     "src/app/utils",
  36.     "src/app/services",
  37.     "tests",
  38. ]
  39.  
  40. files = [
  41.     "src/app/run.py",
  42.     ".gitignore",
  43.     "requirements.txt",
  44.     "README.md",
  45. ]
  46.  
  47. for directory in dirs:
  48.     os.makedirs(directory, exist_ok=True)
  49.     print(f"Directory {directory} created.")
  50.  
  51. for file in files:
  52.     with open(file, 'w') as fp:
  53.         pass  # Just to create the file
  54.     print(f"File {file} created.")
Tags: Script
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement