1- PACKAGES ?= wo,awe
1+ # TODO rename these packages to something else
2+ PACKAGES ?= wo
3+
4+ help :
5+ @echo " Available commands:"
6+ @echo " "
7+ @echo " run Run the learning_observer Python application."
8+ @echo " install-pre-commit-hook Install the pre-commit git hook."
9+ @echo " install Install the learning_observer package in development mode."
10+ @echo " install-dev Install dev dependencies (requires additional setup)."
11+ @echo " install-packages Install specific packages: [${PACKAGES} ]."
12+ @echo " test Run tests for the specified package (PKG=<package>)."
13+ @echo " linting-setup Setup linting tools and dependencies."
14+ @echo " linting-python Lint Python files using pycodestyle and pylint."
15+ @echo " linting-node Lint Node files (JS, CSS, and unused CSS detection)."
16+ @echo " linting Perform all linting tasks (Python and Node)."
17+ @echo " build-wo-chrome-extension Build the writing-process extension."
18+ @echo " build-python-distribution Build a distribution for the specified package (PKG=<package>)."
19+ @echo " "
20+ @echo " Note: All commands are executed in the current shell environment."
21+ @echo " Ensure your virtual environment is activated if desired, as installs and actions"
22+ @echo " will occur in the environment where the 'make' command is run."
23+ @echo " "
24+ @echo " Use 'make <command>' to execute a command. For example: make run"
225
326run :
427 # If you haven't done so yet, run: make install
528 # we need to make sure we are on the virtual env when we do this
6- cd learning_observer && python learning_observer --watchdog=restart
29+ cd learning_observer && python learning_observer
730
8- venv :
9- # This is unnecessary since LO installs requirements on install.
10- # pip install --no-cache-dir -r requirements.txt
31+ # Install commands
32+ install-pre-commit-hook :
33+ # Adding pre-commit.sh to Git hooks
34+ cp scripts/hooks/pre-commit.sh .git/hooks/pre-commit
35+ chmod +x .git/hooks/pre-commit
1136
12- # install commands
13- install : venv
37+ install : install-pre-commit-hook
1438 # The following only works with specified packages
1539 # we need to install learning_observer in dev mode to
1640 # more easily pass in specific files we need, such as creds
@@ -25,42 +49,28 @@ install: venv
2549 @LODRC_CURRENT=$$(curl -s https://raw.githubusercontent.com/ETS-Next-Gen/lo_assets/main/lo_dash_react_components/lo_dash_react_components-current.tar.gz); \
2650 pip install https://raw.githubusercontent.com/ETS-Next-Gen/lo_assets/main/lo_dash_react_components/$${LODRC_CURRENT}
2751
28- install-dev : venv
52+ install-dev :
2953 # TODO create a dev requirements file
3054 pip install --no-cache-dir -e learning_observer/[${PACKAGES} ]
3155 . ${HOME} /.nvm/nvm.sh && nvm use && pip install -v -e modules/lo_dash_react_components/
3256
33- install-packages : venv
57+ install-packages :
3458 pip install -e learning_observer/[${PACKAGES} ]
3559
36- # Just a little bit of dependency hell...
37- # The AWE Components are built using a specific version of
38- # `spacy`. This requires an out-of-date `typing-extensions`
39- # package. There are few other dependecies that require a
40- # newer version. As far as I can tell, upgrading this package
41- # does not effect the functionality we receive from the AWE
42- # components.
43- # TODO remove this extra step after AWE Component's `spacy`
44- # is no longer version locked.
45- pip install -U typing-extensions
46-
47- # testing commands
60+ # Testing commands
4861test :
49- # this is where we run doctests
50- pytest modules/wo_highlight_dashboard
62+ @if [ -z " $( PKG ) " ] ; then echo " No module specified, please try again with \" make test PKG=path/to/module \" " ; exit 1 ; fi
63+ ./test.sh $( PKG )
5164
5265# Linting commands
53- linting-setup :
54- # Setting up linting related packages
55- pip install pycodestyle pylint
56- npm install
57-
5866linting-python :
5967 # Linting Python modules
68+ pip install pycodestyle pylint
6069 pycodestyle --ignore=E501,W503 $$(git ls-files 'learning_observer/*.py' 'modules/*.py' )
6170 pylint -d W0613,W0511,C0301,R0913,too-few-public-methods $$(git ls-files 'learning_observer/*.py' 'modules/*.py' )
6271
6372linting-node :
73+ npm install
6474 # TODO each of these have lots of errors and block
6575 # the next item from running
6676 # Starting to lint Node modules
@@ -74,8 +84,27 @@ linting-node:
7484linting : linting-setup linting-python linting-node
7585 # Finished linting
7686
77- build-writing-ext :
87+ # Build commands
88+ build-wo-chrome-extension :
7889 # Installing LO Event
7990 cd modules/lo_event && npm install & npm link lo_event
8091 # Building extension
8192 cd extension/writing-process && npm install && npm run build
93+
94+ build-python-distribution :
95+ # Building distribution for package
96+ pip install build
97+ # Switching to package directory
98+ cd $(PKG ) && python -m build
99+
100+ # TODO we may want to have a separate command for uploading to testpypi
101+ upload-python-package-to-pypi : build-python-distribution
102+ pip install twine
103+ # TODO we currently only upload to testpypi
104+ # TODO we need to include `TWINE_USERNAME=__token__`
105+ # and `TWINE_PASSWORD={ourTwineToken}` to authenticate
106+ #
107+ # TODO We have not fully tested the following commands.
108+ # Try out the following steps and fix any bugs so the
109+ # Makefile can do it automatically.
110+ # cd $(PKG) && twine upload -r testpypi dist/*
0 commit comments