diff --git a/.coveragerc b/.coveragerc deleted file mode 100644 index 8040c5843..000000000 --- a/.coveragerc +++ /dev/null @@ -1,22 +0,0 @@ -[run] -omit = - *_test.py - *__init__* - src/exoplanet/gp.py - src/exoplanet/optim.py - src/exoplanet/interp.py - src/exoplanet/sampling.py - src/exoplanet/orbits/constants.py - src/exoplanet/light_curves/integrated.py - src/exoplanet/light_curves/interpolated.py - src/exoplanet/theano_ops/build_utils.py - src/exoplanet/theano_ops/interp/* -relative_files = true - -[report] -exclude_lines = - raise NotImplementedError - except ImportError - pragma: no cover - def R_op - if verbose diff --git a/.github/workflows/joss.yml b/.github/workflows/joss.yml index 677215455..cd8afae78 100644 --- a/.github/workflows/joss.yml +++ b/.github/workflows/joss.yml @@ -4,10 +4,8 @@ on: push: branches: - main - - joss - pull_request: - branches: - - main + paths: + - "joss/**" jobs: joss: diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 6ac0f6de2..4df1db427 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -4,11 +4,12 @@ on: push: branches: - main + tags: + - "*" + paths-ignore: + - "joss/**" + - "docs/**" pull_request: - branches: - - main - release: - types: [published] jobs: tests: @@ -17,60 +18,77 @@ jobs: fail-fast: false matrix: python-version: ["3.9"] - pymc-arviz: - - '"pymc3~=3.9.0" "arviz<0.11"' - - '"pymc3~=3.10.0" "arviz<0.11"' - - '"pymc3~=3.11.0"' - - '"https://github.com/pymc-devs/pymc3/archive/master.zip"' + pymc-version: ["3.9", "3.10", "3.11", "dev"] + include: + - python-version: "3.8" + pymc-version: "3.11" steps: - - uses: actions/checkout@v2 + - name: Checkout + uses: actions/checkout@v2 with: fetch-depth: 0 - - uses: actions/setup-python@v2 - name: Install Python + + - 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 ${{ matrix.pymc-arviz }} - python -m pip install -e .[test] - python -m pip install --no-deps starry - - - name: Get compiledir - id: compiledir - shell: bash -l {0} - run: | - python -c "from aesara_theano_fallback import aesara; print('::set-output name=compiledir::' + aesara.config.compiledir)" - - - name: Cache compiledir - uses: actions/cache@v2 - with: - path: ${{ steps.compiledir.outputs.compiledir }} - key: compiledir-${{ steps.compiledir.outputs.compiledir }}-${{ matrix.pymc-arviz }}-${{ github.sha }} - restore-keys: | - compiledir-${{ steps.compiledir.outputs.compiledir }}-${{ matrix.pymc-arviz }}- + python -m pip install -U coveralls coverage[toml] tox tox-gh-actions - name: Run tests - run: python -m pytest --cov=exoplanet -v tests + run: python -m tox + env: + PYMC_VERSION: ${{ matrix.pymc-version }} - - name: Coveralls - uses: AndreMiras/coveralls-python-action@v20201129 - with: - parallel: true - flag-name: Unit Tests + - 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: py${{ matrix.python-version }}-pymc${{ matrix.pymc-version }} coverage: - name: "Merge and upload coverage" needs: tests runs-on: ubuntu-latest steps: - - name: Coveralls Finished - uses: AndreMiras/coveralls-python-action@v20201129 + - name: Setup Python + uses: actions/setup-python@v2 with: - parallel-finished: true + 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: Setup Python + uses: actions/setup-python@v2 + with: + python-version: "3.9" + + - name: Install dependencies + run: | + python -m pip install -U pip + python -m pip install tox + + - name: Lint the code + run: python -m tox -e lint build: runs-on: ubuntu-latest @@ -92,7 +110,7 @@ jobs: path: dist/* upload_pypi: - needs: [tests, build] + needs: [tests, lint, build] runs-on: ubuntu-latest if: github.event_name == 'release' && github.event.action == 'published' steps: diff --git a/.github/workflows/tutorials.yml b/.github/workflows/tutorials.yml index c772b4df7..e02514c44 100644 --- a/.github/workflows/tutorials.yml +++ b/.github/workflows/tutorials.yml @@ -3,12 +3,11 @@ on: push: branches: - main + tags: + - "*" + paths-ignore: + - "joss/**" pull_request: - branches: - - main - release: - types: - - published jobs: notebooks: diff --git a/environment.yml b/environment.yml deleted file mode 100644 index c37513eff..000000000 --- a/environment.yml +++ /dev/null @@ -1,12 +0,0 @@ -name: exoplanet -channels: - - defaults -dependencies: - - astropy - - pandas - - matplotlib - - pip - - python=3.7 - - numpy - - pip: - - -e .[dev] diff --git a/pyproject.toml b/pyproject.toml index 63b8d7e87..e16155008 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,21 +4,6 @@ build-backend = "setuptools.build_meta" [tool.black] line-length = 79 -exclude = ''' -/( - \.eggs - | \.git - | \.hg - | \.mypy_cache - | \.tox - | \.venv - | _build - | buck-out - | build - | dist - | docs/tutorials -)/ -''' [tool.isort] skip_glob = ["docs/tutorials/*.py"] @@ -28,3 +13,29 @@ include_trailing_comma = true force_grid_wrap = 0 use_parentheses = true known_third_party = ["astropy", "corner", "jupytext", "matplotlib", "nbconvert", "nbformat", "numpy", "packaging", "pandas", "pkg_resources", "pymc3", "pytest", "requests", "scipy", "setuptools", "sphinx_typlog_theme", "theano"] + +[tool.coverage.run] +parallel = true +branch = true +source = ["exoplanet"] +omit = [ + "*_test.py", + "*__init__*", + "*/exoplanet/exoplanet_version.py", + "*/exoplanet/orbits/constants.py", + "*/exoplanet/light_curves/integrated.py", + "*/exoplanet/light_curves/interpolated.py", +] + +[tool.coverage.paths] +source = ["src", "*/site-packages"] + +[tool.coverage.report] +show_missing = true +exclude_lines = [ + "raise NotImplementedError", + "except ImportError", + "pragma: no cover", + "def R_op", + "if verbose" +] diff --git a/pytest.ini b/pytest.ini index 549fcbda8..5181e0992 100644 --- a/pytest.ini +++ b/pytest.ini @@ -1,4 +1,5 @@ [pytest] +testpaths = "tests" addopts = -v filterwarnings = diff --git a/setup.py b/setup.py index 29da7c9cd..dca90da54 100644 --- a/setup.py +++ b/setup.py @@ -34,7 +34,7 @@ "test": [ "scipy", "pytest", - "pytest-cov>=2.6.1", + "coverage[toml]", "pytest-env", "batman-package", ], diff --git a/tox.ini b/tox.ini new file mode 100644 index 000000000..62b443a2e --- /dev/null +++ b/tox.ini @@ -0,0 +1,33 @@ +[tox] +envlist = py{38,39}-pymc{39,310,311,dev},lint + +[gh-actions] +python = + 3.8: py38 + 3.9: py39 + +[gh-actions:env] +PYMC_VERSION = + 3.9: pymc39 + 3.10: pymc310 + 3.11: pymc311 + dev: pymcdev + +[testenv] +passenv = GITHUB_* +deps = + pymc{39,310}: arviz<0.11 + pymc39: pymc3~=3.9.0 + pymc310: pymc3~=3.10.0 + pymc311: pymc3~=3.11.0 + pymcdev: https://github.com/pymc-devs/pymc3/archive/v3.zip +extras = test +commands = + pip freeze + python -m coverage run -m pytest -v {posargs} + +[testenv:lint] +skip_install = true +deps = pre-commit +commands = + pre-commit run --all-files