-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun_once_after_install-python-setup.sh
65 lines (55 loc) · 1.48 KB
/
run_once_after_install-python-setup.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/usr/bin/env bash
# start clean
# rm -rf $(pyenv root)
# curl -sSL https://install.python-poetry.org | POETRY_VERSION=1.7.0 POETRY_HOME=${HOME}/.poetry python3 - --uninstall
# Make sure python3 installation worked
if ! command -v python3 >/dev/null 2>&1; then
echo "Please install python3"
exit 1
fi
# Install pyenv and a sane python
if [[ ! -x "$(command -v pyenv)" ]]; then
curl https://pyenv.run | bash
fi
export PYENV_ROOT="${HOME}/.pyenv"
if [ -d "${PYENV_ROOT}" ]; then
command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init -)"
fi
PYTHON_VERSION="3.11.1"
${HOME}/bin/pyenv_python_install ${PYTHON_VERSION}
pyenv global ${PYTHON_VERSION}
# Install poetry with the pyenv python
if [[ ! -x "$(command -v poetry)" ]]; then
curl -sSL https://install.python-poetry.org | PYENV_VERSION=${PYTHON_VERSION} POETRY_VERSION=1.7.0 POETRY_HOME=${HOME}/.poetry python3 -
fi
# Create a sane dotfiles venv
export PYENV_VERSION=${PYTHON_VERSION}
export WORKON_HOME=${HOME}/.virtualenvs
venv_name="dotfiles"
venv_location="${WORKON_HOME}/${venv_name}"
echo "Installing dotfiles venv at ${venv_location} with $(python --version)"
python -m venv "${venv_location}"
source ${venv_location}/bin/activate
python -m pip install --upgrade pip
pip install --requirement=/dev/stdin <<EOF
autopep8
black
flake8
jedi
matplotlib
numpy
pandas
pycodestyle
pydocstyle
pyflakes
python-lsp-black
python-lsp-server
pyls-flake8
pylint
scikit-learn
scipy
seaborn
rope
yapf
EOF