Skip to content

try alternative pymc objct backtracing #276

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Mar 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,6 @@ repos:
minimum_pre_commit_version: 2.8.0
name: Check notebooks have watermark (see Jupyter style guide from PyMC docs)
types: [jupyter]
- id: add-tags
entry: python scripts/add_tags.py
language: python
name: Add PyMC3 classes used to tags
types: [jupyter]
additional_dependencies:
- nbqa==1.1.1
- beautifulsoup4==4.9.3
- myst_parser==0.13.7
- repo: https://github.com/mwouts/jupytext
rev: v1.13.7
hooks:
Expand Down
8 changes: 4 additions & 4 deletions _templates/postcard_categories.html
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,14 @@ <h3>
<div class="container sd-fs-6 sd-font-weight-bold">
<div class="row border-top border-bottom">
{% set t_bool = "tutorial" in post.category|map('string') %}
<div class="col {{ setcolorclass(t_bool) }}"><a href="{{ pathtocategory('tutorial') }}">Tutorial</a></div>
<div class="col"><a class="{{ setcolorclass(t_bool) }}" href="{{ pathtocategory('tutorial') }}">Tutorial</a></div>
{% set h_bool = "how-to" in post.category|map('string') %}
<div class="col {{ setcolorclass(h_bool) }}"><a href="{{ pathtocategory('how-to') }}">How-to</a></div>
<div class="col"><a class="{{ setcolorclass(h_bool) }}" href="{{ pathtocategory('how-to') }}">How-to</a></div>
<div class="w-100"></div>
{% set e_bool = "explanation" in post.category|map('string') %}
<div class="col {{ setcolorclass(e_bool) }}"><a href="{{ pathtocategory('explanation') }}">Explanation</a></div>
<div class="col"><a class="{{ setcolorclass(e_bool) }}" href="{{ pathtocategory('explanation') }}">Explanation</a></div>
{% set r_bool = "reference" in post.category|map('string') %}
<div class="col {{ setcolorclass(r_bool) }}"><a href="{{ pathtocategory('reference') }}">Reference</a></div>
<div class="col"><a class="{{ setcolorclass(r_bool) }}" href="{{ pathtocategory('reference') }}">Reference</a></div>
</div>
</div>

Expand Down
22 changes: 4 additions & 18 deletions examples/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
{"name": "API", "url": "https://docs.pymc.io/en/stable/api.html"},
],
"page_sidebar_items": ["postcard", "page-toc", "edit-this-page"],
"google_analytics_id": "G-6KPRBTE6WV",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Which analytics account does this record to?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there are 3 "properties" inside the pymc devs google account: versioned docs, pymcon and examples (this one)

}
version = os.environ.get("READTHEDOCS_VERSION", "")
version = version if "." in version else "main"
Expand Down Expand Up @@ -99,12 +100,11 @@
# "sidebar-nav-bs.html",
"postcard_categories.html",
"tagcloud.html",
"sidebar-ethical-ads.html",
],
}

# ablog config
blog_baseurl = "https://examples.pymc.io"
blog_baseurl = "https://docs.pymc.io/projects/examples/en/latest/"
blog_title = "PyMC Examples"
blog_path = "blog"
blog_authors = {
Expand Down Expand Up @@ -145,22 +145,8 @@
bibtex_reference_style = "author_year"

# OpenGraph config
# ogp_site_url = "https://predictablynoisy.com"
# ogp_image = "https://predictablynoisy.com/_static/profile-bw.png"
# use default readthedocs integration aka no config here

# codeautolink config
from IPython.core.inputtransformer2 import TransformerManager


def ipython_cell_transform(source):
out = TransformerManager().transform_cell(source)
return source, out


# codeautolink
codeautolink_custom_blocks = {
"ipython3": ipython_cell_transform,
}
codeautolink_autodoc_inject = False
codeautolink_concat_default = True

Expand All @@ -172,7 +158,7 @@ def ipython_cell_transform(source):
"mpl": ("https://matplotlib.org/", None),
"numpy": ("https://numpy.org/doc/stable/", None),
"pandas": ("https://pandas.pydata.org/pandas-docs/stable/", None),
"pymc": ("https://docs.pymc.io/en/stable/", None),
"pymc": ("https://docs.pymc.io/en/latest/", None),
"scipy": ("https://docs.scipy.org/doc/scipy/reference/", None),
"xarray": ("http://xarray.pydata.org/en/stable/", None),
}
1 change: 1 addition & 0 deletions examples/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,5 @@ has tags in its metadata they are listed on the right sidebar after the {fas}`ta
:hidden:

blog
object_index/index
:::
9 changes: 9 additions & 0 deletions examples/object_index/distributions.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
-------------
Distributions
-------------

.. toctree::
:maxdepth: 2

distributions/continuous
distributions/discrete
14 changes: 14 additions & 0 deletions examples/object_index/distributions/continuous.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Continuous
**********

.. autolink-examples:: pymc.Beta
:type: class
:collapse:

.. autolink-examples:: pymc.Exponential
:type: class
:collapse:

.. autolink-examples:: pymc.Normal
:type: class
:collapse:
6 changes: 6 additions & 0 deletions examples/object_index/distributions/discrete.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Discrete
********

.. autolink-examples:: pymc.Poisson
:type: class
:collapse:
20 changes: 20 additions & 0 deletions examples/object_index/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
================
Object use index
================

This page is structured like the {ref}`PyMC API Reference page <pymc:api>` and
for each function in the API it lists all the examples where that PyMC object
is used.

.. warning::

This page is still a proof of concept only. See
`pymc-examples#289 <https://github.com/pymc-devs/pymc-examples/issues/289>`_
for more details.

.. toctree::
:maxdepth: 2

distributions
samplers

31 changes: 31 additions & 0 deletions examples/object_index/samplers.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
------------------
Sampling functions
------------------

.. autolink-examples:: pymc.sample
:type: func
:collapse:

.. autolink-examples:: pymc.sample_posterior_predictive
:type: func
:collapse:

.. autolink-examples:: pymc.sample_prior_predictive
:type: func
:collapse:

--------
Samplers
--------

.. autolink-examples:: pymc.NUTS
:type: class
:collapse:

.. autolink-examples:: pymc.Metropolis
:type: class
:collapse:

.. autolink-examples:: pymc.Slice
:type: class
:collapse:
Empty file removed scripts/__init__.py
Empty file.
92 changes: 0 additions & 92 deletions scripts/add_tags.py

This file was deleted.

57 changes: 0 additions & 57 deletions scripts/find_pm_classes.py

This file was deleted.