Skip to content
This repository was archived by the owner on Dec 18, 2023. It is now read-only.

Commit 2e99c73

Browse files
Initial commit
fbshipit-source-id: fff66bcac21896abcf52adf96c4a3dc1eae1b138
0 parents  commit 2e99c73

File tree

653 files changed

+339236
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

653 files changed

+339236
-0
lines changed

.circleci/config.yml

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
version: 2.1
2+
3+
commands:
4+
5+
user_install_beanmachine:
6+
description: "Install beanmachine as an ordinary user would via pip"
7+
steps:
8+
- run:
9+
name: "Install beanmachine"
10+
command: pip install --progress-bar off -v .
11+
12+
pip_install_pytest_patch:
13+
steps:
14+
- run:
15+
name: "Install a patched pytest version from PR (pytest-dev/pytest#7870)"
16+
command: >
17+
pip install --progress-bar off
18+
git+https://github.com/pytest-dev/pytest.git@refs/pull/7870/head
19+
20+
apt_get_install_deps:
21+
description: "Install beanmachine graph dependencies via apt-get"
22+
steps:
23+
- run:
24+
name: "Update package lists"
25+
command: sudo apt-get update
26+
- run:
27+
name: "Install Boost and Eigen"
28+
command: sudo apt-get install libboost-dev libeigen3-dev
29+
30+
pip_list:
31+
description: "Print out package info to help with debug"
32+
steps:
33+
- run:
34+
name: "Pip list installed packages"
35+
command: pip list
36+
37+
user_unit_tests:
38+
description: "Run unit tests as an ordinary user"
39+
steps:
40+
- run:
41+
name: "Install test dependencies"
42+
command: pip install pytest
43+
- run:
44+
name: "Run unit tests"
45+
no_output_timeout: 1h
46+
command: pytest -vv
47+
48+
jobs:
49+
50+
user_install_test_py37_pip:
51+
docker:
52+
- image: circleci/python:3.7
53+
steps:
54+
- apt_get_install_deps
55+
- checkout
56+
- user_install_beanmachine
57+
- pip_install_pytest_patch
58+
- pip_list
59+
- user_unit_tests
60+
61+
aliases:
62+
63+
- &exclude_ghpages_fbconfig
64+
branches:
65+
ignore:
66+
- gh-pages
67+
- fb-config
68+
69+
70+
workflows:
71+
72+
lint_and_test:
73+
jobs:
74+
- user_install_test_py37_pip:
75+
filters: *exclude_ghpages_fbconfig

.dockerignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Dockerfile

