# Contributing code to Stan

**URL:** <https://discourse.mc-stan.org/t/contributing-code-to-stan/33746>\
**Category:** Developers\
**Tags:** stan-math, blog\
**Created:** [January 7, 2024, 9:16pm UTC](https://discourse.mc-stan.org/t/contributing-code-to-stan/33746 "2024-01-07T21:16:37Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![chvandorp](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/chvandorp/32/5845_2.png) [@chvandorp](https://discourse.mc-stan.org/u/chvandorp)\
**Post date:** [January 7, 2024, 9:16pm UTC](https://discourse.mc-stan.org/t/contributing-code-to-stan/33746/1 "2024-01-07T21:16:37Z")

</div>

Hi all,

I recently submitted a new distribution to the Stan codebase (the Dirichlet-multinomial distribution). I wrote down my experiences in a [blog post](https://tbz533.blogspot.com/2023/12/contributing-code-to-stan.html). This is definitely not a tutorial, and I am not an expert at all, but if you’re interested in contributing to Stan yourself, you might learn something from my (numerous) mistakes.

regards,

Chris

---

<div class="post-metadata">

**Author:** ![WardBrian](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/wardbrian/32/12078_2.png) [@WardBrian](https://discourse.mc-stan.org/u/WardBrian)\
**Post date:** [January 8, 2024, 4:48pm UTC](https://discourse.mc-stan.org/t/contributing-code-to-stan/33746/2 "2024-01-08T16:48:39Z")

</div>

Very nice post! Thank you for your contribution, and your peek at what it looks like for a first-timer :)

A few remarks on some things you mention:

> ```
> The script extract_function_sigs.py is used to scrape these signatures into a plain text file. 
> 
> ```
> 
> which is true, but I’m not sure why this feature exists.

This is primarily used for the various [syntax highlighters](https://mc-stan.org/users/interfaces/#stan-language-syntax-aware-editors) that want a list of the built-in functions to show them in their own color. It was also very helpful when first adding those “Available since…” labels that are now everywhere, since I could generate the list for different snapshots in time and then diff them to see what got added when

> It is possible replace the folder `stan_math` with a link to the `math` folder.

You can also set the `make` variable `MATH` to a path to your own copy of the repo, similar to what you do later for STANC

I hope you enjoyed this experience enough to contribute again someday!

---

<div class="post-metadata">

**Author:** ![mitzimorris](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/mitzimorris/32/29_2.png) [@mitzimorris](https://discourse.mc-stan.org/u/mitzimorris)\
**Post date:** [January 8, 2024, 5:20pm UTC](https://discourse.mc-stan.org/t/contributing-code-to-stan/33746/3 "2024-01-08T17:20:25Z")

</div>

great blog post!

I think that the script `extract_function_sigs.py` is used for RStudio docs - @bgoodri is this still being used?

---

<div class="post-metadata">

**Author:** ![chvandorp](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/chvandorp/32/5845_2.png) [@chvandorp](https://discourse.mc-stan.org/u/chvandorp)\
**Post date:** [January 16, 2024, 3:39pm UTC](https://discourse.mc-stan.org/t/contributing-code-to-stan/33746/4 "2024-01-16T15:39:00Z")

</div>

Thanks! Especially the `make` variable trick is very good to know (and sort of obvious in hindsight). I’ve added these notes to the blog post.  
Contributing was certainly an interesting and valuable experience, and should be a bit easier the second time.
