Skip to content

Commit

Permalink
Updating testing and docs infrastructure (#392)
Browse files Browse the repository at this point in the history
* adding tox and updating some deps

* removing 3.7 tests for numpy

* notebooks

* adding notebook output

* adding binder config

* adding tqdm to binder requirements

* using binder conda env

* conda env issue

* conda binder install local
  • Loading branch information
dfm authored Jun 25, 2021
1 parent 0311f0b commit 8a81ba8
Show file tree
Hide file tree
Showing 48 changed files with 2,730 additions and 2,870 deletions.
20 changes: 0 additions & 20 deletions .coveragerc

This file was deleted.

147 changes: 65 additions & 82 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,133 +2,116 @@ name: Tests

on:
push:
branches: [ main ]
branches:
- main
tags:
- "*"
paths-ignore:
- "joss/**"
- "docs/**"
pull_request:
branches: [ main ]
release:
types: [ published ]


jobs:
tests:
name: "py${{ matrix.python-version }} / ${{ matrix.os }} / extras: ${{ matrix.extras }}"
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: ["3.6", "3.7", "3.8", "3.9"]
extras: [true]
python-version: ["3.7", "3.8", "3.9"]
os: ["ubuntu-latest"]
include:
- python-version: "3.8"
extras: false
os: "ubuntu-latest"
- python-version: "3.8"
extras: true
os: "macos-latest"
- python-version: "3.8"
extras: true
os: "windows-latest"

steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
if: ${{ matrix.extras }}
run: |
python -m pip install -U pip
python -m pip install -e ".[extras,tests]"
- name: Install dependencies without extras
if: ${{ !matrix.extras }}
run: |
python -m pip install -U pip
python -m pip install -e ".[tests]"
- name: Run tests
run: |
python -m pytest -v src/emcee/tests --cov emcee
- name: Get unique id
if: ${{ matrix.os != 'windows-latest' }}
id: unique-id
env:
STRATEGY_CONTEXT: ${{ toJson(strategy) }}
run: |
export JOB_ID=`echo $STRATEGY_CONTEXT | md5sum`
echo "::set-output name=id::$JOB_ID"
- uses: actions/upload-artifact@v2
if: ${{ matrix.os != 'windows-latest' }}
with:
name: cov-${{ steps.unique-id.outputs.id }}
path: .coverage

- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install -U pip
python -m pip install -U coveralls coverage[toml] tox tox-gh-actions
- name: Run tests
run: python -m tox
- name: Combine and upload coverage
run: |
python -m coverage combine
python -m coverage xml -i
python -m coveralls --service=github
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_PARALLEL: true
COVERALLS_FLAG_NAME: ${{ matrix.python-version }}-${{ matrix.os }}

coverage:
name: "Merge and upload coverage"
needs: tests
runs-on: ubuntu-latest
steps:
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: "3.9"
- name: Finish coverage collection
run: |
python -m pip install -U pip
python -m pip install -U coveralls
python -m coveralls --finish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Python
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Download all artifacts
uses: actions/download-artifact@v2
- name: Merge and upload coverage
python-version: "3.9"
- name: Install dependencies
run: |
python -m pip install coveralls
find . -name \.coverage -exec coverage combine --append {} \;
coveralls
env:
GITHUB_TOKEN: ${{ secrets.github_token }}
python -m pip install -U pip
python -m pip install tox
- name: Lint the code
run: python -m tox -e lint

build:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
submodules: true

- uses: actions/setup-python@v2
name: Install Python
with:
python-version: "3.8"

- name: Build
run: |
python -m pip install -U pip pep517 twine setuptools_scm
python -m pep517.build .
- name: Test the sdist
python-version: "3.9"
- name: Build sdist and wheel
run: |
python -m venv venv-sdist
venv-sdist/bin/python -m pip install dist/emcee*.tar.gz
venv-sdist/bin/python -c "import emcee;print(emcee.__version__)"
- name: Test the wheel
run: |
python -m venv venv-wheel
venv-wheel/bin/python -m pip install dist/emcee*.whl
venv-wheel/bin/python -c "import emcee;print(emcee.__version__)"
python -m pip install -U pip
python -m pip install -U build
python -m build .
- uses: actions/upload-artifact@v2
with:
name: dist
path: dist/*

upload_pypi:
needs: [tests, build]
needs: [tests, lint, build]
runs-on: ubuntu-latest
if: github.event_name == 'release' && github.event.action == 'published'
if: startsWith(github.ref, 'refs/tags/')
steps:
- uses: actions/download-artifact@v2
with:
name: dist
name: artifact
path: dist
- uses: pypa/gh-action-pypi-publish@master

- uses: pypa/[email protected]
with:
user: __token__
password: ${{ secrets.pypi_password }}
# To test: repository_url: https://test.pypi.org/legacy/
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@ emcee_version.py

.tox
env
.eggs
19 changes: 8 additions & 11 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,29 +1,26 @@

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.3.0
rev: v4.0.1
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: debug-statements

- repo: https://github.com/asottile/seed-isort-config
rev: v1.9.2
hooks:
- id: seed-isort-config
args: [--application-directories=src]

- repo: https://github.com/pre-commit/mirrors-isort
rev: v4.3.20
- repo: https://github.com/PyCQA/isort
rev: "5.9.1"
hooks:
- id: isort
args: []
additional_dependencies: [toml]
exclude: docs/tutorials

- repo: https://github.com/psf/black
rev: 19.3b0
rev: "21.6b0"
hooks:
- id: black

- repo: https://github.com/dfm/black_nbconvert
rev: master
rev: v0.2.0
hooks:
- id: black_nbconvert
2 changes: 1 addition & 1 deletion AUTHORS.rst
Original file line number Diff line number Diff line change
@@ -1 +1 @@
The list of contributors can be found `on GitHub <https://github.com/dfm/emcee/graphs/contributors>`_.
The list of contributors can be found `on GitHub <https://github.com/dfm/emcee/graphs/contributors>`_.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2010-2019 Daniel Foreman-Mackey & contributors.
Copyright (c) 2010-2021 Daniel Foreman-Mackey & contributors.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
6 changes: 2 additions & 4 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,7 @@ Attribution

Please cite `Foreman-Mackey, Hogg, Lang & Goodman (2012)
<https://arxiv.org/abs/1202.3665>`_ if you find this code useful in your
research and add your paper to `the testimonials list
<https://github.com/dfm/emcee/blob/master/docs/testimonials.rst>`_.
The BibTeX entry for the paper is::
research. The BibTeX entry for the paper is::

@article{emcee,
author = {{Foreman-Mackey}, D. and {Hogg}, D.~W. and {Lang}, D. and {Goodman}, J.},
Expand All @@ -53,7 +51,7 @@ The BibTeX entry for the paper is::
License
-------

Copyright 2010-2019 Dan Foreman-Mackey and contributors.
Copyright 2010-2021 Dan Foreman-Mackey and contributors.

emcee is free software made available under the MIT License. For details see
the LICENSE file.
1 change: 0 additions & 1 deletion VISION.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
- Easy to use gradient-free MCMC sampling of black box log probability functions
- Few bells and whistles: no plotting, no modeling, no marginal likelihood calculation, etc.
- Any sampling algorithm must have published proof of correctness

18 changes: 18 additions & 0 deletions binder/environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: emcee
channels:
- conda-forge
dependencies:
- python
- numpy
- scipy
- h5py
- matplotlib
- corner
- tqdm
- mpi4py
- schwimmbad
- pip
- pip:
- celerite
- autograd
- ..
Loading

0 comments on commit 8a81ba8

Please sign in to comment.