项目作者: braindotai

项目描述 :
Awesome shell automation for python projects. After being tired of doing the same stuff and running the same commands over and over again for initiating my projects, I decided to create a single command, that automates the whole procedure for me.
高级语言: Python
项目地址: git://github.com/braindotai/Python-Project-Shell-Automation.git


Python Project Shell Automation

This project is inspired by Kalle Hallden

In this repo I’ve provided my version of shell automation for python projects, lets get started.

Usage

Requirements

  • Install VS Code
  • If you are using windows, download Git, which will install Git Bash as well. Then open Git Bash and run following commands
  • Install PyGithub, for GitHub integration.

    $ pip3 install PyGithub

  • Install Pyautogui, for automating keyboard to activate the virtual environment, and upgrade the pip.

    $ pip3 install pyautogui

  • Install Python-dotenv, for handeling environment variables in the virtual environment.

    $ pip3 install python-dotenv

Step 1.

You need to set 3 environment variables:

  • GITHUB_USERNAME: Your github username
  • GITHUB_PASSWORD: Your github password
  • PROJECT_PATH: Path where you want to store all your projects
  • BACKUP_PATH: Path where you want to backup all your projects….
    I’d recommend setting it to onedrive path, which periodically syncs all your files within onedrive to cloud

Checkout these tutorials to get it done

For Mac/Linux

For Windows

Step 2.

In the shell, run the following commands:

  • $ git clone https://github.com/braindotai/Shell-Python-Project-Automation.git
  • $ cd Shell-Python-Project-Automation
  • $ mv project.py project
  • $ chmod +x project
  • $ mkdir ~/bin
  • $ cp project ~/bin"
  • $ echo 'export PATH=$PATH":$HOME/bin"' >> .profile
    Then go back to working directory
  • $ cd ..

Step 3.

  1. To create a project

    project create <project name> <description> <private (True/False)> <homepage url>

    Example:

    $ project create “new project” “this is my description for GitHub repository” “False”

    [============= Initiating project: new project =============]

    Creating Readme file ….
    Creating Environment Variables ….
    Creating Virtual Environment ….
    Initiating Git Integration ….
    Initialized empty Git repository in C:/Users/brain/Desktop/Projects/new project/.git/
    [master (root-commit) b2963d5] Initial Commit
    2 files changed, 3 insertions(+)
    create mode 100644 .gitignore
    create mode 100644 README.md
    Adding remote URL
    Pushing initial commit ….
    Enumerating objects: 4, done.
    Counting objects: 100% (4/4), done.
    Delta compression using up to 8 threads
    Compressing objects: 100% (2/2), done.
    Writing objects: 100% (4/4), 282 bytes | 282.00 KiB/s, done.
    Total 4 (delta 0), reused 0 (delta 0)
    To https://github.com/braindotai/new-project-name.git

    • [new branch] master -> master
      Branch ‘master’ set up to track remote branch ‘master’ from ‘origin’.
      Opening project

      [============= Project initiated successfully =============]

  • This creates a project named “new project” in your “PROJECT_PATH”
  • And sets that directory as github master repository
  • Then create the Github repository with name “new project”, description “this is my description”, private setting (True/False) and homepage url as “https://mywebsitename.com
  • Then adds the Github remote url to the project directory
  • Then creates the README.md file
  • And commits an initial commit
  • Then push the initial commit to master repo
  • Then opens the VS Code through that project directory

Now that’s marvelous!!

  1. Setting up you’re project’s environment variables

    You can set you’re environment variables in the .vars file.

    1. USERNAME = 'my username'
    2. PASSWORD = 'my passward'
  2. To print names of projects existing in your PROJECT_PATH

    project list

Example:

  1. $ project list
  2. 1. Custom-Linux-Command-Creator
  3. 2. Deep-Learning-Scratch-Arena
  4. 3. Dr-Deep
  5. 4. Kaggle-Exploratory-Data-Analysis
  6. 5. Shell Python Project Automation
  1. To open a project

    project open <project name>

Example:

  1. $ project open shell python project automation
  1. To check directories of a project

    project <project name>

Example:

  1. $ project shell python project automation
  1. To delete a project

    project delete <project name>

Example:

  1. $ project delete new project
  2. Project "new project" is deleted successfully
  1. To print repository details

    project repo <repo name>

Example:

  1. $ project repo dr deep
  2. =============== dr deep ===============
  3. Contents:
  4. .gitignore
  5. Blood Cells
  6. Breast Cancer
  7. Heart Attack
  8. LICENSE
  9. README.md
  10. Retinal OCT
  11. Skin Cancer
  12. Tuberculosis
  13. samples
  14. Branches:
  15. master
  16. Issues: 0
  17. Private: False
  18. Starts: 0
  19. Forked False
  20. Forks: 0
  21. Watchers: 0
  22. Language: Python
  23. Owner: braindotai
  24. URL: https://github.com/braindotai/Dr-Deep
  25. SSH URL: git@github.com:braindotai/Dr-Deep.git
  26. =======================================
  1. To list all repositories

    project repo list

Example:

  1. $ project repo list
  2. 1. Custom-Linux-Command-Creator
  3. 2. Deep-Learning-Scratch-Arena
  4. 3. Dr-Deep
  5. 4. Dxeon
  6. 5. incubator-mxnet
  7. 6. Kaggle-Exploratory-Data-Analysis
  8. 7. KDD18-Gluon
  9. 8. MXNet-Gluon-Tutorials
  10. 9. pandas-videos
  11. 10. reinforcement-learning
  12. 11. Reinforcement-Learning-Scratch-Arena
  13. 12. Shell-Python-Project-Automation
  1. To delete a repository

    project repo delete <repository name>

Example:

  1. $ project repo delete new project
  2. Repository "new project" is deleted successfully
  1. To create a backup of a project

    project backup <project name>

Example:

  1. $ project backup shell python project automation
  2. Project "shell python project automation" is backuped successfully
  1. For help you can run

    project help

Your Welcome