NAB
NAB copied to clipboard
Remove duplicate files in py3 branch
This is for PR #341 I noticed some files are the same and could be deduped.
NAB$ fdupes -r nab/ |grep -v 'init.py' nab/detectors/htmjava/src/main/resources/log4j.properties nab/detectors/htmjava/nab/detectors/htmjava/src/main/resources/log4j.properties nab/detectors/htmjava/src/main/java/nab/detectors/htmjava/HTMModel.java nab/detectors/htmjava/nab/detectors/htmjava/src/main/java/nab/detectors/htmjava/HTMModel.java nab/detectors/htmjava/htmjava_detector.py nab/detectors/htmjava/nab/detectors/htmjava/htmjava_detector.py nab/detectors/htmjava/gradlew nab/detectors/htmjava/nab/detectors/htmjava/gradlew nab/detectors/htmjava/gradle/wrapper/gradle-wrapper.properties nab/detectors/htmjava/nab/detectors/htmjava/gradle/wrapper/gradle-wrapper.properties nab/detectors/htmjava/gradle/wrapper/gradle-wrapper.jar nab/detectors/htmjava/nab/detectors/htmjava/gradle/wrapper/gradle-wrapper.jar nab/detectors/htmjava/build.gradle nab/detectors/htmjava/nab/detectors/htmjava/build.gradle nab/detectors/numenta/setup.py nab/detectors/htmjava/setup.py nab/detectors/numenta/requirements.txt nab/detectors/htmjava/requirements.txt nab/detectors/numenta/nab/util.py nab/detectors/htmjava/nab/util.py nab/detectors/numenta/nab/runner.py nab/detectors/htmjava/nab/runner.py nab/detectors/numenta/nab/labeler.py nab/detectors/htmjava/nab/labeler.py nab/detectors/numenta/nab/detectors/base.py nab/detectors/htmjava/nab/detectors/base.py nab/detectors/numenta/nab/corpus.py nab/detectors/htmjava/nab/corpus.py nab/detectors/numenta/numenta_detector.py nab/detectors/numenta/nab/detectors/numenta/numenta_detector.py nab/detectors/numenta/numentaTM_detector.py nab/detectors/numenta/nab/detectors/numenta/numentaTM_detector.py
This shows 2 problems:
- [ ] duplicate directory structure in htmjava - probably a copy mistake
nab/detectors/htmjava/src/main/resources/log4j.properties nab/detectors/htmjava/nab/detectors/htmjava/src/main/resources/log4j.properties
- [ ] common code in numenta/, htmjava/ for python2 -- this could be decoupled to py2/ as a shared code
- [ ] bonus, convert the "main" nab/ files to be both py2,3 compatible. It should be possible.
CC @iandanforth
@breznak Thank you for reporting these issues
Duplicate java files
Agree, will remove
Common py2 files
There is certainly redundancy here. The current setup prioritizes consistency of the detectors/
directory structure. Perhaps @rhyolight can review this ticket and the below options and make a call.
Current
detectors\
detector_1\
detector_2\
...
detector_n\
Replicate nab\detectors
structure under py2\
- Pro: Removes code redundancy between
numenta
andhtmjava
py2 nab subdirs. - Pro: Removes some redundancy in setup instructions.
- Con: htmjava lives in a non-obvious location
detectors\
detector_1\
detector_2\
py2\
run.py
setup.py
nab\
detectors\
numenta\
htmjava\
...
detector_n\
Py2/3 Compat
I'd need signoff to do this and I'm not 100% on all the steps needed to test and maintain a dual code-base. I agree this is possible, and has the advantage of further reducing code redundancy. Can you review the below workflows and add clarity?
Py3
- Install nab
- Run
run.py
using whatever py3 compat detectors you want.
Py2
- Install a virtualenv (where? top level?)
- Activate env
- Install Nupic
- Install nab
- Run py2 specific
run.py
that only supports numenta and numentaTM from detectors\py2 dir? - Run htmjava as specified from within py2\nab\detectors\htmjava ?
Can you review the below workflows and add clarity?
I can retest later this week, but I've tested, documented and made automated the process, please see these PRs to your repo :
https://github.com/iandanforth/NAB/pull/9 https://github.com/iandanforth/NAB/pull/8
Worked fine for me with py3 setup + py2 available.