Skip to content

Commit

Permalink
chore: Build Python protos during sphinx build (#3123)
Browse files Browse the repository at this point in the history
* Fix configuration for sphinx to build Python protos

Signed-off-by: Felix Wang <[email protected]>

* Add RTD docs

Signed-off-by: Felix Wang <[email protected]>

* Add back package

Signed-off-by: Felix Wang <[email protected]>

* Change to not use `make`

Signed-off-by: Felix Wang <[email protected]>

Signed-off-by: Felix Wang <[email protected]>
  • Loading branch information
felixwang9817 authored Aug 23, 2022
1 parent 3910a9c commit 7ca4c23
Show file tree
Hide file tree
Showing 6 changed files with 113 additions and 16 deletions.
23 changes: 23 additions & 0 deletions sdk/python/docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,29 @@
sys.path.insert(0, os.path.abspath("../.."))


# -- Build protos ---------------------------------------------------------

# For an unknown reason, the Python protos stopped being built correctly.
# See https://readthedocs.org/projects/feast/builds/17686555/ for an
# example where the Python protos did not build, which subsequently broke
# the RTD build. In order to fix this, we manually compile the protos.
import subprocess

from pathlib import Path

# cwd will be feast/sdk/python/docs/source
cwd = Path(os.getcwd())

# Change to feast/
os.chdir(cwd.parent.parent.parent.parent)

# Compile Python protos
result = subprocess.run(["python", "setup.py", "build_python_protos", "--inplace"], capture_output=True)
stdout = result.stdout.decode("utf-8")
stderr = result.stderr.decode("utf-8")
print(f"Apply stdout:\n{stdout}")
print(f"Apply stderr:\n{stderr}")

# -- General configuration ------------------------------------------------

# If your documentation needs a minimal Sphinx version, state it here.
Expand Down
23 changes: 23 additions & 0 deletions sdk/python/docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,29 @@
sys.path.insert(0, os.path.abspath("../.."))


# -- Build protos ---------------------------------------------------------

# For an unknown reason, the Python protos stopped being built correctly.
# See https://readthedocs.org/projects/feast/builds/17686555/ for an
# example where the Python protos did not build, which subsequently broke
# the RTD build. In order to fix this, we manually compile the protos.
import subprocess

from pathlib import Path

# cwd will be feast/sdk/python/docs/source
cwd = Path(os.getcwd())

# Change to feast/
os.chdir(cwd.parent.parent.parent.parent)

# Compile Python protos
result = subprocess.run(["python", "setup.py", "build_python_protos", "--inplace"], capture_output=True)
stdout = result.stdout.decode("utf-8")
stderr = result.stderr.decode("utf-8")
print(f"Apply stdout:\n{stdout}")
print(f"Apply stderr:\n{stderr}")

# -- General configuration ------------------------------------------------

# If your documentation needs a minimal Sphinx version, state it here.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
feast.infra.offline\_stores.contrib.mssql\_offline\_store package
=================================================================

Subpackages
-----------

.. toctree::
:maxdepth: 4

feast.infra.offline_stores.contrib.mssql_offline_store.tests

Submodules
----------

feast.infra.offline\_stores.contrib.mssql\_offline\_store.mssql module
----------------------------------------------------------------------

.. automodule:: feast.infra.offline_stores.contrib.mssql_offline_store.mssql
:members:
:undoc-members:
:show-inheritance:

feast.infra.offline\_stores.contrib.mssql\_offline\_store.mssqlserver\_source module
------------------------------------------------------------------------------------

.. automodule:: feast.infra.offline_stores.contrib.mssql_offline_store.mssqlserver_source
:members:
:undoc-members:
:show-inheritance:

Module contents
---------------

.. automodule:: feast.infra.offline_stores.contrib.mssql_offline_store
:members:
:undoc-members:
:show-inheritance:
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
feast.infra.offline\_stores.contrib.mssql\_offline\_store.tests package
=======================================================================

Submodules
----------

feast.infra.offline\_stores.contrib.mssql\_offline\_store.tests.data\_source module
-----------------------------------------------------------------------------------

.. automodule:: feast.infra.offline_stores.contrib.mssql_offline_store.tests.data_source
:members:
:undoc-members:
:show-inheritance:

Module contents
---------------

.. automodule:: feast.infra.offline_stores.contrib.mssql_offline_store.tests
:members:
:undoc-members:
:show-inheritance:
9 changes: 9 additions & 0 deletions sdk/python/docs/source/feast.infra.offline_stores.contrib.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Subpackages
:maxdepth: 4

feast.infra.offline_stores.contrib.athena_offline_store
feast.infra.offline_stores.contrib.mssql_offline_store
feast.infra.offline_stores.contrib.postgres_offline_store
feast.infra.offline_stores.contrib.spark_offline_store
feast.infra.offline_stores.contrib.trino_offline_store
Expand All @@ -23,6 +24,14 @@ feast.infra.offline\_stores.contrib.athena\_repo\_configuration module
:undoc-members:
:show-inheritance:

feast.infra.offline\_stores.contrib.mssql\_repo\_configuration module
---------------------------------------------------------------------

.. automodule:: feast.infra.offline_stores.contrib.mssql_repo_configuration
:members:
:undoc-members:
:show-inheritance:

feast.infra.offline\_stores.contrib.postgres\_repo\_configuration module
------------------------------------------------------------------------

Expand Down
16 changes: 0 additions & 16 deletions sdk/python/docs/source/feast.protos.feast.serving.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,6 @@ feast.protos.feast.serving.Connector\_pb2\_grpc module
:undoc-members:
:show-inheritance:

feast.protos.feast.serving.LoggingService\_pb2 module
-----------------------------------------------------

.. automodule:: feast.protos.feast.serving.LoggingService_pb2
:members:
:undoc-members:
:show-inheritance:

feast.protos.feast.serving.LoggingService\_pb2\_grpc module
-----------------------------------------------------------

.. automodule:: feast.protos.feast.serving.LoggingService_pb2_grpc
:members:
:undoc-members:
:show-inheritance:

feast.protos.feast.serving.ServingService\_pb2 module
-----------------------------------------------------

Expand Down

0 comments on commit 7ca4c23

Please sign in to comment.