Skip to content

Commit

Permalink
MNT: corrections to setup.cfg; use "pytest"; add "make dist" target (#…
Browse files Browse the repository at this point in the history
…534)

* MNT: corrections to setup.cfg; use "pytest"; add "make dist" target

* CI: remove 'python setup.py clean' command; correction to extras require

* CI: enable "twine check --strict" now that warning is resolved
  • Loading branch information
mwtoews authored Jun 19, 2022
1 parent 0c2b5fd commit f658d5f
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 31 deletions.
9 changes: 4 additions & 5 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,10 @@ jobs:
python${{ matrix.python-version }} -m venv testenv
. testenv/bin/activate
python -m pip install --upgrade pip
python setup.py clean
export INSTALL_DEPS='rasterio${{ matrix.rasterio-version }} xarray${{ matrix.xarray-version }}'
[ "${{ matrix.run-with-scipy }}" = "YES" ] && export INSTALL_DEPS="${INSTALL_DEPS} scipy"
python -m pip install $INSTALL_DEPS
python -m pip install -e .[dev,docs]
python -m pip install -e .[dev,doc]
- name: run tests
run: |
Expand Down Expand Up @@ -148,7 +147,7 @@ jobs:
shell: bash
run: |
source activate test
py.test --cov-report term-missing --cov=rioxarray --cov-report xml
pytest --cov-report term-missing --cov=rioxarray --cov-report xml
- name: Test Build docs
shell: bash
Expand Down Expand Up @@ -207,7 +206,7 @@ jobs:
shell: bash
run: |
source activate test
py.test --cov-report term-missing --cov=rioxarray --cov-report xml
pytest --cov-report term-missing --cov=rioxarray --cov-report xml
test_build:
Expand All @@ -233,4 +232,4 @@ jobs:
- name: Check packages
shell: bash
run: |
twine check dist/*
twine check --strict dist/*
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ repos:
rev: 5.10.1
hooks:
- id: isort
args: [setup.py, rioxarray/, test/, docs/]
args: [rioxarray/, test/, docs/]
- repo: https://github.com/asottile/blacken-docs
rev: v1.12.1
hooks:
Expand Down
4 changes: 2 additions & 2 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ Using python::

7. When you're done making changes, check that the tests pass::

$ py.test
$ pytest

8. Commit your changes and push your branch to GitHub (this should trigger pre-commit checks)::

Expand All @@ -121,4 +121,4 @@ Tips

To run a subset of tests::

$ py.test test.test_rioxarray
$ pytest test/unit/test_show_versions.py::test_get_main_info
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ recursive-exclude test *
recursive-exclude * __pycache__
recursive-exclude * *.py[co]

recusive-prune docs/
prune docs/
8 changes: 6 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ pylint:
pylint --load-plugins tests.linter --disable=I,E,W,R,C,F --enable C9999,C9998 tests/

test: ## run tests quickly with the default Python
py.test
pytest

docs: ## generate Sphinx HTML documentation, including API docs
# rm -f docs/rioxarray*.rst
Expand All @@ -80,12 +80,16 @@ docs-browser: docs ## generate Sphinx HTML documentation, including API docs
$(BROWSER) docs/_build/html/index.html

release: dist ## package and upload a release
twine check --strict dist/*
twine upload dist/*

dist: clean ## builds source and wheel package
python -m build

report: install-dev coverage ## clean, install development version, run all tests, produce coverage report

install: clean ## install the package to the active Python's site-packages
python setup.py install
pip install .

install-dev: clean ## install development version to active Python's site-packages
pip install -e .[all]
7 changes: 3 additions & 4 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@
author = rioxarray Contributors
author_email = [email protected]
name = rioxarray
version = attr: rioxarray._version.__version__
description = geospatial xarray extension powered by rasterio
keywords = rioxarray, xarray, rasterio
long_description = file: README.rst
long_description_content_type = text/x-rst
license = Apache
license_file = LICENSE
license_files = LICENSE
platform = any
classifiers =
Development Status :: 4 - Beta
Expand Down Expand Up @@ -72,6 +74,3 @@ all =
%(doc)s
%(test)s
%(dev)s

[bdist_wheel]
universal = 1
17 changes: 1 addition & 16 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,5 @@
"""The setup script."""
from pathlib import Path

from setuptools import setup


def get_version():
"""
retreive rioxarray version information in version variable
(taken from pyproj)
"""
with Path("rioxarray", "_version.py").open() as vfh:
for line in vfh:
if line.find("__version__") >= 0:
# parse __version__ and remove surrounding " or '
return line.split("=", maxsplit=2)[1].strip()[1:-1]
raise SystemExit("ERROR: rioxarray version not found.")


setup(version=get_version())
setup()

0 comments on commit f658d5f

Please sign in to comment.