diff --git a/.github/actions/docs/action.yaml b/.github/actions/docs/action.yaml new file mode 100644 index 00000000..4b48e3ba --- /dev/null +++ b/.github/actions/docs/action.yaml @@ -0,0 +1,14 @@ +name: Run image +description: Run private container from GitHub Packages Registry after Docker login +inputs: + python_version: + description: 'Python version' + required: true +runs: + using: 'docker' + image: docker.pkg.github.com/***REMOVED***/***REMOVED***:latest + args: + - /bin/bash + - "-l" + - "-c" + - "./.github/workflows/docs.sh ${{ inputs.python_version }}" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4ce9f5fa..2975dda8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -49,8 +49,40 @@ jobs: uses: ./.github/actions/unittests with: python_version: ${{ matrix.PYTHON_VERSION }} - # - name: Publish Docs - # run: cd docs/_build/html && gsutil -m cp -r * gs://***REMOVED***/${GITHUB_REPOSITORY}/${GITHUB_SHA}/ + docs: + name: "Documentation" + runs-on: ubuntu-latest + env: + CI: True + strategy: + fail-fast: false + matrix: + PYTHON_VERSION: ['3.8'] + steps: + - name: Docker login + run: docker login docker.pkg.github.com -u ${{ github.actor }} -p ${{ secrets.FQ_GH_TOKEN }} + - name: Pull image + run: docker pull docker.pkg.github.com/***REMOVED***/***REMOVED***:latest + - name: Checkout branch + uses: actions/checkout@v2.1.0 + with: + ref: ${{ github.head_ref }} + - uses: GoogleCloudPlatform/github-actions/setup-gcloud@master + with: + version: '290.0.1' + project_id: ${{ secrets.GCP_UPLOAD_PROJECT_ID }} + service_account_email: ${{ secrets.GCP_UPLOAD_SA_EMAIL }} + service_account_key: ${{ secrets.GCP_UPLOAD_SA_KEY }} + export_default_credentials: true + - name: Run CI inside of container + uses: ./.github/actions/docs + with: + python_version: ${{ matrix.PYTHON_VERSION }} + - name: Publish Docs + run: cd docs/_build/html && gsutil -m cp -r * gs://***REMOVED***/${GITHUB_REPOSITORY}/${GITHUB_SHA}/ + - name: Publish Docs as latest + run: cd docs/_build/html && gsutil -m cp -r * gs://***REMOVED***/${GITHUB_REPOSITORY}/latest/ + if: github.ref == 'refs/heads/master' linux-conda-build: name: "Linux - conda-build - Python ${{ matrix.CONDA_BUILD_YML }}" runs-on: ubuntu-latest diff --git a/.github/workflows/docs.sh b/.github/workflows/docs.sh new file mode 100755 index 00000000..1626a412 --- /dev/null +++ b/.github/workflows/docs.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +set -exo pipefail + +SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" +source ${SCRIPT_DIR}/base.sh $* + +yq -Y '. + {dependencies: [.dependencies[], "python=3.8"] }' environment.yml > /tmp/environment.yml +mamba env create -f /tmp/environment.yml +conda activate $(yq -r .name environment.yml) +pip install --no-use-pep517 --no-deps --disable-pip-version-check -e . + +pushd $(pwd)/docs +make html +popd diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 6c44c8bd..65a3b180 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -7,28 +7,24 @@ Changelog ========= -2.0.1 - 2021-06-15 +2.0.0 - 2021-06-17 ------------------ -**Other changes**: - -We removed the dependency on ``sparse_dot_mkl``. We now use ``scipy.sparse.csr_matvec`` instead of ``sparse_dot_mkl.dot_product_mkl`` on all platforms, because the former suffered from poor performance, especially on narrow problems. +**Breaking changes**: -2.0.0 - 2021-06-10 ------------------- +We renamed several public functions to make them private. These include functions in :mod:`quantcore.matrix.benchmark` that are unlikely to be used outside of this package as well as -**Breaking change**: + - :func:`quantcore.matrix.dense_matrix._matvec_helper` + - :func:`quantcore.matrix.sparse_matrix._matvec_helper`. + - :func:`quantcore.matrix.split_matrix._prepare_out_array`. -Renaming several public functions to make them private. **Other changes**: -Updating linter +- We removed the dependency on ``sparse_dot_mkl``. We now use :func:`scipy.sparse.csr_matvec` instead of :func:`sparse_dot_mkl.dot_product_mkl` on all platforms, because the former suffered from poor performance, especially on narrow problems. This also means that we removed the function :func:`quantcore.matrix.sparse_matrix._dot_product_maybe_mkl`. +- We updated the pre-commit hooks and made sure the code is line with the new hooks. -Changelog -========= - 1.0.6 - 2020-04-26 ------------------ diff --git a/docs/Makefile b/docs/Makefile new file mode 100644 index 00000000..d4bb2cbb --- /dev/null +++ b/docs/Makefile @@ -0,0 +1,20 @@ +# Minimal makefile for Sphinx documentation +# + +# You can set these variables from the command line, and also +# from the environment for the first two. +SPHINXOPTS ?= +SPHINXBUILD ?= sphinx-build +SOURCEDIR = . +BUILDDIR = _build + +# Put it first so that "make" without argument is like "make help". +help: + @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) + +.PHONY: help Makefile + +# Catch-all target: route all unknown targets to Sphinx using the new +# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). +%: Makefile + @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) diff --git a/docs/changelog.rst b/docs/changelog.rst new file mode 120000 index 00000000..e22698ba --- /dev/null +++ b/docs/changelog.rst @@ -0,0 +1 @@ +../CHANGELOG.rst \ No newline at end of file diff --git a/docs/conf.py b/docs/conf.py new file mode 100644 index 00000000..e6c1474a --- /dev/null +++ b/docs/conf.py @@ -0,0 +1,34 @@ +# Configuration file for the Sphinx documentation builder. +# +# This file only contains a selection of the most common options. For a full +# list see the documentation: +# https://www.sphinx-doc.org/en/master/usage/configuration.html + +# -- Path setup -------------------------------------------------------------- + +# If extensions (or modules to document with autodoc) are in another directory, +# add these directories to sys.path here. If the directory is relative to the +# documentation root, use os.path.abspath to make it absolute, like shown here. +# +# import os +# import sys +# sys.path.insert(0, os.path.abspath('.')) + + +# -- Project information ----------------------------------------------------- + +project = "quantcore.matrix" +copyright = "2021, QuantCo, Inc." +author = "QuantCo, Inc." + +extensions = ["numpydoc", "sphinxcontrib.apidoc"] + +apidoc_module_dir = "../src/quantcore" +apidoc_output_dir = "api" +apidoc_separate_modules = True +apidoc_extra_args = ["--implicit-namespaces"] + +templates_path = ["_templates"] +exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"] +html_theme = "sphinx_rtd_theme" +html_static_path = ["_static"] diff --git a/docs/index.rst b/docs/index.rst new file mode 100644 index 00000000..0beb2100 --- /dev/null +++ b/docs/index.rst @@ -0,0 +1,18 @@ +Welcome to quantcore.matrix! +========================================== + +.. toctree:: + :maxdepth: 2 + :caption: Contents: + + API Reference + Changelog + + + +Indices and tables +================== + +* :ref:`genindex` +* :ref:`modindex` +* :ref:`search` diff --git a/docs/make.bat b/docs/make.bat new file mode 100644 index 00000000..96ed7097 --- /dev/null +++ b/docs/make.bat @@ -0,0 +1,35 @@ +@ECHO OFF + +pushd %~dp0 + +REM Command file for Sphinx documentation + +if "%SPHINXBUILD%" == "" ( + set SPHINXBUILD=sphinx-build +) +set SOURCEDIR=. +set BUILDDIR=_build + +if "%1" == "" goto help + +%SPHINXBUILD% >NUL 2>NUL +if errorlevel 9009 ( + echo. + echo.The 'sphinx-build' command was not found. Make sure you have Sphinx + echo.installed, then set the SPHINXBUILD environment variable to point + echo.to the full path of the 'sphinx-build' executable. Alternatively you + echo.may add the Sphinx directory to PATH. + echo. + echo.If you don't have Sphinx installed, grab it from + echo.http://sphinx-doc.org/ + exit /b 1 +) + +%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% +goto end + +:help +%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% + +:end +popd \ No newline at end of file diff --git a/environment.yml b/environment.yml index e69437fc..4af9e7a4 100644 --- a/environment.yml +++ b/environment.yml @@ -11,14 +11,19 @@ dependencies: - flake8 - jemalloc - libblas>=0=*mkl + - make - mako + - matplotlib-base - mkl-include + - numpydoc - pandas - pip - pre-commit - pytest - pytest-xdist + - seaborn-base - setuptools_scm + - sphinx + - sphinx_rtd_theme + - sphinxcontrib-apidoc - xsimd - - matplotlib - - seaborn