From inside a new folder run:
pipenv --three
pipenv install --dev --pre pylint black pytest
touch README.md
mkdir tests
touch main.py
wget https://www.gitignore.io/api/vim%2Clinux%2Cpython%2Cvscode -O .gitignore
git init
git add .
git commit -m 'Initial commit'Everytime I start a new Python project, I do the same things over and over:
- Initialize a Pipenv environment
- Install
black,pylint, andpytest - Create a
testsfolder - Download a
.gitignorefrom gitignore.io - Initialize a
gitrepo - Make a first commit called "Initial commit"
There are tons of ways to organize your project ― create a second folder with the name of your project?
Create the tests folder inside that new one? Use a src folder? Create a __init__.py file? A __main__.py file?
create both?! ― and even I don't the same structure for every project, but those 6 steps are included in all of them.
A bash script ― or even an alias! ― that does all of the steps. The general idea is:
pipenv --three
pipenv install --dev --pre pylint black pytest
touch README.md
mkdir tests
touch main.py
wget https://www.gitignore.io/api/vim%2Clinux%2Cpython%2Cvscode -O .gitignore
git init
git add .
git commit -m 'Initial commit'As you can see, all the steps are performed in an orderly manner. You can edit it in anyway you want.
If you use bash, add it as an alias in you .bashrc file. I call it "pyay":
alias pyay="pipenv --three; pipenv install --dev --pre pylint black pytest; touch README.md; mkdir -p src/tests; touch src/main.py; wget https://www.gitignore.io/api/vim%2Clinux%2Cpython%2Cvscode -O .gitignore; git init; git add .; git commit -m 'Initial commit'"If you use xonsh ― and if you're a Python developer you really should check it out! ― just add
the alias to your .xonshrc.
This file was created in the context of this Reddit thread I created to ask other fellow developers about their workflow regarding that sort of issue.