Skip to content

Commit

Permalink
Squashed 'deps/data/bridgestan/' changes from a8cfe61..c7a425a
Browse files Browse the repository at this point in the history
c7a425a Allow JSON data as a string (#60)
50fe2ec Update README examples section
e380e82 Reword docstrings
fb513e3 Reorganize and update documentation (#57)
96805fd Compile methods: split stanc args from make args, add default include path (#58)
f62bf46 Fix broken link
676db6b Bump actions/setup-python from 2 to 4 (#55)
34f10dd Remove CmdStan Dependency (#51)
821883f Prefix any C-exposed symbols with `bs_` (#54)
81129b0 Add the option for autodiff Hessian calculations (#52)

git-subtree-dir: deps/data/bridgestan
git-subtree-split: c7a425aac54120bafa643b722ed24b2a32111782
  • Loading branch information
goedman committed Dec 7, 2022
1 parent ff837c6 commit 543bfc5
Show file tree
Hide file tree
Showing 53 changed files with 1,197 additions and 985 deletions.
6 changes: 6 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,9 @@ updates:
schedule:
# Check for updates to GitHub Actions every month
interval: "monthly"

# checks if stan-dev/stan@master has changed
- package-ecosystem: "gitsubmodule"
directory: "/"
schedule:
interval: "daily"
23 changes: 8 additions & 15 deletions .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ on:
- 'main'
workflow_dispatch: {}

env:
CMDSTAN_VERSION: "2.31.0"

jobs:
build-docs:
name: Publish documentation to gh-pages
Expand All @@ -23,16 +20,18 @@ jobs:
steps:
- name: Check out github
uses: actions/checkout@v3
with:
submodules: recursive

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies (python)
run: |
python -m pip install --upgrade pip wheel
python -m pip install --upgrade "sphinx>5" nbsphinx ipython ipykernel ipywidgets pydata-sphinx-theme breathe myst-parser
python -m pip install --upgrade "sphinx>5" nbsphinx ipython ipykernel ipywidgets sphinx-copybutton pydata-sphinx-theme breathe myst-parser
- name: Install os dependencies
run: |
Expand All @@ -42,18 +41,12 @@ jobs:
- name: Set up Julia
uses: julia-actions/setup-julia@v1

- name: CmdStan installation cacheing
id: cmdstan-cache
- name: Stan submodule cacheing
uses: actions/cache@v3
id: stan-cache
with:
path: ~/.cmdstan
key: ${{ runner.os }}-cmdstan-${{ env.CMDSTAN_VERSION }}

- name: Install CmdStan
if: steps.cmdstan-cache.outputs.cache-hit != 'true'
run: |
python -m pip install cmdstanpy
python -m cmdstanpy.install_cmdstan --version "${{ env.CMDSTAN_VERSION }}" --cores 2
path: ./stan/
key: ${{ runner.os }}-stan-${{ hashFiles('stan/src/stan/version.hpp') }}-v${{ env.CACHE_VERSION }}

- name: Install package
run: |
Expand Down
76 changes: 38 additions & 38 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ on:
workflow_dispatch: {}

env:
CMDSTAN_VERSION: "2.31.0"
CACHE_VERSION: 0
CACHE_VERSION: 1

jobs:
build_test_models:
Expand All @@ -22,28 +21,19 @@ jobs:
steps:
- name: Check out github
uses: actions/checkout@v3
with:
submodules: recursive

- name: CmdStan installation cacheing
- name: Stan build caching
uses: actions/cache@v3
id: cmdstan-cache
id: stan-cache
with:
path: ~/.cmdstan
key: ${{ runner.os }}-cmdstan-${{ env.CMDSTAN_VERSION }}

- name: Install CmdStan (Unix)
if: matrix.os != 'windows-latest'
run: |
pipx run --spec cmdstanpy install_cmdstan --version "${{ env.CMDSTAN_VERSION }}" --cores 2 --verbose
- name: Install CmdStan (Windows)
if: matrix.os == 'windows-latest'
run: |
pipx run --spec cmdstanpy install_cmdstan --version "${{ env.CMDSTAN_VERSION }}" --cores 2 --verbose --compiler
path: ./stan/
key: ${{ runner.os }}-stan-${{ hashFiles('stan/src/stan/version.hpp') }}-v${{ env.CACHE_VERSION }}

- name: Build C example (Unix)
if: matrix.os != 'windows-latest'
run: |
export CMDSTAN=~/.cmdstan/cmdstan-${{ env.CMDSTAN_VERSION }}/
cd c-example/
make example
make example_static
Expand All @@ -60,20 +50,17 @@ jobs:
id: test-models
with:
path: ./test_models/
key: ${{ hashFiles('**/*.stan', 'src/*') }}-${{ matrix.os }}-cmdstan-${{ env.CMDSTAN_VERSION }}-v${{ env.CACHE_VERSION }}
key: ${{ hashFiles('**/*.stan', 'src/*', 'stan/src/stan/version.hpp') }}-${{ matrix.os }}-v${{ env.CACHE_VERSION }}

- name: Build test models (Unix)
if: matrix.os != 'windows-latest' && steps.test-models.outputs.cache-hit != 'true'
run: |
export CMDSTAN=~/.cmdstan/cmdstan-${{ env.CMDSTAN_VERSION }}/
make STAN_THREADS=true O=0 test_models -j2
shell: bash

- name: Build test models (Windows)
if: matrix.os == 'windows-latest' && steps.test-models.outputs.cache-hit != 'true'
run: |
$raw_cmdstan = "$($HOME)/.cmdstan/cmdstan-${{ env.CMDSTAN_VERSION }}/"
$env:CMDSTAN = $raw_cmdstan.replace('\', '/')
mingw32-make.exe STAN_THREADS=true O=0 test_models -j2
shell: pwsh

Expand All @@ -88,23 +75,27 @@ jobs:
steps:
- name: Check out github
uses: actions/checkout@v3
with:
submodules: recursive

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Restore CmdStan
- name: Restore Stan
uses: actions/cache@v3
id: stan-cache
with:
path: ~/.cmdstan
key: ${{ runner.os }}-cmdstan-${{ env.CMDSTAN_VERSION }}
path: ./stan/
key: ${{ runner.os }}-stan-${{ hashFiles('stan/src/stan/version.hpp') }}-v${{ env.CACHE_VERSION }}

- name: Restore built models
uses: actions/cache@v3
id: test-models
with:
path: ./test_models/
key: ${{ hashFiles('**/*.stan', 'src/*') }}-${{ matrix.os }}-cmdstan-${{ env.CMDSTAN_VERSION }}-v${{ env.CACHE_VERSION }}
key: ${{ hashFiles('**/*.stan', 'src/*', 'stan/src/stan/version.hpp') }}-${{ matrix.os }}-v${{ env.CACHE_VERSION }}

- name: Install package
run: |
Expand All @@ -117,6 +108,7 @@ jobs:
export BRIDGESTAN=$(pwd)
cd python/
pytest -v
pytest -v --run-type=ad_hessian
test_julia_client:
needs: [build_test_models]
Expand All @@ -128,21 +120,25 @@ jobs:
steps:
- name: Check out github
uses: actions/checkout@v3
with:
submodules: recursive

- name: Set up Julia
uses: julia-actions/setup-julia@v1

- name: Restore CmdStan
- name: Restore Stan
uses: actions/cache@v3
id: stan-cache
with:
path: ~/.cmdstan
key: ${{ runner.os }}-cmdstan-${{ env.CMDSTAN_VERSION }}
path: ./stan/
key: ${{ runner.os }}-stan-${{ hashFiles('stan/src/stan/version.hpp') }}-v${{ env.CACHE_VERSION }}

- name: Restore built models
uses: actions/cache@v3
id: test-models
with:
path: ./test_models/
key: ${{ hashFiles('**/*.stan', 'src/*') }}-${{ matrix.os }}-cmdstan-${{ env.CMDSTAN_VERSION }}-v${{ env.CACHE_VERSION }}
key: ${{ hashFiles('**/*.stan', 'src/*', 'stan/src/stan/version.hpp') }}-${{ matrix.os }}-v${{ env.CACHE_VERSION }}

- name: Run tests
run: |
Expand All @@ -159,6 +155,8 @@ jobs:
steps:
- name: Check out github
uses: actions/checkout@v3
with:
submodules: recursive

- name: Install R
uses: r-lib/actions/[email protected]
Expand All @@ -171,18 +169,18 @@ jobs:
any::testthat
any::devtools
- name: Restore CmdStan
- name: Restore Stan
uses: actions/cache@v3
with:
path: ~/.cmdstan
key: ${{ runner.os }}-cmdstan-${{ env.CMDSTAN_VERSION }}
path: ./stan/
key: ${{ runner.os }}-stan-${{ hashFiles('stan/src/stan/version.hpp') }}-v${{ env.CACHE_VERSION }}

- name: Restore built models
uses: actions/cache@v3
id: test-models
with:
path: ./test_models/
key: ${{ hashFiles('**/*.stan', 'src/*') }}-${{ matrix.os }}-cmdstan-${{ env.CMDSTAN_VERSION }}-v${{ env.CACHE_VERSION }}
key: ${{ hashFiles('**/*.stan', 'src/*', 'stan/src/stan/version.hpp') }}-${{ matrix.os }}-v${{ env.CACHE_VERSION }}

- name: Run tests
run: |
Expand All @@ -198,24 +196,26 @@ jobs:
steps:
- name: Check out github
uses: actions/checkout@v3
with:
submodules: recursive

- name: Restore CmdStan
- name: Restore Stan
uses: actions/cache@v3
id: stan-cache
with:
path: ~/.cmdstan
key: ${{ runner.os }}-cmdstan-${{ env.CMDSTAN_VERSION }}
path: ./stan/
key: ${{ runner.os }}-stan-${{ hashFiles('stan/src/stan/version.hpp') }}-v${{ env.CACHE_VERSION }}

- name: Setup TBB
run: |
cd ~/.cmdstan/cmdstan-${{ env.CMDSTAN_VERSION }}
Add-Content $env:GITHUB_PATH "$(pwd)/stan/lib/stan_math/lib/tbb"
- name: Restore built models
uses: actions/cache@v3
id: test-models
with:
path: ./test_models/
key: ${{ hashFiles('**/*.stan', 'src/*') }}-windows-latest-cmdstan-${{ env.CMDSTAN_VERSION }}-v${{ env.CACHE_VERSION }}
key: ${{ hashFiles('**/*.stan', 'src/*', 'stan/src/stan/version.hpp') }}-windows-latest-v${{ env.CACHE_VERSION }}

- name: Install R
uses: r-lib/actions/[email protected]
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,5 @@ bridgestan.Rcheck/
build/

.DS_Store

bin/*
4 changes: 4 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[submodule "stan"]
path = stan
url = https://github.com/stan-dev/stan
branch = master
31 changes: 3 additions & 28 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

We welcome contributions to the project in any form, including bug reports, bug fixes, new features, improved documentation, or improved test coverage.

Our next goal is a stable 1.0 release, which is mostly a matter of more thorough testing and documentation.
Developer-specific documentation is available at https://roualdes.github.io/bridgestan/internals.html

## Licensing

Expand All @@ -29,26 +29,9 @@ We follow standard open source and GitHub practices:
* We propose updates through [GitHub Pull Requests](https://github.com/roualdes/bridgestan/pulls) so that we can do code review. We do not push directly to the main branch.


## Documentation

We use [Sphinx](https://www.sphinx-doc.org/en/master/) to generate documentation, with the goal of publishing on [Read the Docs](https://readthedocs.org) for the first release. The docs are currently hosted on the [GitHub pages](https://roualdes.github.io/bridgestan/) for this repository.

We use the following developer-specific tools for documentation.

* [Sphinx 5.0 or above](https://www.sphinx-doc.org/en/master/)
* [nbsphinx](https://nbsphinx.readthedocs.io/en/0.8.9/)
* [pydata-sphinx-theme](https://pydata-sphinx-theme.readthedocs.io/en/stable/)
* [MySt-Parser](https://myst-parser.readthedocs.io/en/latest/)

If you wish to build the C++ portions of the documentation, you should also have:

* [Doxygen](https://doxygen.nl/)
* [Breathe](https://breathe.readthedocs.io/en/stable/index.html)


## Builds

We use [Gnu make](https://www.gnu.org/software/make/) for builds. If you have installed [CmdStan](https://mc-stan.org/users/interfaces/cmdstan) as required for the source to work, then you will already have Gnu make and a sufficient C++ compiler.
We use [Gnu make](https://www.gnu.org/software/make/) for builds. If you have previously used [CmdStan](https://mc-stan.org/users/interfaces/cmdstan), then you will already have Gnu make and a sufficient C++ compiler.


## Language specific practices
Expand All @@ -71,13 +54,8 @@ We use [Gnu make](https://www.gnu.org/software/make/) for builds. If you have i
### Python development

* Python development relies on the external dependencies:
* [pytest](https://docs.pytest.org/en/7.1.x/)
* [NumPy](https://numpy.org/)

* We integrate a C wrapper of Stan's model class using the [ctypes](https://docs.python.org/3/library/ctypes.html) foreign function interface.

* We use the [numpy.testing](https://numpy.org/doc/stable/reference/routines.testing.html) unit testing framework and run the tests by calling [pytest](https://docs.pytest.org/en/7.1.x/) from the top-level Python directory `bridgestan/python`.

* We autoformat code with [black](https://black.readthedocs.io/en/stable/).

* We recommend but do not require checking the code style and semantics with [PyLint](https://www.pylint.org) using [BridgeStan .pylintrc](https://github.com/roualdes/bridgestan/blob/main/.pylintrc).
Expand All @@ -86,17 +64,14 @@ We use [Gnu make](https://www.gnu.org/software/make/) for builds. If you have i

* R dependencies beyond those included in this repo:
* [R6 package](https://cran.r-project.org/web/packages/R6/index.html) for reference classes
* [testthat](https://testthat.r-lib.org) for unit testing

* We use the most basic [.C interface](https://www.biostat.jhsph.edu/~rpeng/docs/interface.pdf) for calling C from R.

### Julia development

* Julia dependencies beyond those included in this repo:
* [Test](https://docs.julialang.org/en/v1/stdlib/Test/)
* [LinearAlgebra](https://docs.julialang.org/en/v1/stdlib/LinearAlgebra/)

* We use Julia's C foreign function interface, which is documented for [base C](https://docs.julialang.org/en/v1/base/c/) and the [C standard library](https://docs.julialang.org/en/v1/stdlib/Libdl/).
* Julia code is formatted using [JuliaFormatter](https://github.com/domluna/JuliaFormatter.jl).


## Proposing a new interface language
Expand Down
Loading

0 comments on commit 543bfc5

Please sign in to comment.