Skip to content
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

add quarto script to create qmd from docstring, issue #132 #146

Merged
merged 3 commits into from
Jan 25, 2025
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
2 changes: 2 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ We appreciate your contributions and look forward to reviewing your pull request

* Follow the Numpydoc docstring style for the documentation, see [link](https://numpydoc.readthedocs.io/en/latest/format.html)

* To generate .qmd files for package documentation, see tutorial in [_quarto.yml](_quarto.yml)

## Makefile

The `marginaleffects` repository includes a `Makefile` to facilitate some common tasks.
Expand Down
55 changes: 55 additions & 0 deletions _quarto.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
####### README #######
# This is the HOWTO and the config file to build .qmd files
#
# First install quartodoc with `uv pip install quartodoc`
#
# To create the qmd files, run the following command in the terminal:
# > quartodoc build
# the result will be in ./qmd_files or (else specified in the dir field)
# modify the current file to change the included functions and the layout
# finally, run the following command to preview the website if wanted:
# > quarto preview
#
# NOTE: This references the marginaleffects in .venv first, to reference the local marginaleffects, delete or rename the folder marginaleffects in .venv/lib/


project:
type: website

# tell quarto to read the generated sidebar
# metadata-files:
# - _sidebar.yml

format:
html:
theme: cosmo
css: styles.css
toc: false

quartodoc:
# the name used to import the package you want to create reference docs for
package: marginaleffects
style: "pkgdown"
# write sidebar data to this file
# sidebar: _sidebar.yml
dir: qmd_files

sections:
- title: Marginaleffects API reference guide
desc: Marginaleffects functions.
contents:
# the functions being documented in the package.
# you can refer to anything: class methods, modules, etc..
- predictions
- comparisons
- slopes
- hypotheses
- datagrid
- plot_predictions
- plot_comparisons
- plot_slopes
- model_statsmodels
- model_sklearn
- name: utils
members:
- get_dataset
3 changes: 3 additions & 0 deletions marginaleffects/comparisons.py
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,9 @@ def avg_comparisons(
transform=None,
eps=1e-4,
):
"""
docstring (TO DO)
"""
if callable(newdata):
newdata = newdata(model)

Expand Down
3 changes: 3 additions & 0 deletions marginaleffects/model_sklearn.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ def get_predict(self, params, newdata: pl.DataFrame):
def fit_sklearn(
formula: str, data: pl.DataFrame, engine, kwargs_engine={}, kwargs_fit={}
):
"""
fit_sklearn docstring (TO DO)
"""
d = listwise_deletion(formula, data=data)
y, X = model_matrices(formula, d)
# formulaic returns a matrix when the response is character or categorical
Expand Down
3 changes: 3 additions & 0 deletions marginaleffects/model_statsmodels.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,9 @@ def get_df(self):
def fit_statsmodels(
formula: str, data: pl.DataFrame, engine, kwargs_engine={}, kwargs_fit={}
):
"""
fit docstring (TO DO)
"""
d = fml.listwise_deletion(formula, data=data)
y, X = fml.model_matrices(formula, d)
mod = engine(endog=y, exog=X, **kwargs_engine)
Expand Down
3 changes: 3 additions & 0 deletions marginaleffects/predictions.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,9 @@ def avg_predictions(
transform=None,
wts=None,
):
"""
Predict average outcomes (TO DO)
"""
if callable(newdata):
newdata = newdata(model)

Expand Down
6 changes: 6 additions & 0 deletions marginaleffects/slopes.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ def slopes(
eps=1e-4,
eps_vcov=None,
):
"""
slopes docstring (TO DO)
"""
if callable(newdata):
newdata = newdata(model)

Expand Down Expand Up @@ -54,6 +57,9 @@ def avg_slopes(
eps=1e-4,
eps_vcov=None,
):
"""
avg slopes docstring (TO DO)
"""
if callable(newdata):
newdata = newdata(model)

Expand Down
Loading