Skip to content

Commit cad237e

Browse files
authored
Merge branch 'main' into genextreme
2 parents 1232d0b + 47e2e2b commit cad237e

40 files changed

+3597
-13
lines changed

.github/workflows/test.yml

Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
name: pytest
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches: [main]
7+
paths:
8+
- ".github/workflows/*"
9+
- "pymc_experimental/**"
10+
- "setup.py"
11+
- "pyproject.toml"
12+
- "buildosx"
13+
- "conda-envs/**"
14+
- "codecov.yml"
15+
16+
jobs:
17+
ubuntu:
18+
strategy:
19+
matrix:
20+
os: [ubuntu-18.04]
21+
floatx: [float32, float64]
22+
fail-fast: false
23+
runs-on: ${{ matrix.os }}
24+
env:
25+
TEST_SUBSET: ${{ matrix.test-subset }}
26+
AESARA_FLAGS: floatX=${{ matrix.floatx }},gcc__cxxflags='-march=native'
27+
defaults:
28+
run:
29+
shell: bash -l {0}
30+
steps:
31+
- uses: actions/checkout@v2
32+
- name: Cache conda
33+
uses: actions/cache@v1
34+
env:
35+
# Increase this value to reset cache if environment-test-py38.yml has not changed
36+
CACHE_NUMBER: 0
37+
with:
38+
path: ~/conda_pkgs_dir
39+
key: ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-${{
40+
hashFiles('conda-envs/environment-test-py38.yml') }}
41+
- name: Cache multiple paths
42+
uses: actions/cache@v2
43+
env:
44+
# Increase this value to reset cache if requirements.txt has not changed
45+
CACHE_NUMBER: 0
46+
with:
47+
path: |
48+
~/.cache/pip
49+
$RUNNER_TOOL_CACHE/Python/*
50+
~\AppData\Local\pip\Cache
51+
key: ${{ runner.os }}-build-${{ matrix.python-version }}-${{
52+
hashFiles('requirements.txt') }}
53+
- uses: conda-incubator/setup-miniconda@v2
54+
with:
55+
miniforge-variant: Mambaforge
56+
miniforge-version: latest
57+
mamba-version: "*"
58+
activate-environment: pymc-test-py38
59+
channel-priority: strict
60+
environment-file: conda-envs/environment-test-py38.yml
61+
use-mamba: true
62+
use-only-tar-bz2: true # IMPORTANT: This needs to be set for caching to work properly!
63+
- name: Install-pymc
64+
run: |
65+
conda activate pymc-test-py38
66+
pip install -e .
67+
python --version
68+
- name: Run tests
69+
run: |
70+
conda activate pymc-test-py38
71+
python -m pytest -vv --cov=pymc_experimental --cov-append --cov-report=xml --cov-report term --durations=50 $TEST_SUBSET
72+
- name: Upload coverage to Codecov
73+
uses: codecov/codecov-action@v2
74+
with:
75+
env_vars: TEST_SUBSET
76+
name: ${{ matrix.os }} ${{ matrix.floatx }}
77+
fail_ci_if_error: false
78+
windows:
79+
strategy:
80+
matrix:
81+
os: [windows-latest]
82+
floatx: [float32, float64]
83+
fail-fast: false
84+
runs-on: ${{ matrix.os }}
85+
env:
86+
TEST_SUBSET: ${{ matrix.test-subset }}
87+
AESARA_FLAGS: floatX=${{ matrix.floatx }},gcc__cxxflags='-march=core2'
88+
defaults:
89+
run:
90+
shell: cmd
91+
steps:
92+
- uses: actions/checkout@v2
93+
- name: Cache conda
94+
uses: actions/cache@v1
95+
env:
96+
# Increase this value to reset cache if conda-envs/environment-test-py37.yml has not changed
97+
CACHE_NUMBER: 0
98+
with:
99+
path: ~/conda_pkgs_dir
100+
key: ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-${{
101+
hashFiles('conda-envs/windows-environment-test-py37.yml') }}
102+
- name: Cache multiple paths
103+
uses: actions/cache@v2
104+
env:
105+
# Increase this value to reset cache if requirements.txt has not changed
106+
CACHE_NUMBER: 0
107+
with:
108+
path: |
109+
~/.cache/pip
110+
$RUNNER_TOOL_CACHE/Python/*
111+
~\AppData\Local\pip\Cache
112+
key: ${{ runner.os }}-build-${{ matrix.python-version }}-${{
113+
hashFiles('requirements.txt') }}
114+
- uses: conda-incubator/setup-miniconda@v2
115+
with:
116+
miniforge-variant: Mambaforge
117+
miniforge-version: latest
118+
mamba-version: "*"
119+
activate-environment: pymc-test-py37
120+
channel-priority: strict
121+
environment-file: conda-envs/windows-environment-test-py37.yml
122+
use-mamba: true
123+
use-only-tar-bz2: true # IMPORTANT: This needs to be set for caching to work properly!
124+
- name: Install-pymc
125+
run: |
126+
conda activate pymc-test-py37
127+
pip install -e .
128+
python --version
129+
- name: Run tests
130+
# This job uses a cmd shell, therefore the environment variable syntax is different!
131+
# The ">-" in the next line replaces newlines with spaces (see https://stackoverflow.com/a/66809682).
132+
run: >-
133+
conda activate pymc-test-py37 &&
134+
python -m pytest -vv --cov=pymc_experimental --doctest-modules pymc_experimental --cov-append --cov-report=xml --cov-report term --durations=50 %TEST_SUBSET%
135+
- name: Upload coverage to Codecov
136+
uses: codecov/codecov-action@v2
137+
with:
138+
env_vars: TEST_SUBSET
139+
name: ${{ matrix.os }} ${{ matrix.floatx }}
140+
fail_ci_if_error: false

.gitignore

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
*.pyc
2+
*.sw[op]
3+
examples/*.png
4+
nb_examples/
5+
nb_tutorials/
6+
build/*
7+
dist/*
8+
*.egg-info/
9+
.ipynb_checkpoints
10+
tmtags
11+
tags
12+
.DS_Store
13+
.cache
14+
# IntelliJ IDE
15+
.idea
16+
*.iml
17+
18+
# Sphinx
19+
_build
20+
docs/jupyter_execute
21+
docs/.jupyter_cache
22+
docs/**/generated/*
23+
24+
# Merge tool
25+
*.orig
26+
27+
# Docker development
28+
# notebooks/
29+
30+
# air speed velocity (asv)
31+
benchmarks/env/
32+
benchmarks/html/
33+
benchmarks/results/
34+
.pytest_cache/
35+
36+
# Visual Studio / VSCode
37+
.vs/
38+
.vscode/
39+
.mypy_cache
40+
41+
pytestdebug.log
42+
.dir-locals.el
43+
.pycheckers
44+
45+
# Codespaces
46+
pythonenv*

.gitpod.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
tasks:
2+
- name: initialize
3+
init: |
4+
mkdir -p .vscode
5+
mkdir -p ~/.local/bin/
6+
echo '{"python.defaultInterpreterPath": "/home/gitpod/micromamba/envs/pymc-test-py39/bin/python"}' > .vscode/settings.json
7+
curl -Ls https://micro.mamba.pm/api/micromamba/linux-64/latest | tar -xvj -C ~/.local/ bin/micromamba
8+
~/.local/bin/micromamba shell init -s bash -p ~/micromamba
9+
source ~/.bashrc
10+
micromamba create -yf conda-envs/environment-test-py39.yml
11+
pip install -r requirements-dev.txt
12+
command: |
13+
micromamba activate pymc-test-py39
14+
pip install -e .
15+
vscode:
16+
extensions:
17+
- eamodio.gitlens
18+
- ms-python.python
19+
20+
github:
21+
prebuilds:
22+
# enable for master branch
23+
master: true
24+
# enable for other branches (defaults to false)
25+
branches: true
26+
# enable for pull requests coming from this repo (defaults to true)
27+
pullRequests: true
28+
# enable for pull requests coming from forks (defaults to false)
29+
pullRequestsFromForks: false
30+
# add a check to pull requests (defaults to true)
31+
addCheck: true
32+
# add a "Review in Gitpod" button as a comment to pull requests (defaults to false)
33+
addComment: false
34+
# add a "Review in Gitpod" button to the pull request's description (defaults to false)
35+
addBadge: false
36+
# add a label once the prebuild is ready to pull requests (defaults to false)
37+
addLabel: false

.readthedocs.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Read the Docs configuration file
2+
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
3+
version: 2
4+
5+
build:
6+
os: ubuntu-20.04
7+
tools:
8+
python: "3.9"
9+
10+
python:
11+
install:
12+
- requirements: requirements-docs.txt
13+
- requirements: requirements.txt
14+
- method: pip
15+
path: .

CODE_OF_CONDUCT.md

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
# PyMC Code of Conduct
2+
3+
## Our Pledge
4+
5+
In the interest of fostering an open and welcoming environment, we as
6+
contributors and maintainers pledge to making participation in our project and
7+
our community a harassment-free experience for everyone, regardless of age, body
8+
size, disability, ethnicity, sex characteristics, gender identity and expression,
9+
level of experience, education, socio-economic status, nationality, personal
10+
appearance, race, religion, or sexual identity and orientation.
11+
12+
## Our Standards
13+
14+
Examples of behavior that contributes to creating a positive environment
15+
include:
16+
17+
* Using welcoming and inclusive language
18+
* Being respectful of differing viewpoints and experiences
19+
* Gracefully accepting constructive criticism
20+
* Focusing on what is best for the community
21+
* Showing empathy towards other community members
22+
23+
Examples of unacceptable behavior by participants include:
24+
25+
* The use of sexualized language or imagery and unwelcome sexual attention or
26+
advances
27+
* Trolling, insulting/derogatory comments, and personal or political attacks
28+
* Public or private harassment
29+
* Publishing others' private information, such as a physical or electronic
30+
address, without explicit permission
31+
* Other conduct which could reasonably be considered inappropriate in a
32+
professional setting
33+
34+
## Our Responsibilities
35+
36+
Project maintainers are responsible for clarifying the standards of acceptable
37+
behavior and are expected to take appropriate and fair corrective action in
38+
response to any instances of unacceptable behavior.
39+
40+
Project maintainers have the right and responsibility to remove, edit, or
41+
reject comments, commits, code, wiki edits, issues, and other contributions
42+
that are not aligned to this Code of Conduct, or to ban temporarily or
43+
permanently any contributor for other behaviors that they deem inappropriate,
44+
threatening, offensive, or harmful.
45+
46+
## Scope
47+
48+
This Code of Conduct applies both within project spaces and in public spaces
49+
when an individual is representing the project or its community. Examples of
50+
representing a project or community include using an official project e-mail
51+
address, posting via an official social media account, or acting as an appointed
52+
representative at an online or offline event. Representation of a project may be
53+
further defined and clarified by project maintainers.
54+
55+
## Enforcement
56+
57+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
58+
reported by contacting PyMC developer Christopher Fonnesbeck via email
59+
(chris.fonnesbeck@vanderbilt.edu) or phone (615-955-0380). Alternatively, you
60+
may also contact NumFOCUS Executive Director Leah Silen (512-222-5449) or
61+
fill an anonymous report using [NumFOCUS Typeform](https://numfocus.typeform.com/to/ynjGdT).
62+
As PyMC is a member of NumFOCUS and subscribes to their code of conduct as a
63+
precondition for continued membership. All complaints will be reviewed and
64+
investigated and will result in a response that is deemed necessary and
65+
appropriate to the circumstances. The project team is obligated to maintain
66+
confidentiality with regard to the reporter of an incident. Further details of
67+
specific enforcement policies may be posted separately.
68+
69+
Project maintainers who do not follow or enforce the Code of Conduct in good
70+
faith may face temporary or permanent repercussions as determined by other
71+
members of the project's leadership.
72+
73+
## Attribution
74+
75+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
76+
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
77+
78+
[homepage]: https://www.contributor-covenant.org

CONTRIBUTING.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Contributing guide
2+
3+
Page in construction, for now go to https://github.com/pymc-devs/pymc-experimental#questions.

README.md

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,21 @@
1-
# Proposal: `pymc-experimental` repository
1+
# Welcome to `pymc-experimental`
2+
<a href="https://gitpod.io/#https://github.com/pymc-devs/pymc-experimental">
3+
<img
4+
src="https://img.shields.io/badge/Contribute%20with-Gitpod-908a85?logo=gitpod"
5+
alt="Contribute with Gitpod"
6+
/>
7+
</a>
28

3-
As PyMC continues to mature and expand its functionality to accomodate more domains of application, we increasingly see cutting-edge methodologies, highly specialized statistical distributions, and complex models appear. While this adds to the functinoality and relevance of the project, it can also introduce instability and impose a burden on testing and quality control. To help address this, a `pymc-experimental` respository could act as a home for new additions to PyMC, which may include unusual probability distribitions, advanced model fitting algorithms, or any code that may be inappropriate to include in the `pymc` repository, but may want to be made available to users.
9+
As PyMC continues to mature and expand its functionality to accommodate more domains of application, we increasingly see cutting-edge methodologies, highly specialized statistical distributions, and complex models appear.
10+
While this adds to the functionality and relevance of the project, it can also introduce instability and impose a burden on testing and quality control.
11+
To reduce the burden on the main `pymc` repository, this `pymc-experimental` repository can become the aggregator and testing ground for new additions to PyMC.
12+
This may include unusual probability distributions, advanced model fitting algorithms, innovative yet not fully tested methods or any code that may be inappropriate to include in the `pymc` repository, but may want to be made available to users.
413

5-
If implemented thoughtfully, a `pymc-experimental` repository could act as the first step in the PyMC development pipeline, where all novel code is introduced until it is obvious that it belongs in the main repository. This would improve the stability and streamline the testing overhead of the `pymc` respository.
14+
The `pymc-experimental` repository can be understood as the first step in the PyMC development pipeline, where all novel code is introduced until it is obvious that it belongs in the main repository.
15+
We hope that this organization improves the stability and streamlines the testing overhead of the `pymc` repository, while allowing users and developers to test and evaluate cutting-edge methods and not yet fully mature features.
616

7-
`pymc-experimental` would be designed to mirror the namespaces in `pymc` to make usage and migration as easy as possible. For example, a `ParabolicFractal` distribution could be used analogously to those in `pymc`:
17+
`pymc-experimental` would be designed to mirror the namespaces in `pymc` to make usage and migration as easy as possible.
18+
For example, a `ParabolicFractal` distribution could be used analogously to those in `pymc`:
819

920
```python
1021
import pymc as pm
@@ -22,22 +33,28 @@ with pm.Model():
2233

2334
### What belongs in `pymc-experimental`?
2435

25-
- newly-implemented statistical methodologies
36+
- newly-implemented statistical methods, for example step methods or model construction helpers
2637
- distributions that are tricky to sample from or test
2738
- infrequently-used fitting methods or distributions
2839
- any code that requires additional optimization before it can be used in practice
2940

3041

3142
### What does not belong in `pymc-experimental`?
32-
33-
34-
### Should `pymc-experimental` be a submodule?
43+
- Case studies
44+
- Implementations that cannot be applied generically, for example because they are tied to variables from a toy example
3545

3646

3747
### Should there be more than one add-on repository?
3848

39-
Since there is a lot of code that we may not want in the main repository, does it make sense to have more than one additional repository? For exmaple, `pymc-experimental` may just include methods that are not fully developed, tested and trusted, while code that is known to work well and has adequate test coverage could reside in a `pymc-extras` (or similar) repository.
49+
Since there is a lot of code that we may not want in the main repository, does it make sense to have more than one additional repository?
50+
For example, `pymc-experimental` may just include methods that are not fully developed, tested and trusted, while code that is known to work well and has adequate test coverage, but is still too specialized to become part of `pymc` could reside in a `pymc-extras` (or similar) repository.
4051

4152

42-
### How can we minimize the additional burden of additional project repositories?
53+
### Unanswered questions & ToDos
54+
This project is still young and many things have not been answered or implemented.
55+
Please get involved!
4356

57+
* What are guidlines for organizing submodules?
58+
* Proposal: No default imports of WIP/unstable submodules. By importing manually we can avoid breaking the package if a submodule breaks, for example because of an updated dependency.
59+
* How can we minimize the additional burden of additional project repositories?
60+
* ToDo: Setting up a basic CI pipeline

buildosx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/sh
2+
export CFLAGS="-arch x86_64"
3+
export FFLAGS="-static -ff2c -arch x86_64"
4+
export LDFLAGS="-Wall -undefined dynamic_lookup -bundle -arch x86_64"
5+
rm -rf build
6+
python setupegg.py bdist_egg

0 commit comments

Comments
 (0)