Last active
November 14, 2021 17:31
-
-
Save decorator-factory/bf454432b08caf270a3a69b7a82c513c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# Create a throwaway Python project | |
# Usage: | |
# | |
# 1. Put the script as `pysandbox` somewhere on your PATH | |
# 2. | |
# if (you want a predefined project name): | |
# source pysandbox play-around-with-aioredis | |
# elif (you want a random one): | |
# source pysandbox | |
# 3. ??? | |
# 4. PROFIT | |
# | |
# Optionally you can put a `git-ignore` file in `~/python-sandboxes`. | |
# It will be copied as `.gitignore` to every new project. | |
# | |
if [ -z "$1" ] | |
then | |
KEY=`tr -dc A-Za-z0-9 </dev/urandom | head -c 13 ; echo ''` | |
else | |
KEY="$1" | |
fi | |
echo $KEY | |
mkdir -p "$HOME/python-sandboxes/$KEY" | |
cd "$HOME/python-sandboxes/$KEY" | |
touch requirements.txt | |
python3 -m venv .venv | |
cp ../git-ignore ./.gitignore | |
git init | |
code . | |
source .venv/bin/activate |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment