Skip to content

Commit

Permalink
Code coverage and a bunch of other packaging updates (#6)
Browse files Browse the repository at this point in the history
* Update test.yml

* Update gitignore

* Add coverage to testing

* Add pytest coverage requirements

* Split out requirement files

* Add html and terminal local

* Update gitignore

* Update CI coverage

* Update tolerance a little bit for CI

* Change job names

* Pin all development versions
  • Loading branch information
canyon289 authored Jan 30, 2021
1 parent e9489dc commit dff5d53
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 8 deletions.
11 changes: 9 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
matrix:
python-version: [ '3.7', '3.8', '3.9' ]

name: Set up Python ${{ matrix.python-version }}
name: pytest Python ${{ matrix.python-version }}
steps:
- uses: actions/checkout@v1
- name: Set up Python ${{ matrix.python-version }}
Expand All @@ -29,4 +29,11 @@ jobs:
- name: Run the tests with pytest
run: |
pytest -n 4 tests
pytest -n 4 -vv --cov=blackjax --cov-report=xml --cov-report=term tests
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
with:
env_vars: OS,PYTHON
name: codecov-umbrella
fail_ci_if_error: false
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -100,3 +100,8 @@ ehthumbs.db
# Apparently both patterns _have_ to be present on my system.
# Having both is a nice backup, I guess.
.ipynb_checkpoints

.idea
.coverage
coverage.xml
coverage
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ lint:
mypy blackjax tests

test:
pytest -n 4 tests
pytest -n 4 --cov=blackjax --cov-report term --cov-report html:coverage tests

# We launch the package release by tagging the master branch with the package's
# new version number. The version number is read from `blackjax/__init__.py`
Expand Down
2 changes: 2 additions & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ pycodestyle==2.6.0
pyflakes==2.2.0
pyparsing==2.4.7
pytest==6.1.2
pytest-cov==2.11.1
pytest-html==3.1.1
pytest-forked==1.3.0
pytest-xdist==2.1.0
regex==2020.11.13
Expand Down
2 changes: 2 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
jax==0.2.7
jaxlib==0.1.57
9 changes: 5 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ def read(rel_path):
return fp.read()


INSTALL_REQS = read("requirements.txt").splitlines()


def get_version(rel_path):
"""Get the package's version number.
Expand All @@ -32,8 +35,6 @@ def get_version(rel_path):
version=get_version("blackjax/__init__.py"),
description="Flexible and fast inference in Python",
packages=setuptools.find_packages(),
install_requires=[
"jax==0.2.7",
"jaxlib==0.1.57",
],
install_requires=INSTALL_REQS
,
)
2 changes: 1 addition & 1 deletion tests/test_hmc.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,4 @@ def test_hmc(inv_mass_matrix):
scale_samples = states.position["scale"][5000:]

assert np.mean(scale_samples) == pytest.approx(1, 1e-1)
assert np.mean(coefs_samples) == pytest.approx(3, 1e-1)
assert np.mean(coefs_samples) == pytest.approx(3, 2e-1)

0 comments on commit dff5d53

Please sign in to comment.