Skip to content

Commit

Permalink
Merge branch 'master' into index_chunksize
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewturk authored Sep 18, 2020
2 parents 2519f0f + ff56ee1 commit 9b79f01
Show file tree
Hide file tree
Showing 460 changed files with 13,526 additions and 11,767 deletions.
2 changes: 0 additions & 2 deletions .coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ omit=*.yml
yt/mods.py
yt/utilities/fits_image.py
yt/utilities/lodgeit.py
yt/utilities/lru_cache.py
yt/utilities/poster/*
yt/visualization/_mpl_imports.py

ignore_errors = True
15 changes: 15 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# transition to isort
7edfcee093cca277307aabdb180e0ffc69768291
81418e459f16c48d6b7a75d6ef8035dfe9651b39

# transition to black
ebadee629414aed2c7b6526e22a419205329ec38

# automated trailing whitespace removal
3ee548b04a41dfbc009921c492fba6a0682651ca

# converting to f-strings
ad898e8e3954bc348daaa449d5ed73db778785e9
ef51ad5199692afcf1a8ab491aa115c00c423113
323ac4ddd4e99d6b951666736d4e9b03b6cfa21e
f7445f02022293f1b089cd8907000301516354bf
5 changes: 3 additions & 2 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@ detail. Why is this change required? What problem does it solve?-->

<!-- Note that some of these check boxes may not apply to all pull requests -->

- [ ] pass `flake8 yt/`
- [ ] pass `isort -rc . --check-only`
- [ ] pass `black --check yt/`
- [ ] pass `isort . --check --diff`
- [ ] pass `flake8 yt/`
- [ ] pass `flynt yt/ --fail-on-change --dry-run -e yt/extern`
- [ ] New features are documented, with docstrings and narrative docs
- [ ] Adds a test for any bugs fixed. Adds tests for new features.

Expand Down
2 changes: 1 addition & 1 deletion .github/mergeable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ mergeable:
message: "WIP pull requests can't be merged."
- do: label
must_include:
regex: 'bug|enhancement|new feature|docs|infrastructure'
regex: 'bug|enhancement|new feature|docs|infrastructure|dead code|refactor'
message: "Please label this pull request with one of: bug, enhancement, new feature, docs or infrastructure."
33 changes: 33 additions & 0 deletions .github/workflows/rules-checks.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Auto review bad practice
on: [pull_request]

jobs:
h5py-bad-practices:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: check-h5py-import
# check that we don't alias h5py to h5
# reason: discoverability is important since this module's api
# is unstable and we want to be able to check for potential future failures
id: h5-import
run: |
grep -r -n "import _h5py as h5" yt | grep -v "import _h5py as h5py" | cat > h5-imports.log
if [ -s h5-imports.log ] ; then
echo "Please do not import h5py as h5. Here are the faulty lines."
cat h5-imports.log
exit 1
fi
- name: check-h5py-filemode
id: h5-file-mode
# check that a mode argument is always present in calls to h5py.File()
# reason: the default value is different in older versions 'w' VS newer ones 'r'
run: |
grep -E -r -n "h5py\.File\([^,]+\)" yt | cat > h5-mode.log
if [ -s h5-mode.log ] ; then
echo "h5py.File() should never be called without an explicit mode argument."
echo "Here are the faulty lines."
cat h5-mode.log
exit 1
fi
20 changes: 20 additions & 0 deletions .github/workflows/slash-command-dispatch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Slash Command Dispatch
on:
issue_comment:
types: [created]
jobs:
slashCommandDispatch:
runs-on: ubuntu-latest
steps:
- name: Slash Command Dispatch
uses: peter-evans/slash-command-dispatch@v2
with:
token: ${{ secrets.PAT }}
commands: |
help
format
rebase
isort
black
flynt
repository: yt-project/slash-command-processor
79 changes: 79 additions & 0 deletions .github/workflows/style-checks.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: Style Checks
on: [pull_request]

jobs:
flake8:
name: flake8
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Setup Python
uses: actions/setup-python@master
with:
python-version: 3.8
- name: install
id: install
run : pip install -r tests/lint_requirements.txt

- name: check
id: flake8
run: |
flake8 --version
flake8 yt/
black:
name: black
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Setup Python
uses: actions/setup-python@master
with:
python-version: 3.8
- name: install
id: install
run : pip install -r tests/lint_requirements.txt

- name: check
id: black
run: |
black --version
black --check --diff yt/
isort:
name: isort
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Setup Python
uses: actions/setup-python@master
with:
python-version: 3.8
- name: install
id: install
run : pip install -r tests/lint_requirements.txt

- name: check
id: isort
run: |
isort --version-number
isort . --check --diff
flynt:
name: flynt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Setup Python
uses: actions/setup-python@master
with:
python-version: 3.8
- name: install
id: install
run : pip install -r tests/lint_requirements.txt

- name: check
id: flynt
run: |
flynt --version
flynt yt --fail-on-change --dry-run --exclude yt/extern
2 changes: 0 additions & 2 deletions .pep8speaks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,6 @@ pycodestyle:
- \*/__config__.py
- yt/visualization/_mpl_imports.py
- yt/utilities/lodgeit.py
- yt/utilities/lru_cache.py
- yt/utilities/poster/\*
- yt/extern/\*
- yt/mods.py
- yt/utilities/fits_image.py
Expand Down
17 changes: 17 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
- repo: https://github.com/ambv/black
rev: 19.10b0
hooks:
- id: black
language_version: python3.7
- repo: https://github.com/timothycrosley/isort
rev: '5.2.1' # keep in sync with tests/lint_requirements.txt
hooks:
- id: isort
- repo: https://gitlab.com/pycqa/flake8
rev: '3.8.1' # keep in sync with tests/lint_requirements.txt
hooks:
- id: flake8
- repo: https://github.com/ikamensh/flynt
rev: '0.52' # keep in sync with tests/lint_requirements.txt
hooks:
- id: flynt
68 changes: 22 additions & 46 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ addons:
env:
global:
PIP=pip
HOMEBREW_NO_AUTO_UPDATE=1