.github/ISSUE_TEMPLATE.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
### Issue Description
2+
A clear and concise description of the issue. If it's a feature request, please add [Feature Request] to the title.
3+
4+
### Steps to Reproduce
5+
Please provide steps to reproduce the issue attaching any error messages and stack traces.
6+
7+
### Expected Behavior
8+
What did you expect to happen?
9+
10+
### System Info
11+
Please provide information about your setup
12+
- PyTorch Version (run `print(torch.__version__)`
13+
- Python version
14+
15+
### Additional Context

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
### Motivation
2+
Please describe your motivation for the changes. Provide link to any related issues.
3+
4+
### Changes proposed
5+
Outline the proposed changes and alternatives considered.
6+
7+
### Test Plan
8+
Please provide clear instructions on how the changes were verified. Attach screenshots if applicable.
9+
10+
### Types of changes
11+
- [ ] Docs change / refactoring / dependency upgrade
12+
- [ ] Bug fix (non-breaking change which fixes an issue)
13+
- [ ] New feature (non-breaking change which adds functionality)
14+
- [ ] Breaking change (fix or feature that would cause existing functionality to change)
15+
16+
### Checklist
17+
- [ ] My code follows the code style of this project.
18+
- [ ] My change requires a change to the documentation.
19+
- [ ] I have updated the documentation accordingly.
20+
- [ ] I have read the **[CONTRIBUTING](https://github.com/facebookresearch/beanmachine/blob/main/CONTRIBUTING.md)** document.
21+
- [ ] I have added tests to cover my changes.
22+
- [ ] All new and existing tests passed.
23+
- [ ] The title of my pull request is a short description of the requested changes.

.github/workflows/deploy.yml

Lines changed: 151 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,151 @@
1+
name: Deployment
2+
3+
on:
4+
# this workflow can only be manually triggered for now.
5+
workflow_dispatch:
6+
inputs:
7+
deploy:
8+
description: 'Where to deploy the artifacts? Only build, deploy to test PyPI, deploy to PyPI.'
9+
required: true
10+
type: choice
11+
default: 'test'
12+
options:
13+
- build
14+
- test
15+
- prod
16+
17+
env:
18+
PYTHONUNBUFFERED: 1
19+
20+
jobs:
21+
build-wheel:
22+
# do not run on forked repo
23+
if: github.repository == 'facebookresearch/beanmachine'
24+
runs-on: ${{ matrix.os }}
25+
strategy:
26+
matrix:
27+
os: [macos-latest, windows-latest]
28+
python-version: ['3.7', '3.8'] # TODO: Add python 3.10 with next PyTorch version
29+
defaults:
30+
run:
31+
# https://github.com/conda-incubator/setup-miniconda/tree/v2#use-a-default-shell
32+
shell: bash -l {0}
33+
34+
steps:
35+
- name: Checkout
36+
uses: actions/checkout@v2
37+
38+
- name: Set up Miniconda with Python ${{ matrix.python-version }}
39+
uses: conda-incubator/setup-miniconda@v2
40+
with:
41+
auto-update-conda: true
42+
miniconda-version: "latest"
43+
python-version: ${{ matrix.python-version }}
44+
activate-environment: build_env
45+
46+
- name: Install dependencies
47+
run: |
48+
conda install -y eigen boost
49+
python -m pip install --upgrade pip
50+
pip install -U build
51+
52+
- name: Building Bean Machine wheel for ${{ matrix.os }}
53+
run: python -m build --wheel
54+
55+
- name: Build Bean Machine source distribution
56+
# source distribution only needs to be built on one OS
57+
if: matrix.os == 'macos-latest'
58+
run: python -m build --sdist
59+
60+
- name: Install built Bean Machine dist
61+
run: pip install dist/*.whl
62+
63+
- name: Install pytest 7.0 (with a importlib patch in pytest-dev/pytest#7870)
64+
run: pip install git+https://github.com/pytest-dev/[email protected]
65+
66+
- name: Print out package info to help with debug
67+
run: pip list
68+
69+
- name: Run unit tests with pytest
70+
run: pytest
71+
72+
- name: Sending wheels to the deployment workflow
73+
uses: actions/upload-artifact@v2
74+
with:
75+
name: beanmachine-${{ matrix.os }}
76+
path: dist/*
77+
78+
build-linux-wheel:
79+
if: github.repository == 'facebookresearch/beanmachine'
80+
runs-on: ubuntu-latest
81+
container: quay.io/pypa/manylinux2014_x86_64
82+
strategy:
83+
matrix:
84+
python-version: ['cp37-cp37m', 'cp38-cp38'] # TODO: Add python 3.10 with next PyTorch version
85+
86+
steps:
87+
- name: Checkout
88+
uses: actions/checkout@v2
89+
90+
- name: Install dependencies
91+
run: |
92+
yum install -y boost169-devel eigen3-devel
93+
/opt/python/${{ matrix.python-version }}/bin/python -m pip install --upgrade pip
94+
/opt/python/${{ matrix.python-version }}/bin/pip install -U build
95+
96+
- name: Building Bean Machine wheel for Linux
97+
run: /opt/python/${{ matrix.python-version }}/bin/python -m build --wheel
98+
99+
- name: Repair wheel to support manylinux
100+
run: auditwheel -v repair dist/*
101+
102+
- name: Install built Bean Machine dist
103+
run: /opt/python/${{ matrix.python-version }}/bin/pip install wheelhouse/*.whl
104+
105+
- name: Install pytest 7.0 (with a importlib patch in pytest-dev/pytest#7870)
106+
run: /opt/python/${{ matrix.python-version }}/bin/pip install git+https://github.com/pytest-dev/[email protected]
107+
108+
- name: Print out package info to help with debug
109+
run: /opt/python/${{ matrix.python-version }}/bin/pip list
110+
111+
- name: Run unit tests with pytest
112+
run: /opt/python/${{ matrix.python-version }}/bin/pytest
113+
114+
- name: Sending wheels to the deployment workflow
115+
uses: actions/upload-artifact@v2
116+
with:
117+
name: beanmachine-manylinux
118+
path: wheelhouse/*
119+
120+
publish-to-pypi:
121+
runs-on: ubuntu-latest
122+
needs:
123+
- build-wheel
124+
- build-linux-wheel
125+
steps:
126+
- name: Download wheels from previous jobs
127+
# by default this will download all artifacts
128+
uses: actions/download-artifact@v2
129+
130+
- name: Reorganize file structure
131+
# PyPI publish action uploads everything under dist/*
132+
run: |
133+
ls -R
134+
mkdir dist
135+
mv beanmachine-*/* dist/
136+
137+
- name: Publish to Test PyPI
138+
if: github.event.inputs.deploy == 'test'
139+
uses: pypa/[email protected]
140+
with:
141+
password: ${{ secrets.TEST_PYPI_PASSWORD }}
142+
repository_url: https://test.pypi.org/legacy/
143+
skip_existing: true
144+
verbose: true
145+
146+
- name: Publish to PyPI
147+
if: github.event.inputs.deploy == 'prod' && startsWith(github.ref, 'refs/tags')
148+
uses: pypa/[email protected]
149+
with:
150+
password: ${{ secrets.PYPI_PASSWORD }}
151+
verbose: true

.github/workflows/docs.yml

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
name: Documentation
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
build_docs_job:
11+
runs-on: ubuntu-latest
12+
strategy:
13+
matrix:
14+
python-version: [3.7]
15+
defaults:
16+
run:
17+
# https://github.com/conda-incubator/setup-miniconda/tree/v2#use-a-default-shell
18+
shell: bash -l {0}
19+
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@v2
23+
24+
- name: Set up Miniconda with Python ${{ matrix.python-version }}
25+
uses: conda-incubator/setup-miniconda@v2
26+
with:
27+
auto-update-conda: true
28+
miniconda-version: "latest"
29+
python-version: ${{ matrix.python-version }}
30+
activate-environment: test_env
31+
32+
- name: Install dependencies
33+
run: |
34+
sudo apt-get install -y yarn
35+
conda install -y eigen boost
36+
python -m pip install --upgrade pip
37+
python -m pip install setuptools
38+
python -m pip install notebook
39+
40+
- name: Install Bean Machine in editable mode
41+
run: pip install -v -e .[dev]
42+
43+
# - name: Add tutorials to Docs
44+
# run: |
45+
# cd tutorials
46+
# sh convert.sh
47+
# cd ..
48+
49+
- name: Check env
50+
run: echo `which sphinx-build`
51+
52+
- name: Build the docset
53+
run: |
54+
cd sphinx
55+
pip install -r requirements.txt
56+
make html
57+
cd ..
58+
59+
- name: Build the Website
60+
run: |
61+
cd website
62+
yarn install
63+
yarn build
64+
cd ..
65+
66+
- name: Get output time
67+
run: echo "The time was ${{ steps.build.outputs.time }}"
68+
69+
- name: Deploy
70+
if: ${{ github.event_name == 'push' }}
71+
uses: JamesIves/github-pages-deploy-action@releases/v3
72+
with:
73+
ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
74+
BRANCH: gh-pages # The branch the action should deploy to.
75+
FOLDER: website/build # The folder the action should deploy.

.github/workflows/lint.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Lint
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
lint:
11+
runs-on: ubuntu-latest
12+
strategy:
13+
fail-fast: false
14+
matrix:
15+
python-version: [3.7]
16+
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v2
20+
21+
- name: Set up Python ${{ matrix.python-version }}
22+
uses: actions/setup-python@v2
23+
with:
24+
python-version: ${{ matrix.python-version }}
25+
26+
- name: Install linters
27+
run: |
28+
python -m pip install --upgrade pip
29+
pip install black==20.8b1 usort flake8
30+
31+
- name: Print out package info to help with debug
32+
run: pip list
33+
34+
- name: Lint with flake8
35+
run: flake8 .
36+
37+
- name: Lint with usort
38+
run: usort check .
39+
40+
- name: Lint with black
41+
run: black --check .

0 commit comments

Comments
 (0)