Move requirements.txt to a new requirements folder and add optional deps

Some dependencies aren't actually required but can be optionally
installed for extra functionality.

The Chromecast is an optional audio backend
VLC is an optional audio backend
pyalsaaudio is only used by the mark1 enclosure
google-api-python-client is an optional STT backend, by default Mycroft
uses the Mycroft servers
pull/2575/head
Bart Ribbers 2020-05-06 14:52:11 +02:00
parent c9a2348a61
commit 531f78c499
No known key found for this signature in database
GPG Key ID: 699D16185DAFAE61
13 changed files with 42 additions and 20 deletions

View File

@ -26,8 +26,6 @@ install:
- mkdir ${TMPDIR} - mkdir ${TMPDIR}
- echo ${TMPDIR} - echo ${TMPDIR}
- VIRTUALENV_ROOT=${VIRTUAL_ENV} ./dev_setup.sh - VIRTUALENV_ROOT=${VIRTUAL_ENV} ./dev_setup.sh
- pip install -r requirements.txt
- pip install -r test-requirements.txt
# command to run tests # command to run tests
script: script:
- pycodestyle mycroft test - pycodestyle mycroft test

View File

@ -208,4 +208,4 @@ Component licenses for mycroft-core:
The mycroft-core software references various Python Packages (via PIP), The mycroft-core software references various Python Packages (via PIP),
each of which has a separate license. All are compatible with the each of which has a separate license. All are compatible with the
Apache 2.0 license. See the referenced packages listed in the Apache 2.0 license. See the referenced packages listed in the
"requirements.txt" file for specific terms and conditions. "requirements/requirements.txt" file for specific terms and conditions.

View File

