Skip to content

Commit 96a2c5b

Browse files
author
Susan Vanderplas
committed
move py dependency management into a folder
1 parent 382c376 commit 96a2c5b

File tree

4 files changed

+15
-15
lines changed

4 files changed

+15
-15
lines changed

py-deps pyenv/py-deps

+14-14
Original file line numberDiff line numberDiff line change
@@ -18,34 +18,34 @@ set_symmetric_difference() {
1818
}
1919

2020
FindRequirements() {
21-
grep -r "from .* import .*" --include "*.qmd" . | awk '{ match( $0, /:from ([A-z0-9]*).?.*? import .*$/, arr) ; if(arr[1] != "") print arr[1] } ' | sort | uniq > py-imports
22-
grep -r "import .* as .*" --include "*.qmd" . | awk '{ match( $0, /:import ([A-z0-9]*).?.*? as .*$/, arr) ; if(arr[1] != "") print arr[1] } ' | sort | uniq >> py-imports
23-
grep -r "import .*" --include "*.qmd" . | awk '{ match( $0, /:import ([A-z0-9]*).*$/, arr) ; if(arr[1] != "") print arr[1] } ' | sort | uniq >> py-imports
21+
grep -r "from .* import .*" --include "*.qmd" . | awk '{ match( $0, /:from ([A-z0-9]*).?.*? import .*$/, arr) ; if(arr[1] != "") print arr[1] } ' | sort | uniq > pyenv/py-imports
22+
grep -r "import .* as .*" --include "*.qmd" . | awk '{ match( $0, /:import ([A-z0-9]*).?.*? as .*$/, arr) ; if(arr[1] != "") print arr[1] } ' | sort | uniq >> pyenv/py-imports
23+
grep -r "import .*" --include "*.qmd" . | awk '{ match( $0, /:import ([A-z0-9]*).*$/, arr) ; if(arr[1] != "") print arr[1] } ' | sort | uniq >> pyenv/py-imports
2424
# deduplicate
25-
cat requirements.txt >> py-imports
26-
cat py-deps-reqs >> py-imports
27-
cat py-imports | sort | uniq > py-imports-clean
25+
cat pyenv/requirements.txt >> pyenv/py-imports
26+
cat pyenv/py-deps-reqs >> pyenv/py-imports
27+
cat pyenv/py-imports | sort | uniq > pyenv/py-imports-clean
2828

2929
# replace PIL with pillow... ugh python sucks
30-
sed -i -e 's/^PIL$/pillow/g' py-imports-clean
30+
sed -i -e 's/^PIL$/pillow/g' pyenv/py-imports-clean
3131
# replace sklearn with scikit-learn
32-
sed -i -e 's/^sklearn$/scikit-learn/g' py-imports-clean
32+
sed -i -e 's/^sklearn$/scikit-learn/g' pyenv/py-imports-clean
3333
# replace cv2 with opencv
34-
sed -i -e 's/^cv2/opencv/g' py-imports-clean
34+
sed -i -e 's/^cv2/opencv/g' pyenv/py-imports-clean
3535

3636
# Python system packages assembled from here: https://docs.python.org/3/library/index.html
3737
# Need to not install these, since python/pip will error out :(
38-
set_difference py-imports-clean py-system-pkgs > py-imports-install
38+
set_difference pyenv/py-imports-clean pyenv/py-system-pkgs > pyenv/py-imports-install
3939

4040
# Remove temp files created when assembling packages
41-
rm py-imports py-imports-clean
42-
mv py-imports-install requirements.txt
41+
rm pyenv/py-imports pyenv/py-imports-clean
42+
mv pyenv/py-imports-install pyenv/requirements.txt
4343
}
4444

4545
SetRequirements() {
4646
# Update dependencies required by the book
4747
# pipdeptree -r -f --warn silence | grep -E '^[a-zA-Z0-9\-]+' > requirements.txt
48-
pip-chill --no-version > requirements.txt
48+
pip-chill --no-version > pyenv/requirements.txt
4949
FindRequirements
5050

5151
echo "Requirements file updated successfully!"
@@ -54,7 +54,7 @@ SetRequirements() {
5454

5555
Install() {
5656
# Install requirements
57-
pip3 install -r requirements.txt
57+
pip3 install -r pyenv/requirements.txt
5858
echo "Packages in requirements.txt installed with pip"
5959
}
6060

py-deps-reqs pyenv/py-deps-reqs

File renamed without changes.
File renamed without changes.

requirements.txt pyenv/requirements.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ astropy
22
babel
33
bs4
44
gspread
5+
inflect
56
IPython
67
jaraco.collections
78
matplotlib
@@ -20,7 +21,6 @@ plotnine
2021
polars
2122
pyreadr
2223
requests
23-
scikit-learn
2424
seaborn
2525
skimpy
2626
statsmodels

0 commit comments

Comments
 (0)