before_install:
- |
Expand All @@ -30,9 +31,8 @@ before_install:
else
sudo mkdir -p /usr/local/man
sudo chown -R "${USER}:admin" /usr/local/man
brew update
brew install python ccache hdf5 proj geos openmpi netcdf
brew uninstall gdal postgis numpy
HOMEBREW_NO_AUTO_UPDATE=1 brew install hdf5 proj geos open-mpi netcdf ccache
HOMEBREW_NO_AUTO_UPDATE=1 brew uninstall gdal postgis numpy # WHY?
export PATH=/usr/local/opt/ccache/libexec:$PATH
fi
mkdir -p $HOME/.config/yt
Expand All @@ -51,42 +51,26 @@ install:
$PIP install --upgrade setuptools
echo "Travis build stage: $TRAVIS_BUILD_STAGE_NAME"
# install dependencies yt
if [[ ${TRAVIS_BUILD_STAGE_NAME} == "lint" ]]; then
export TRAVIS_BUILD_STAGE_NAME="Lint"
fi
if [[ ${TRAVIS_BUILD_STAGE_NAME} != "Lint" ]]; then
if [[ $MINIMAL == 1 ]]; then
# Ensure numpy and cython are installed so dependencies that need to be built
# don't error out
# The first numpy to support py3.6 is 1.12, but numpy 1.13 matches
# unyt so we'll match it here.
$PIP install numpy==1.13.3 cython==0.26.1
$PIP install -r tests/test_minimal_requirements.txt
else
# Getting cartopy installed requires getting cython and numpy installed
# first; this is potentially going to be fixed with the inclusion of
# pyproject.toml in cartopy.
# These versions are pinned, so we will need to update/remove them when
# the hack is no longer necessary.
$PIP install numpy==1.18.1 cython==0.29.6
CFLAGS="$CFLAGS -DACCEPT_USE_OF_DEPRECATED_PROJ_API_H" $PIP install -r tests/test_requirements.txt
fi
$PIP install -e .
if [[ $MINIMAL == 1 ]]; then
# Ensure numpy and cython are installed so dependencies that need to be built
# don't error out
# The first numpy to support py3.6 is 1.12, but numpy 1.13 matches
# unyt so we'll match it here.
$PIP install numpy==1.13.3 cython==0.26.1
$PIP install -r tests/test_minimal_requirements.txt
else
$PIP install -r tests/lint_requirements.txt
# Getting cartopy installed requires getting cython and numpy installed
# first; this is potentially going to be fixed with the inclusion of
# pyproject.toml in cartopy.
# These versions are pinned, so we will need to update/remove them when
# the hack is no longer necessary.
$PIP install -r tests/test_prerequirements.txt
CFLAGS="$CFLAGS -DACCEPT_USE_OF_DEPRECATED_PROJ_API_H" $PIP install -r tests/test_requirements.txt
fi
$PIP install -e .
jobs:
include:
- stage: Lint
python: 3.6
script: flake8 yt/

- stage: Lint
python: 3.6
script: isort --check-only -rc yt/
script: black --check yt/

