Skip to content

Commit 64e84e1

Browse files
authored
Merge pull request #93 from rstudio/docs-switch
have stable and latest docs
2 parents 91c9856 + 208a654 commit 64e84e1

7 files changed

Lines changed: 38 additions & 20 deletions

File tree

.github/workflows/docs.yml

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ on:
1010

1111
jobs:
1212
tests:
13-
name: "Tests"
13+
name: "Docs"
1414
runs-on: ubuntu-latest
1515
steps:
1616
- uses: actions/checkout@v2
@@ -20,20 +20,34 @@ jobs:
2020
- name: Install dependencies
2121
run: |
2222
python -m pip install --upgrade pip
23-
python -m pip install -e .[dev,torch]
23+
python -m pip install -e .[dev]
2424
- name: build docs
2525
run: |
26-
cd docs
27-
make html
26+
make docs
2827
- name: save docs
2928
uses: actions/upload-artifact@v3
3029
with:
3130
name: docs-html
3231
path: docs/_build/html/
33-
- name: publish docs
32+
- name: publish dev docs
3433
if: github.ref_name == 'main' && github.ref_type == 'branch'
3534
uses: peaceiris/actions-gh-pages@v3
3635
with:
3736
github_token: ${{ secrets.GITHUB_TOKEN }}
3837
publish_dir: docs/_build/*
3938
publish_branch: gh-pages
39+
destination_dir: main
40+
- name: publish stable docs
41+
if: github.ref_type == 'tag' && startswith(github.ref, 'refs/tags/v')
42+
uses: peaceiris/actions-gh-pages@v3
43+
with:
44+
github_token: ${{ secrets.GITHUB_TOKEN }}
45+
publish_dir: docs/_build/*
46+
publish_branch: gh-pages
47+
destination_dir: github.ref_name
48+
- name: create symlink stable to new version
49+
if: github.ref_type == 'tag' && startswith(github.ref, 'refs/tags/v')
50+
run: |
51+
rm stable
52+
ln -s "${{ github.ref_name }}" stable
53+
ls -la

.github/workflows/weekly.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ on:
1010
workflow_dispatch:
1111
schedule:
1212
# At 00:00 on Monday
13-
- cron: 0 0 * * MON
13+
- cron: "0 0 * * MON"
1414

1515
jobs:
1616
vetiver_main_pins_main:

docs/source/advancedusage/custom_handler.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ This example shows a custom handler of `newmodeltype` type.
88
from vetiver.handlers.base import BaseHandler
99

1010
class CustomHandler(BaseHandler):
11-
def __init__(model, ptype_data):
11+
def __init__(self, model, ptype_data):
1212
super().__init__(model, ptype_data)
1313

1414
model_type = staticmethod(lambda: newmodeltype)

docs/source/index.rst

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,14 @@ You can install the released version of vetiver from `PyPI <https://pypi.org/pro
1010

1111
.. code-block:: bash
1212
13-
pip install vetiver
13+
python -m pip install vetiver
1414
1515
And the development version from `GitHub <https://github.com/rstudio/vetiver-python>`_ with:
1616

1717
.. code-block:: bash
1818
1919
python -m pip install git+https://github.com/rstudio/vetiver-python
2020
21-
2221
This website documents the public API of Vetiver (for Python). See `vetiver.rstudio.com <https://vetiver.rstudio.com>`_ for
2322
more on how to get started.
2423

@@ -36,7 +35,8 @@ Version
3635
:caption: Version
3736

3837
~VetiverModel
39-
~pin_read_write.vetiver_pin_write
38+
~vetiver_pin_write
39+
~vetiver_create_ptype
4040

4141
Deploy
4242
==================
@@ -52,6 +52,7 @@ Deploy
5252
~predict
5353
~write_app
5454
~write_docker
55+
~deploy_rsconnect
5556

5657
Monitor
5758
==================

setup.cfg

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
[metadata]
22
name = vetiver
3-
version = 0.1.5
43
description = Deploy models into REST endpoints
54
long_description = file: README.md
65
long_description_content_type = text/markdown
@@ -44,7 +43,7 @@ dev =
4443
pytest-snapshot
4544
sphinx
4645
sphinx-autodoc-typehints
47-
sphinx-book-theme
46+
sphinx-book-theme==0.3.3
4847
myst-parser
4948

5049
torch =

vetiver/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
from .attach_pkgs import * # noqa
1111
from .meta import * # noqa
1212
from .write_docker import write_docker # noqa
13-
from .write_fastapi import write_app # noqa
13+
from .write_fastapi import write_app, vetiver_write_app # noqa
1414
from .handlers.base import BaseHandler, create_handler, InvalidModelError # noqa
1515
from .handlers.sklearn import SKLearnHandler # noqa
1616
from .handlers.torch import TorchHandler # noqa

vetiver/monitor.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,17 @@ def compute_metrics(
3232
3333
Example
3434
-------
35-
from sklearn import metrics
36-
rng = pd.date_range("1/1/2012", periods=10, freq="S")
37-
new = dict(x=range(len(rng)), y = range(len(rng)))
38-
df = pd.DataFrame(new, index = rng).reset_index(inplace=True)
39-
td = timedelta(seconds = 2)
40-
metric_set = [sklearn.metrics.mean_squared_error, sklearn.metrics.mean_absolute_error]
41-
compute_metrics(df, "index", td, metric_set=metric_set, truth="x", estimate="y")
35+
>>> from sklearn.metrics import mean_squared_error, mean_absolute_error
36+
>>> df = pd.DataFrame(
37+
... {
38+
... "index": ["2021-01-01", "2021-01-02", "2021-01-03"],
39+
... "truth": [200, 201, 199],
40+
... "pred": [198, 200, 199],
41+
... }
42+
... )
43+
>>> td = timedelta(days = 1)
44+
>>> metric_set = [mean_squared_error, mean_absolute_error]
45+
>>> metrics = compute_metrics(df, "index", td, metric_set, "truth", "pred")
4246
4347
"""
4448

0 commit comments

Comments
 (0)