-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
33 changed files
with
1,405 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
name: CI | ||
on: | ||
push: | ||
branches: | ||
- "main" | ||
pull_request: | ||
branches: | ||
- "*" | ||
schedule: | ||
- cron: "0 0 * * *" # Daily “At 00:00” | ||
workflow_dispatch: # allows you to trigger manually | ||
|
||
jobs: | ||
build: | ||
name: Build (${{ matrix.python-version }}, ${{ matrix.os }}) | ||
runs-on: ${{ matrix.os }} | ||
defaults: | ||
run: | ||
shell: bash -l {0} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: ["ubuntu-latest"] | ||
python-version: ["3.7", "3.8", "3.9"] | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 # Fetch all history for all branches and tags. | ||
- name: Set environment variables | ||
run: | | ||
if [[ ${{ matrix.os }} == windows* ]] ; | ||
then | ||
echo "CONDA_ENV_FILE=ci/environment-windows.yml" >> $GITHUB_ENV | ||
else | ||
echo "CONDA_ENV_FILE=ci/environment.yml" >> $GITHUB_ENV | ||
fi | ||
echo "PYTHON_VERSION=${{ matrix.python-version }}" >> $GITHUB_ENV | ||
- name: Cache conda | ||
uses: actions/cache@v2 | ||
with: | ||
path: ~/conda_pkgs_dir | ||
key: | ||
${{ runner.os }}-conda-py${{ matrix.python-version }}-${{ | ||
hashFiles('ci/requirements/**.yml') }} | ||
- uses: conda-incubator/setup-miniconda@v2 | ||
with: | ||
channels: conda-forge | ||
channel-priority: strict | ||
mamba-version: "*" | ||
activate-environment: sandbox-devel | ||
auto-update-conda: false | ||
python-version: ${{ matrix.python-version }} | ||
use-only-tar-bz2: true | ||
|
||
- name: Install conda dependencies | ||
run: | | ||
mamba env update -f $CONDA_ENV_FILE | ||
- name: Set up conda environment | ||
shell: bash -l {0} | ||
run: | | ||
python -m pip install -e . | ||
conda list | ||
- name: Run Tests | ||
shell: bash -l {0} | ||
run: | | ||
pytest --cov=./ --cov-report=xml | ||
- name: Upload code coverage to Codecov | ||
uses: codecov/codecov-action@v1 | ||
with: | ||
file: ./coverage.xml | ||
flags: unittests | ||
env_vars: RUNNER_OS,PYTHON_VERSION | ||
name: codecov-umbrella | ||
fail_ci_if_error: false | ||
|
||
docs-build: | ||
name: Documentation build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- name: set up Python 3.8 | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.8 | ||
|
||
- name: Install package | ||
run: | | ||
python -m pip install --upgrade pip | ||
python -m pip install -e . | ||
- name: Install documentation dependencies | ||
run: | | ||
python -m pip install -r docs/requirements-docs.txt | ||
- name: Build docs | ||
run: | | ||
cd docs | ||
make html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
name: code-style | ||
|
||
on: | ||
push: | ||
branches: 'main' | ||
pull_request: | ||
branches: '*' | ||
|
||
jobs: | ||
linting: | ||
name: "pre-commit hooks" | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-python@v2 | ||
- uses: pre-commit/[email protected] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
name: Upload Package to PyPI | ||
|
||
on: | ||
release: | ||
types: [created] | ||
|
||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: '3.x' | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install setuptools setuptools-scm wheel twine | ||
- name: Build and publish | ||
env: | ||
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} | ||
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} | ||
run: | | ||
python setup.py sdist bdist_wheel | ||
twine upload dist/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
repos: | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v3.2.0 | ||
hooks: | ||
- id: trailing-whitespace | ||
- id: end-of-file-fixer | ||
- id: check-docstring-first | ||
- id: check-json | ||
- id: check-yaml | ||
- id: double-quote-string-fixer | ||
|
||
- repo: https://github.com/ambv/black | ||
rev: 20.8b1 | ||
hooks: | ||
- id: black | ||
|
||
- repo: https://github.com/keewis/blackdoc | ||
rev: v0.1.1 | ||
hooks: | ||
- id: blackdoc | ||
|
||
- repo: https://gitlab.com/pycqa/flake8 | ||
rev: 3.8.3 | ||
hooks: | ||
- id: flake8 | ||
|
||
- repo: https://github.com/asottile/seed-isort-config | ||
rev: v2.2.0 | ||
hooks: | ||
- id: seed-isort-config | ||
- repo: https://github.com/pre-commit/mirrors-isort | ||
rev: v5.4.2 | ||
hooks: | ||
- id: isort | ||
|
||
- repo: https://github.com/prettier/prettier | ||
rev: 2.1.1 | ||
hooks: | ||
- id: prettier | ||
|
||
- repo: https://github.com/deathbeds/prenotebook | ||
rev: f5bdb72a400f1a56fe88109936c83aa12cc349fa | ||
hooks: | ||
- id: prenotebook | ||
args: | ||
[ | ||
'--keep-output', | ||
'--keep-metadata', | ||
'--keep-execution-count', | ||
'--keep-empty', | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
tabWidth = 2 | ||
semi = false | ||
singleQuote = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,151 @@ | ||
============================================= | ||
Contributing to cmweather | ||
============================================= | ||
|
||
Contributions are highly welcomed and appreciated. Every little help counts, | ||
so do not hesitate! | ||
|
||
The following sections cover some general guidelines | ||
regarding development in cmweather for maintainers and contributors. | ||
Nothing here is set in stone and can't be changed. | ||
Feel free to suggest improvements or changes in the workflow. | ||
|
||
|
||
|
||
.. contents:: Contribution links | ||
:depth: 2 | ||
|
||
|
||
|
||
.. _submitfeedback: | ||
|
||
Feature requests and feedback | ||
----------------------------- | ||
|
||
Do you like cmweather? Share some love on Twitter or in your blog posts! | ||
|
||
We'd also like to hear about your propositions and suggestions. Feel free to | ||
`submit them as issues <https://github.com/openradar/cmweather>`_ and: | ||
|
||
* Explain in detail how they should work. | ||
* Keep the scope as narrow as possible. This will make it easier to implement. | ||
|
||
|
||
.. _reportbugs: | ||
|
||
Report bugs | ||
----------- | ||
|
||
Report bugs for cmweather in the `issue tracker <https://github.com/openradar/cmweather>`_. | ||
|
||
If you are reporting a bug, please include: | ||
|
||
* Your operating system name and version. | ||
* Any details about your local setup that might be helpful in troubleshooting, | ||
specifically the Python interpreter version, installed libraries, and cmweather | ||
version. | ||
* Detailed steps to reproduce the bug. | ||
|
||
If you can write a demonstration test that currently fails but should pass | ||
(xfail), that is a very useful commit to make as well, even if you cannot | ||
fix the bug itself. | ||
|
||
|
||
.. _fixbugs: | ||
|
||
Fix bugs | ||
-------- | ||
|
||
Look through the `GitHub issues for bugs <https://github.com/openradar/cmweather/labels/type:%20bug>`_. | ||
|
||
Talk to developers to find out how you can fix specific bugs. | ||
|
||
|
||
Write documentation | ||
------------------- | ||
|
||
cmweather could always use more documentation. What exactly is needed? | ||
|
||
* More complementary documentation. Have you perhaps found something unclear? | ||
* Docstrings. There can never be too many of them. | ||
* Blog posts, articles and such -- they're all very appreciated. | ||
|
||
You can also edit documentation files directly in the GitHub web interface, | ||
without using a local copy. This can be convenient for small fixes. | ||
|
||
.. note:: | ||
Build the documentation locally with the following command: | ||
|
||
.. code:: bash | ||
$ conda env update -f ci/environment.yml | ||
$ cd docs | ||
$ make html | ||
The built documentation should be available in the ``docs/_build/``. | ||
|
||
|
||
.. _`pull requests`: | ||
.. _pull-requests: | ||
|
||
Preparing Pull Requests | ||
----------------------- | ||
|
||
|
||
#. Fork the | ||
`cmweather GitHub repository <https://github.com/openradar/cmweather>`__. It's | ||
fine to use ``cmweather`` as your fork repository name because it will live | ||
under your user. | ||
|
||
#. Clone your fork locally using `git <https://git-scm.com/>`_ and create a branch:: | ||
|
||
$ git clone [email protected]:YOUR_GITHUB_USERNAME/cmweather.git | ||
$ cd cmweather | ||
# now, to fix a bug or add feature create your own branch off "master": | ||
|
||
$ git checkout -b your-bugfix-feature-branch-name master | ||
|
||
|
||
|
||
#. Install `pre-commit <https://pre-commit.com>`_ and its hook on the cmweather repo:: | ||
|
||
$ pip install --user pre-commit | ||
$ pre-commit install | ||
|
||
Afterwards ``pre-commit`` will run whenever you commit. | ||
|
||
https://pre-commit.com/ is a framework for managing and maintaining multi-language pre-commit hooks | ||
to ensure code-style and code formatting is consistent. | ||
|
||
#. Install dependencies into a new conda environment:: | ||
|
||
$ conda env update -f ci/environment.yml | ||
|
||
|
||
#. Run all the tests | ||
|
||
Now running tests is as simple as issuing this command:: | ||
|
||
$ conda activate sandbox-devel | ||
$ pytest --junitxml=test-reports/junit.xml --cov=./ --verbose | ||
|
||
|
||
This command will run tests via the "pytest" tool against the latest Python version. | ||
|
||
#. You can now edit your local working copy and run the tests again as necessary. Please follow PEP-8 for naming. | ||
|
||
When committing, ``pre-commit`` will re-format the files if necessary. | ||
|
||
#. Commit and push once your tests pass and you are happy with your change(s):: | ||
|
||
$ git commit -a -m "<commit message>" | ||
$ git push -u | ||
|
||
|
||
#. Finally, submit a pull request through the GitHub website using this data:: | ||
|
||
head-fork: YOUR_GITHUB_USERNAME/cmweather | ||
compare: your-branch-name | ||
|
||
base-fork: openradar/cmweather | ||
base: master |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
include LICENSE | ||
include README.rst | ||
|
||
recursive-include cmweather *.py | ||
recursive-exclude * __pycache__ | ||
recursive-exclude * *.py[co] |
Oops, something went wrong.