Script to automate the creation of new Python projects
- Introduction
- Requirements
- Installation/Configuration
- Authors
- License
- Acknowledgments
Script to automate the creation of new Python projects which runs by batch command or (optionally) with a shortcut (using AutoHotKey) It runs a Python script that creates a folder for the project, a main.py file, a README.me file (with a template), a Github Repository, makes the first commit and lastly it opens the project folder in a new instance of VSCode
- Computer running Windows
- PyGithub Python module
- Github token
-
Install the Python modules (pip install -r requirements.txt)
-
Create two system variables:
- proj_path - Add your projects directory here (the new projects will be created inside this folder)
- git_token - Add your Github token here (get it on your Github account, under Settings -> Developer settings -> Personal access tokens -> Generate new token)
If you don't know how to create system variables check this link https://www.twilio.com/blog/2017/01/how-to-set-environment-variables.html
-
To run the script with a keyboard shortcut (Optional)
- Install AutoHotKey
- Create a new AHK script (check their tutorial to see how it works)
- Add the following code to your script, which runs when the key combination CTRL+ALT+SHIFT+N (you can change the combination for whatever you want) is pressed. It opens a dialog box, asking for the project name, and then it runs the script and creates th project with the given input
;Create New Project - CTRL+ALT+SHIFT+N ^!+n:: InputBox, proj_name, New Project, Project Name:, , 300, 130 If ErrorLevel = 0 Run <path to the create.bat bash file> %proj_name% return
- Add the AHT script to the startup folder so it runs when windows starts
- André Luz - andrefcluz - andrefcluz@gmail.com
N/A
This project is an adaptation of Kalle Hallden's project "ProjectInitializationAutomation", which does almost the same thing. I just changed some things to make it fit better in my workflow
Link to his video: One Day Builds: Automating My Projects With Python
Link to his Github repository: ProjectInitializationAutomation