Project setup script that depends on pyenv. It:
- creates a new project directory (name specified by you)
- makes a new pyenv-virtualenv with your project name
- sets up a .python-version file in project home
- uses pip to install black and pylint in the virtualenv
- creates a .pylintrc file for customization in project home
- Python 3.10.3
- Pip 22.0.4
- Pyenv
- Pyenv-Virtualenv
Unless specified this script will create a new python project in the directory you run this. You are able to pass a path variable with CLI if you so choose. Make sure pyenv is installed you can find the githup at the link. If you are on Mac and have homebrew you can run:
brew install pyenv
Configure your shell's environment for pyenv. The instructions are on the pyenv github page. This lets the .python-version change the pyenv version when you cd into the project.
There is also a script to install pyenv and set up your shell environment here. This is linked from the offical pyenv repo.
You can find this command on their page.
curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash
You can create a symlink that will let you execute this script from anywhere making it much more useful.
- git clone repository
git clone https://github.com/EmZaid/Python-Project-Setup-Script
- make the ppss file executable.
chmod +x ppss
Note: It is the same script just with the .py taken off. You can verify this by running:
diff ppss.py ppss
- make the symlink:
ln -s <location_of_ppss> /usr/local/bin/ppss
- You can now run this script by typing
ppss
and passing arguments.
ppss -an project_name --path ~/Documents
usage: ppss.py [-h] [-a] [-n NAME] [--path PATH]
options:
-h, --help show this help message and exit
-a, -all Runs full script, minimal interaction possible
depending on argumenst passed.
-n NAME, -name NAME Input your project name
--path PATH Path to the python project directory. If no path is supplied uses current working directory.
You can add more Pip instructions by adding to this line (line 163 in the python script):
160 os.system(
161 "~/.pyenv/versions/"
162 + project_name
163 + "/bin/python -m pip install black pylint"
)