@ -1,5 +1,5 @@
recursive-include mycroft/client/speech/recognizer/model * recursive-include mycroft/client/speech/recognizer/model *
include requirements.txt include requirements/requirements.txt
include mycroft/configuration/*.conf include mycroft/configuration/*.conf
recursive-include mycroft/res * recursive-include mycroft/res *
recursive-include mycroft/res/snd * recursive-include mycroft/res/snd *

View File

@ -495,16 +495,28 @@ if ! grep -q "$TOP" $VENV_PATH_FILE ; then
fi fi
# install required python modules # install required python modules
if ! pip install -r requirements.txt ; then if ! pip install -r requirements/requirements.txt ; then
echo 'Warning: Failed to install all requirements. Continue? y/N' echo 'Warning: Failed to install required dependencies. Continue? y/N'
read -n1 continue read -n1 continue
if [[ $continue != 'y' ]] ; then if [[ $continue != 'y' ]] ; then
exit 1 exit 1
fi fi
fi fi
if ! pip install -r test-requirements.txt ; then # install optional python modules
echo "Warning test requirements wasn't installed, Note: normal operation should still work fine..." if [[ ! $(pip install -r requirements/extra-audiobackend.txt) ||
! $(pip install -r requirements/extra-stt.txt) ||
! $(pip install -r requirements/extra-mark1.txt) ]] ; then
echo 'Warning: Failed to install some optional dependencies. Continue? y/N'
read -n1 continue
if [[ $continue != 'y' ]] ; then
exit 1
fi
fi
if ! pip install -r requirements/tests.txt ; then
echo "Warning: Test requirements failed to install. Note: normal operation should still work fine..."
fi fi
SYSMEM=$(free | awk '/^Mem:/ { print $2 }') SYSMEM=$(free | awk '/^Mem:/ { print $2 }')
@ -563,4 +575,4 @@ if [[ ! -w /var/log/mycroft/ ]] ; then
fi fi
#Store a fingerprint of setup #Store a fingerprint of setup
md5sum requirements.txt test-requirements.txt dev_setup.sh > .installed md5sum requirements/requirements.txt requirements/extra-audiobackend.txt requirements/extra-stt.txt requirements/extra-mark1.txt requirements/tests.txt dev_setup.sh > .installed

View File

@ -15,7 +15,6 @@
import subprocess import subprocess
import time import time
import sys import sys
from alsaaudio import Mixer
from threading import Thread, Timer from threading import Thread, Timer
import mycroft.dialog import mycroft.dialog

View File

@ -0,0 +1,2 @@
pychromecast==3.2.2
python-vlc==1.1.2

View File

@ -0,0 +1 @@
pyalsaaudio==0.8.2

View File

@ -0,0 +1 @@
google-api-python-client==1.6.4

View File

@ -7,16 +7,12 @@ SpeechRecognition==3.8.1
tornado==6.0.3 tornado==6.0.3
websocket-client==0.54.0 websocket-client==0.54.0
requests-futures==0.9.5 requests-futures==0.9.5
pyalsaaudio==0.8.2
pyserial==3.0 pyserial==3.0
psutil==5.6.6 psutil==5.6.6
pocketsphinx==0.1.0 pocketsphinx==0.1.0
inflection==0.3.1 inflection==0.3.1
pillow==7.1.2 pillow==7.1.2
python-dateutil==2.6.0 python-dateutil==2.6.0
pychromecast==3.2.2
python-vlc==1.1.2
google-api-python-client==1.6.4
fasteners==0.14.1 fasteners==0.14.1
PyYAML==5.1.2 PyYAML==5.1.2

View File

@ -7,3 +7,5 @@ sphinx==2.2.1
sphinx-rtd-theme==0.4.3 sphinx-rtd-theme==0.4.3
git+https://github.com/behave/behave@v1.2.7.dev1 git+https://github.com/behave/behave@v1.2.7.dev1
allure-behave==2.8.10 allure-behave==2.8.10
python-vlc==1.1.2

View File

@ -144,7 +144,7 @@ function checkmimic() {
# pythoning! # pythoning!
function checkPIP() { function checkPIP() {
mlog "Python checks" mlog "Python checks"
mlog " - Verifying ${MYCROFT_HOME}/requirements.txt:" mlog " - Verifying ${MYCROFT_HOME}/requirements/requirements.txt:"
if workon mycroft ; then if workon mycroft ; then
pip list > /tmp/mycroft-piplist.$$ pip list > /tmp/mycroft-piplist.$$

View File

@ -56,7 +56,12 @@ setup(
author_email='devs@mycroft.ai', author_email='devs@mycroft.ai',
url='https://github.com/MycroftAI/mycroft-core', url='https://github.com/MycroftAI/mycroft-core',
description='Mycroft Core', description='Mycroft Core',
install_requires=required('requirements.txt'), install_requires=required('requirements/requirements.txt'),
extras_require={
'audio-backend': required('requirements/extra-audiobackend.txt'),
'mark1': required('requirements/extra-mark1.txt'),
'stt': required('requirements/extra-stt.txt')
},
packages=find_packages(include=['mycroft*']), packages=find_packages(include=['mycroft*']),
include_package_data=True, include_package_data=True,

View File

@ -64,12 +64,18 @@ RUN python3 -m venv "/opt/mycroft/mycroft-core/.venv"
# determine if any changes have been made since it last started # determine if any changes have been made since it last started
WORKDIR /opt/mycroft/mycroft-core WORKDIR /opt/mycroft/mycroft-core
RUN .venv/bin/python -m pip install pip==20.0.2 RUN .venv/bin/python -m pip install pip==20.0.2
COPY requirements.txt . COPY requirements/requirements.txt .
RUN .venv/bin/python -m pip install -r requirements.txt RUN .venv/bin/python -m pip install -r requirements.txt
COPY test-requirements.txt . COPY requirements/extra-audiobackend.txt .
RUN .venv/bin/python -m pip install -r test-requirements.txt COPY requirements/extra-stt.txt .
COPY requirements/extra-mark1.txt .
RUN .venv/bin/python -m pip install -r extra-audiobackend.txt \
&& .venv/bin/python -m pip install -r extra-stt.txt \
&& .venv/bin/python -m pip install -r extra-mark1.txt
COPY requirements/tests.txt .
RUN .venv/bin/python -m pip install -r tests.txt
COPY dev_setup.sh . COPY dev_setup.sh .
RUN md5sum requirements.txt test-requirements.txt dev_setup.sh > .installed RUN md5sum requirements.txt tests.txt extra-audiobackend.txt extra-stt.txt extra-mark1.txt dev_setup.sh > .installed
# Add the mycroft core virtual environment to the system path. # Add the mycroft core virtual environment to the system path.
ENV PATH /opt/mycroft/mycroft-core/.venv/bin:$PATH ENV PATH /opt/mycroft/mycroft-core/.venv/bin:$PATH