- stage: tests
name: "Python: 3.6 Minimal Dependency Unit Tests"
python: 3.6
Expand Down Expand Up @@ -116,21 +100,13 @@ jobs:
name: "MacOS: Unit Tests"
os: osx
osx_image: xcode10.1
language: generic # https://github.com/travis-ci/travis-ci/issues/2312
language: shell
env: PIP=pip3
cache:
pip: false
directories:
- directories:
- $HOME/Library/Caches/pip
# `cache` does not support `env`-like `global` so copy-paste from top
- $HOME/.ccache # https://github.com/travis-ci/travis-ci/issues/5853
script: nosetests -c nose_unit.cfg

after_success:
- |
if [[ ${TRAVIS_BUILD_STAGE_NAME} == "lint" ]]; then
export TRAVIS_BUILD_STAGE_NAME="Lint"
fi
if [[ ${TRAVIS_BUILD_STAGE_NAME} != "Lint" ]]; then
codecov
fi
- codecov

25 changes: 15 additions & 10 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@ of a repository; in this case the fork will live in the space under your
username on github, rather than the ``yt-project``. If you have never made a
fork of a repository on github, or are unfamiliar with this process, here is a
short article about how to do so:
https://help.github.com/en/github/getting-started-with-github/fork-a-repo .
https://help.github.com/en/github/getting-started-with-github/fork-a-repo .
The documentation for
``yt`` lives in the ``doc`` directory in the root of the yt git
repository. To make a contribution to the yt documentation you will
repository. To make a contribution to the yt documentation you will
make your changes in your own fork of ``yt``. When you are done,
issue a pull request through the website for your new fork, and we can comment
back and forth and eventually accept your changes. See :ref:`sharing-changes` for
Expand Down Expand Up @@ -87,7 +87,7 @@ usually we end up accepting.

For more information, see :ref:`contributing-code`, where we spell out how to
get up and running with a development environment, how to commit, and how to
use GitHub. When you're ready to share your changes with the community, refer to
use GitHub. When you're ready to share your changes with the community, refer to
:ref:`sharing-changes` to see how to contribute them back upstream.

Online Presence
Expand Down Expand Up @@ -337,12 +337,12 @@ revision specifier will not show more recent changes to the repository. An
alternative option is to use ``checkout`` on a branch. In yt the ``master``
branch is our primary development branch, so checking out ``master`` should
return you to the tip (or most up-to-date revision specifier) on the ``master``
branch.
branch.

.. code-block:: bash
$ git checkout master
Lastly, if you want to use this new downloaded version of your yt repository as
the *active* version of yt on your computer (i.e. the one which is executed when
you run yt from the command line or the one that is loaded when you do ``import
Expand Down Expand Up @@ -723,8 +723,8 @@ Below are a list of rules for coding style in yt. Some of these rules are
suggestions are not explicitly enforced, while some are enforced via automated
testing.

The yt project uses ``flake8`` to report on code correctness (syntax + anti-pattern
detection), and ``black`` for automated formatting.
The yt project uses ``flake8`` to report on code correctness (syntax +
anti-pattern detection), and ``isort``, ``black`` and ``flynt`` for automated formatting.

To check the coding style of your contributions locally you will need to install those
tools, which can be done for instance with ``pip``:
Expand All @@ -738,7 +738,9 @@ Then run the checks from the top level of the repository with
.. code-block:: bash
$ flake8 yt/
$ black --check
$ black --check yt/
$ isort --check yt/
$ flynt --fail-on-change --dry-run -e yt/extern yt/
These will respectively print out any ``flake8`` errors or warnings that your newly added
code triggers, and a list of files that are currenlty not compliant with ``black``. Note
Expand Down Expand Up @@ -781,7 +783,7 @@ If you wish to automate this process you may be interested in using `pre-commit
$ pre-commit install
So that ``black``, ``flake8`` and ``isort`` will run and update your changes every time
So that ``black``, ``flynt`, ``flake8`` and ``isort`` will run and update your changes every time
you commit new code. This setup is not required so you have the option of checking for
code style only in the late stage of a branch when we need to validate it for merging.

Expand Down Expand Up @@ -822,6 +824,9 @@ Source code style guide
return value of a function, do not store it in a variable.
* Add tests for new functionality. When fixing a bug, consider adding a test to
prevent the bug from recurring.
* Use f-strings for string-formatting (https://www.python.org/dev/peps/pep-0498/), except
in logging function where the recommended syntax is
``mylog.info("Something %s", "value")``.

API Style Guide
---------------
Expand Down
Loading

0 comments on commit 9b79f01

Please sign in to comment.