diff --git a/.github/workflows/gh_pages.yml b/.github/workflows/gh_pages.yml new file mode 100644 index 00000000..a7101bd3 --- /dev/null +++ b/.github/workflows/gh_pages.yml @@ -0,0 +1,34 @@ +name: Deploy Docs to GitHub Pages + +on: + push: + branches: + - master + +jobs: + build-and-deploy-docs: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v2 + with: + fetch-depth: 3 + - name: Install Python + uses: actions/setup-python@v2 + with: + python-version: '3.x' + - name: Install package + run: | + pip install -r requirements_build.txt + python setup.py build + python setup.py install + - name: Build docs + run: | + cd doc + pip install -r requirements.txt + make html + - name: Deploy docs + uses: JamesIves/github-pages-deploy-action@4.1.3 + with: + branch: gh-pages + folder: ${{ github.workspace }}/doc/_build/html diff --git a/doc/conf.py b/doc/conf.py index 6abf4cb9..7075d249 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -10,7 +10,6 @@ import sphinx_bootstrap_theme -from lightning import __version__ # -- Project information ----------------------------------------------------- @@ -20,6 +19,13 @@ copyright = '{}, {}'.format(datetime.now().year, author) # The full version, including alpha/beta/rc tags. +try: + from lightning import __version__ +except (ImportError, ModuleNotFoundError) as e: + raise ImportError( + f"You must install '{project}' package itself to build docs for it" + ) from e + release = __version__ # -- General configuration --------------------------------------------------- diff --git a/doc/requirements.txt b/doc/requirements.txt index 2b74c295..2514f1fc 100644 --- a/doc/requirements.txt +++ b/doc/requirements.txt @@ -1,2 +1,4 @@ +matplotlib +sphinx sphinx_bootstrap_theme -sphinx-gallery +sphinx_gallery diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 00000000..0fb39f84 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,4 @@ +joblib +numpy +scikit-learn +scipy diff --git a/requirements_build.txt b/requirements_build.txt new file mode 100644 index 00000000..7933e570 --- /dev/null +++ b/requirements_build.txt @@ -0,0 +1,2 @@ +cython +numpy diff --git a/requirements_test.txt b/requirements_test.txt new file mode 100644 index 00000000..26b77f68 --- /dev/null +++ b/requirements_test.txt @@ -0,0 +1,2 @@ +-r requirements.txt +pytest diff --git a/setup.py b/setup.py index 066ad6f4..b1c9a96c 100644 --- a/setup.py +++ b/setup.py @@ -24,6 +24,12 @@ f.read()) VERSION = match.group('version').strip() MIN_PYTHON_VERSION = '3.6' +with open('requirements.txt', encoding='utf-8') as f: + REQUIREMENTS = [ + line.strip() + for line in f.read().splitlines() + if line.strip() + ] def configuration(parent_package='', top_path=None): @@ -49,9 +55,7 @@ def configuration(parent_package='', top_path=None): name=DISTNAME, maintainer=MAINTAINER, python_requires='>={}'.format(MIN_PYTHON_VERSION), - install_requires=[ - 'scikit-learn' - ], + install_requires=REQUIREMENTS, include_package_data=True, scripts=["bin/lightning_train", "bin/lightning_predict"],