From 2a54b25ac18e845d09882c07835d1f8ce55c130a Mon Sep 17 00:00:00 2001 From: Zeitsperre <10819524+Zeitsperre@users.noreply.github.com> Date: Fri, 2 Jun 2023 14:35:20 -0400 Subject: [PATCH 01/26] update workflow actions --- .github/workflows/bump-version.yml | 17 ++++++----------- .github/workflows/gh-pages.yml | 20 ++++++++++---------- 2 files changed, 16 insertions(+), 21 deletions(-) diff --git a/.github/workflows/bump-version.yml b/.github/workflows/bump-version.yml index a3814f31..d582c33f 100644 --- a/.github/workflows/bump-version.yml +++ b/.github/workflows/bump-version.yml @@ -9,21 +9,18 @@ on: - .editorconfig - .github/**.yml - .gitignore - - .gitlab-ci.yml - - .gitmodules - .pre-commit-config.yaml - .yamllint.yaml - AUTHORS.rst + - CHANGES.rst - CONTRIBUTING.rst - - docs/notebooks + - MANIFEST.in + - Makefile - docs/*.py - docs/*.rst - - environment-dev.yml + - docs/notebooks - environment.yml - - CHANGES.rst - - Makefile - - MANIFEST.in - - requirements_upstream.txt + - requirements_dev.txt - setup.cfg - setup.py - tests/**.py @@ -35,8 +32,6 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - with: - persist-credentials: false - uses: actions/setup-python@v4 with: python-version: "3.x" @@ -57,4 +52,4 @@ jobs: with: force: false github_token: ${{ secrets.GITHUB_TOKEN }} - branch: ${{ github.ref }} \ No newline at end of file + branch: ${{ github.ref }} diff --git a/.github/workflows/gh-pages.yml b/.github/workflows/gh-pages.yml index 4e78f917..18b24a5c 100644 --- a/.github/workflows/gh-pages.yml +++ b/.github/workflows/gh-pages.yml @@ -1,4 +1,5 @@ -name: Docs +name: Deploy Documentation + on: push: branches: @@ -6,23 +7,22 @@ on: pull_request: branches: - master + permissions: contents: write + jobs: build-and-deploy: runs-on: ubuntu-latest steps: - name: Checkout πŸ›ŽοΈ - uses: actions/checkout@v2.3.1 # If you're using actions/checkout@v2 you must set persist-credentials to false in most cases for the deployment to work correctly. + uses: actions/checkout@v3 + - uses: conda-incubator/setup-miniconda@v1 with: - persist-credentials: false - - uses: conda-incubator/setup-miniconda@v2 - with: - activate-environment: xhydro environment-file: environment.yml - mamba-version: "*" - python-version: "3.10" - auto-activate-base: false + cache-environment: true + create-args: >- + python=3.10 - name: Deploy docs shell: bash -l {0} run: | @@ -33,4 +33,4 @@ jobs: uses: JamesIves/github-pages-deploy-action@v4.2.2 with: branch: gh-pages # The branch the action should deploy to. - folder: docs/_build/html # The folder the action should deploy. \ No newline at end of file + folder: docs/_build/html # The folder the action should deploy. From 9fa3824252054af16f5d62c05b5909079d58f7fb Mon Sep 17 00:00:00 2001 From: Zeitsperre <10819524+Zeitsperre@users.noreply.github.com> Date: Fri, 2 Jun 2023 14:35:35 -0400 Subject: [PATCH 02/26] sync dependencies --- environment.yml | 39 +++++++++++++++++++++++---------------- setup.py | 9 ++++----- 2 files changed, 27 insertions(+), 21 deletions(-) diff --git a/environment.yml b/environment.yml index 201fd0d7..fa7bde7e 100644 --- a/environment.yml +++ b/environment.yml @@ -2,27 +2,34 @@ name: xhydro channels: - conda-forge dependencies: - - python=3.10 + - python >=3.10,<3.11 - IPyKernel - - xarray - - dask - - netCDF4 - - bottleneck - - s3fs - - zarr + - bottleneck >=1.3.1 - cartopy - - geoviews - - rioxarray - - matplotlib - - intake + - cftime >=1.4.1 + - cf-xarray >=0.6.1 + - dask >=2.6 + - furo - geopandas + - geoviews + - h5netcdf - hvplot - - intake-xarray=0.6.1 + - intake - intake-geopandas + - intake-xarray >=0.6.1 + - jsonpickly + - matplotlib-base - nbsphinx - - sphinx - - xclim + - netCDF4 + - numba + - numpy >=1.16.0 - pymannkendall + - rioxarray + - s3fs >=2022.7.0 + - scipy >=1.2 + - sphinx + - xarray >=0.17.0 + - xclim >=0.43.0 + - zarr >=2.11.1 - pip: - - sphinx-pangeo-theme - - furo \ No newline at end of file + - sphinx-pangeo-theme # is this needed? Looks like the furo theme is being used. diff --git a/setup.py b/setup.py index a91f7988..035e9bc0 100644 --- a/setup.py +++ b/setup.py @@ -13,7 +13,6 @@ requirements = [ "bottleneck>=1.3.1", "cartopy", - "cftime", "cf-xarray>=0.6.1", "cftime>=1.4.1", "dask[array]>=2.6", @@ -22,16 +21,16 @@ "intake-xarray>=0.6.1", "jsonpickle", "numba", - "numpy>=1.16", + "numpy>=1.16.0", "pandas>=0.23", "pint>=0.10", "pyarrow", "pyyaml", "s3fs>=2022.7.0", "scipy>=1.2", - "xarray>=0.17", - "xclim>=0.37", - "zarr>=2.11.1" + "xarray>=0.17.0", + "xclim>=0.43.0", + "zarr>=2.11.1" ] test_requirements = ['pytest>=3', ] From ca2d3d37d375fc319952a24f2bdeb3210808f7b5 Mon Sep 17 00:00:00 2001 From: Zeitsperre <10819524+Zeitsperre@users.noreply.github.com> Date: Fri, 2 Jun 2023 15:01:54 -0400 Subject: [PATCH 03/26] typo fix --- environment.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/environment.yml b/environment.yml index fa7bde7e..e50a680a 100644 --- a/environment.yml +++ b/environment.yml @@ -17,7 +17,7 @@ dependencies: - intake - intake-geopandas - intake-xarray >=0.6.1 - - jsonpickly + - jsonpickle - matplotlib-base - nbsphinx - netCDF4 From 602cde494a9f238625dbe82d40223c81639a6382 Mon Sep 17 00:00:00 2001 From: Zeitsperre <10819524+Zeitsperre@users.noreply.github.com> Date: Fri, 2 Jun 2023 15:09:16 -0400 Subject: [PATCH 04/26] use correct GitHub Action --- .github/workflows/gh-pages.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/gh-pages.yml b/.github/workflows/gh-pages.yml index 18b24a5c..257de2ab 100644 --- a/.github/workflows/gh-pages.yml +++ b/.github/workflows/gh-pages.yml @@ -17,7 +17,7 @@ jobs: steps: - name: Checkout πŸ›ŽοΈ uses: actions/checkout@v3 - - uses: conda-incubator/setup-miniconda@v1 + - uses: mamba-org/setup-micromamba@v1 with: environment-file: environment.yml cache-environment: true From fb6bbcb84989d920ef4d4d9e1ce43b7bc5f0dc55 Mon Sep 17 00:00:00 2001 From: Zeitsperre <10819524+Zeitsperre@users.noreply.github.com> Date: Fri, 2 Jun 2023 15:13:27 -0400 Subject: [PATCH 05/26] cf_xarray on conda-forge, add pip to mute warning --- environment.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/environment.yml b/environment.yml index e50a680a..0714086b 100644 --- a/environment.yml +++ b/environment.yml @@ -7,7 +7,7 @@ dependencies: - bottleneck >=1.3.1 - cartopy - cftime >=1.4.1 - - cf-xarray >=0.6.1 + - cf_xarray >=0.6.1 - dask >=2.6 - furo - geopandas @@ -31,5 +31,6 @@ dependencies: - xarray >=0.17.0 - xclim >=0.43.0 - zarr >=2.11.1 + - pip - pip: - sphinx-pangeo-theme # is this needed? Looks like the furo theme is being used. From 3060df586111ec6311be5544f94f6303cb7d8453 Mon Sep 17 00:00:00 2001 From: Zeitsperre <10819524+Zeitsperre@users.noreply.github.com> Date: Fri, 2 Jun 2023 15:19:40 -0400 Subject: [PATCH 06/26] drop minor and patch version to grab latest v4 --- .github/workflows/gh-pages.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/gh-pages.yml b/.github/workflows/gh-pages.yml index 257de2ab..b0836572 100644 --- a/.github/workflows/gh-pages.yml +++ b/.github/workflows/gh-pages.yml @@ -30,7 +30,7 @@ jobs: pip install -e . make -C docs html - name: Deploy πŸš€ - uses: JamesIves/github-pages-deploy-action@v4.2.2 + uses: JamesIves/github-pages-deploy-action@v4 with: branch: gh-pages # The branch the action should deploy to. folder: docs/_build/html # The folder the action should deploy. From 2fb3d01e4a9bad3c2e902e7096b18677a2f7eeff Mon Sep 17 00:00:00 2001 From: Zeitsperre <10819524+Zeitsperre@users.noreply.github.com> Date: Fri, 9 Jun 2023 16:39:46 -0400 Subject: [PATCH 07/26] template xhydro boilerplate with latest cookicutter template from ouranosinc/cookiecutter-pypackage, generate with cruft for version control --- .coveralls.yml | 2 + .cruft.json | 28 +++++ .editorconfig | 3 + .../0001-GENERIC-ISSUE-TEMPLATE.yml | 34 ++++++ .github/ISSUE_TEMPLATE/0002-BUG-REPORT.yml | 44 +++++++ .../ISSUE_TEMPLATE/0003-FEATURE-REQUEST.yml | 31 +++++ .../ISSUE_TEMPLATE/0004-QUESTION-SUPPORT.yml | 23 ++++ .github/ISSUE_TEMPLATE/config.yml | 1 + .github/workflows/first_pull_request.yml | 46 ++++++++ .github/workflows/main.yml | 82 ++++++++++++++ .github/workflows/publish-pypi.yml | 10 +- .github/workflows/tag-testpypi.yml | 12 +- .gitignore | 2 + .pre-commit-config.yaml | 80 +++++++++++++ .readthedocs.yml | 26 +++++ .yamllint.yaml | 8 ++ .zenodo.json | 14 +++ AUTHORS.rst | 7 +- CONTRIBUTING.rst | 107 ++++++++++++++++-- CHANGES.rst => HISTORY.rst | 0 LICENSE | 1 - MANIFEST.in | 13 ++- Makefile | 31 ++--- README.rst | 22 ++-- docs/changes.rst | 1 - docs/conf.py | 32 ++++-- docs/history.rst | 1 + docs/index.rst | 2 +- docs/installation.rst | 4 +- environment-docs.yml | 13 +++ environment.yml | 63 +++++------ requirements_dev.txt | 29 +++-- requirements_docs.txt | 10 ++ setup.cfg | 63 ++++++++++- setup.py | 65 +++++++---- tests/test_xhydro.py | 2 +- tox.ini | 50 +++++--- xhydro/__init__.py | 4 +- 38 files changed, 814 insertions(+), 152 deletions(-) create mode 100644 .coveralls.yml create mode 100644 .cruft.json create mode 100644 .github/ISSUE_TEMPLATE/0001-GENERIC-ISSUE-TEMPLATE.yml create mode 100644 .github/ISSUE_TEMPLATE/0002-BUG-REPORT.yml create mode 100644 .github/ISSUE_TEMPLATE/0003-FEATURE-REQUEST.yml create mode 100644 .github/ISSUE_TEMPLATE/0004-QUESTION-SUPPORT.yml create mode 100644 .github/ISSUE_TEMPLATE/config.yml create mode 100644 .github/workflows/first_pull_request.yml create mode 100644 .github/workflows/main.yml create mode 100644 .pre-commit-config.yaml create mode 100644 .readthedocs.yml create mode 100644 .yamllint.yaml create mode 100644 .zenodo.json rename CHANGES.rst => HISTORY.rst (100%) delete mode 100644 docs/changes.rst mode change 100644 => 100755 docs/conf.py create mode 100644 docs/history.rst create mode 100644 environment-docs.yml create mode 100644 requirements_docs.txt diff --git a/.coveralls.yml b/.coveralls.yml new file mode 100644 index 00000000..4ecf44e5 --- /dev/null +++ b/.coveralls.yml @@ -0,0 +1,2 @@ +service_name: github +# repo_token: YOURTOKENHERE diff --git a/.cruft.json b/.cruft.json new file mode 100644 index 00000000..433b21e6 --- /dev/null +++ b/.cruft.json @@ -0,0 +1,28 @@ +{ + "template": "https://github.com/Ouranosinc/cookiecutter-pypackage", + "commit": "49c15f3ab0a7aff9ccb2019abb117b226444dacb", + "checkout": null, + "context": { + "cookiecutter": { + "full_name": "Thomas-Charles Fortier Filion", + "email": "tcff_hydro@outlook.com", + "github_username": "TC-FF", + "project_name": "xHydro", + "project_slug": "xhydro", + "project_short_description": "Hydrological analysis library built with xarray", + "pypi_username": "TC-FF", + "version": "0.1.3", + "use_pytest": "y", + "use_black": "y", + "use_pypi_deployment_with_travis": "n", + "add_pyup_badge": "n", + "make_docs": "y", + "command_line_interface": "No command-line interface", + "create_author_file": "y", + "open_source_license": "Apache-2.0", + "generated_with_cruft": "y", + "_template": "https://github.com/Ouranosinc/cookiecutter-pypackage" + } + }, + "directory": null +} diff --git a/.editorconfig b/.editorconfig index d4a2c440..70b87258 100644 --- a/.editorconfig +++ b/.editorconfig @@ -10,6 +10,9 @@ insert_final_newline = true charset = utf-8 end_of_line = lf +[*.{yaml,yml}] +indent_size = 2 + [*.bat] indent_style = tab end_of_line = crlf diff --git a/.github/ISSUE_TEMPLATE/0001-GENERIC-ISSUE-TEMPLATE.yml b/.github/ISSUE_TEMPLATE/0001-GENERIC-ISSUE-TEMPLATE.yml new file mode 100644 index 00000000..2b749e12 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/0001-GENERIC-ISSUE-TEMPLATE.yml @@ -0,0 +1,34 @@ +name: Generic issue template +description: For detailing generic/uncategorized issues in xHydro + +body: + - type: textarea + id: generic-issue + attributes: + label: Generic Issue + description: Please fill in the following information fields as needed. + value: | + * xhydro version: + * Python version: + * Operating System: + + ### Description + + + ### What I Did + + ``` + $ pip install foo --bar + ``` + + ### What I Received + + ``` + Traceback (most recent call last): + File "/path/to/file/script.py", line 3326, in run_code + exec(code_obj, self.user_global_ns, self.user_ns) + File "", line 1, in + 1/0 + ZeroDivisionError: division by zero diff --git a/.github/ISSUE_TEMPLATE/0002-BUG-REPORT.yml b/.github/ISSUE_TEMPLATE/0002-BUG-REPORT.yml new file mode 100644 index 00000000..d597b8b6 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/0002-BUG-REPORT.yml @@ -0,0 +1,44 @@ +name: Bug report +description: Help us improve xHydro +labels: [ "bug" ] + +body: + - type: markdown + attributes: + value: | + Thanks for taking the time to fill out this bug report! + - type: textarea + id: setup-information + attributes: + label: Setup Information + description: | + What software versions are you running? Example: + - xhydro version: 0.55.0-gamma + - Python version: 4.2 + - Operating System: Nutmeg Linux 12.34 | macOS 11.0 "Redmond" + value: | + - xhydro version: + - Python version: + - Operating System: + - type: textarea + id: description + attributes: + label: Description + description: Describe what you were trying to get done. Tell us what happened, what went wrong, and what you expected to happen. + - type: textarea + id: steps-to-reproduce + attributes: + label: Steps To Reproduce + description: Paste the command(s) you ran and the output. If there was a crash, please include the traceback below. + - type: textarea + id: additional-context + attributes: + label: Additional context + description: Add any other context about the problem here. + - type: checkboxes + id: submit-pr + attributes: + label: Contribution + description: Do you intend to submit a fix for this bug? (The xHydro developers will help with code compliance) + options: + - label: I would be willing/able to open a Pull Request to address this bug. diff --git a/.github/ISSUE_TEMPLATE/0003-FEATURE-REQUEST.yml b/.github/ISSUE_TEMPLATE/0003-FEATURE-REQUEST.yml new file mode 100644 index 00000000..9b0872df --- /dev/null +++ b/.github/ISSUE_TEMPLATE/0003-FEATURE-REQUEST.yml @@ -0,0 +1,31 @@ +name: Feature request +description: Suggest an idea for xHydro +labels: [ "enhancement" ] + +body: + - type: markdown + attributes: + value: | + Thanks for taking the time to fill out this feature request! + - type: textarea + id: problem + attributes: + label: Addressing a Problem? + description: Is your feature request related to a problem? Please describe it. + - type: textarea + id: potential-solution + attributes: + label: Potential Solution + description: Describe the solution you'd like to see implemented. + - type: textarea + id: additional-context + attributes: + label: Additional context + description: Add any other context about the feature request here. + - type: checkboxes + id: submit-pr + attributes: + label: Contribution + description: Do you intend to submit a fix for this bug? (The xHydro developers will help with code compliance) + options: + - label: I would be willing/able to open a Pull Request to contribute this feature. diff --git a/.github/ISSUE_TEMPLATE/0004-QUESTION-SUPPORT.yml b/.github/ISSUE_TEMPLATE/0004-QUESTION-SUPPORT.yml new file mode 100644 index 00000000..20720c6f --- /dev/null +++ b/.github/ISSUE_TEMPLATE/0004-QUESTION-SUPPORT.yml @@ -0,0 +1,23 @@ +name: Question/Support +description: Ask for help from the developers +labels: [ "support" ] + +body: + - type: textarea + id: setup-information + attributes: + label: Setup Information + description: | + What software versions are you running? Example: + - xhydro version: 0.55.0-gamma + - Python version: 4.2 + - Operating System: Nutmeg Linux 12.34 | macOS 11.0 "Redmond" + value: | + - xhydro version: + - Python version: + - Operating System: + - type: textarea + id: description + attributes: + label: Context + description: Describe what you were trying to get done. Tell us what happened, what went wrong, and what you expected to happen. diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 00000000..0086358d --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1 @@ +blank_issues_enabled: true diff --git a/.github/workflows/first_pull_request.yml b/.github/workflows/first_pull_request.yml new file mode 100644 index 00000000..1a1c4827 --- /dev/null +++ b/.github/workflows/first_pull_request.yml @@ -0,0 +1,46 @@ +name: First Pull Request + +on: + pull_request_target: + types: + - opened + +jobs: + welcome: + name: Welcome + runs-on: ubuntu-latest + steps: + - uses: actions/github-script@v6 + with: + script: | + // Get a list of all issues created by the PR opener + // See: https://octokit.github.io/rest.js/#pagination + const creator = context.payload.sender.login + const opts = github.rest.issues.listForRepo.endpoint.merge({ + ...context.issue, + creator, + state: 'all' + }) + const issues = await github.paginate(opts) + + for (const issue of issues) { + if (issue.number === context.issue.number) { + continue + } + + if (issue.pull_request) { + return // Creator is already a contributor. + } + } + + await github.rest.issues.createComment({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + body: `**Welcome**, new contributor! + + It appears that this is your first Pull Request. To give credit where it's due, we ask that you add your information to the \`AUTHORS.rst\` and \`.zenodo.json\`.: + - [ ] The relevant author information has been added to \`AUTHORS.rst\` and \`.zenodo.json\`. + + Please make sure you've read our [contributing guide](CONTRIBUTING.rst). We look forward to reviewing your Pull Request shortly ✨` + }) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 00000000..fce6f0fc --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,82 @@ +name: xHydro Testing Suite + +on: + push: + branches: + - main + paths-ignore: + - HISTORY.rst + - MANIFEST.in + - README.rst + - setup.cfg + - setup.py + - xhydro/__init__.py + pull_request: + +jobs: + black: + name: Black (Python${{ matrix.python-version }}) + runs-on: ubuntu-latest + strategy: + matrix: + python-version: + - "3.8" + steps: + - name: Cancel previous runs + uses: styfle/cancel-workflow-action@0.11.0 + with: + access_token: ${{ secrets.GITHUB_TOKEN }} + - uses: actions/checkout@v3 + - name: Set up Python${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + - name: Install tox + run: pip install tox + - name: Run linting suite + run: tox -e black + + test: + name: test-${{ matrix.tox-env }} (Python${{ matrix.python-version }}) + needs: black + runs-on: ubuntu-latest + strategy: + matrix: + include: + - tox-env: "py38" + python-version: "3.8" + - tox-env: "py39" + python-version: "3.9" + - tox-env: "py310" + python-version: "3.10" + - tox-env: "py311" + python-version: "3.11" + steps: + - uses: actions/checkout@v3 + - name: Set up Python${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + - name: Install tox + run: pip install tox + - name: Test with tox + run: tox -e ${{ matrix.tox-env }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + COVERALLS_FLAG_NAME: run-${{ matrix.tox-env }} + COVERALLS_PARALLEL: true + COVERALLS_SERVICE_NAME: github + + finish: + needs: + - test + runs-on: ubuntu-latest + container: python:3-slim + steps: + - name: Coveralls Finished + run: | + pip install --upgrade coveralls + coveralls --finish + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + COVERALLS_SERVICE_NAME: github diff --git a/.github/workflows/publish-pypi.yml b/.github/workflows/publish-pypi.yml index b7e54d46..f5dee654 100644 --- a/.github/workflows/publish-pypi.yml +++ b/.github/workflows/publish-pypi.yml @@ -1,4 +1,4 @@ -name: "Publish Python 🐍 distributions πŸ“¦ to PyPI" +name: Publish Python 🐍 distributions πŸ“¦ to PyPI on: release: @@ -16,11 +16,13 @@ jobs: with: python-version: "3.x" - name: Install packaging libraries - run: pip install setuptools wheel + run: | + pip install setuptools wheel - name: Build a binary wheel and a source tarball - run: python setup.py sdist bdist_wheel + run: | + python setup.py sdist bdist_wheel - name: Publish distribution πŸ“¦ to PyPI uses: pypa/gh-action-pypi-publish@release/v1 with: user: __token__ - password: ${{ secrets.PYPI_API_TOKEN }} \ No newline at end of file + password: ${{ secrets.PYPI_API_TOKEN }} diff --git a/.github/workflows/tag-testpypi.yml b/.github/workflows/tag-testpypi.yml index 782f0fda..92877a74 100644 --- a/.github/workflows/tag-testpypi.yml +++ b/.github/workflows/tag-testpypi.yml @@ -1,4 +1,4 @@ -name: "Publish Python 🐍 distributions πŸ“¦ to TestPyPI" +name: Publish Python 🐍 distributions πŸ“¦ to TestPyPI on: push: @@ -16,13 +16,15 @@ jobs: with: python-version: "3.x" - name: Install packaging libraries - run: pip install setuptools wheel + run: | + pip install setuptools wheel - name: Build a binary wheel and a source tarball - run: python setup.py sdist bdist_wheel + run: | + python setup.py sdist bdist_wheel - name: Publish distribution πŸ“¦ to Test PyPI uses: pypa/gh-action-pypi-publish@release/v1 with: user: __token__ - password: ${{ secrets.TEST_PYPI_API_TOKEN }} + password: __TEST_PYPI_API_TOKEN__ repository_url: https://test.pypi.org/legacy/ - skip_existing: true \ No newline at end of file + skip_existing: true diff --git a/.gitignore b/.gitignore index 4c915d14..d1bd55df 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ +# XHYDRO-specific + # Byte-compiled / optimized / DLL files __pycache__/ *.py[cod] diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 00000000..97e5eed1 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,80 @@ +default_language_version: + python: python3 + +repos: + - repo: https://github.com/asottile/pyupgrade + rev: v3.4.0 + hooks: + - id: pyupgrade + args: [--py38-plus] + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.4.0 + hooks: + - id: trailing-whitespace + exclude: setup.cfg + - id: end-of-file-fixer + - id: check-yaml + args: ['--allow-multiple-documents'] + - id: debug-statements + - repo: https://github.com/pre-commit/pygrep-hooks + rev: v1.10.0 + hooks: + - id: rst-inline-touching-normal + - repo: https://github.com/psf/black + rev: 23.3.0 + hooks: + - id: black + exclude: ^docs/ + - repo: https://github.com/pycqa/flake8 + rev: 6.0.0 + hooks: + - id: flake8 + additional_dependencies: [ 'flake8-rst-docstrings' ] + args: ['--config=setup.cfg'] + - repo: https://github.com/psf/black + rev: 23.3.0 + hooks: + - id: black + exclude: ^docs/ + args: [ '--target-version=py38' ] + - repo: https://github.com/PyCQA/isort + rev: 5.12.0 + hooks: + - id: isort + args: ['--settings-file=setup.cfg'] + exclude: ^docs/ + - repo: https://github.com/PyCQA/pydocstyle + rev: 6.3.0 + hooks: + - id: pydocstyle + args: [ '--config=setup.cfg' ] + - repo: https://github.com/keewis/blackdoc + rev: v0.3.8 + hooks: + - id: blackdoc + additional_dependencies: [ 'black==23.3.0' ] + - repo: https://github.com/adrienverge/yamllint.git + rev: v1.32.0 + hooks: + - id: yamllint + args: ['--config-file', '.yamllint.yaml'] + - repo: https://github.com/mgedmin/check-manifest + rev: "0.49" + hooks: + - id: check-manifest + - repo: meta + hooks: + - id: check-hooks-apply + - id: check-useless-excludes + +ci: + autofix_commit_msg: | + [pre-commit.ci] auto fixes from pre-commit.com hooks + + for more information, see https://pre-commit.ci + autofix_prs: true + autoupdate_branch: '' + autoupdate_commit_msg: '[pre-commit.ci] pre-commit autoupdate' + autoupdate_schedule: weekly + skip: [] + submodules: false diff --git a/.readthedocs.yml b/.readthedocs.yml new file mode 100644 index 00000000..e0dc1642 --- /dev/null +++ b/.readthedocs.yml @@ -0,0 +1,26 @@ +# .readthedocs.yml +# Read the Docs configuration file +# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details + +version: 2 + +sphinx: + configuration: docs/conf.py + # fail_on_warning might generate hard to fix error, in this case it can be + # disabled but this also means those errors will fail silently, choose wisely. + fail_on_warning: true + +build: + os: ubuntu-22.04 + tools: + python: "mambaforge-4.10" + +conda: + environment: environment-docs.yml + +python: + install: + - method: pip + path: . + extra_requirements: + - dev diff --git a/.yamllint.yaml b/.yamllint.yaml new file mode 100644 index 00000000..2f3b4a3d --- /dev/null +++ b/.yamllint.yaml @@ -0,0 +1,8 @@ +--- + +rules: + document-start: disable + line-length: + max: 120 + level: warning + truthy: disable diff --git a/.zenodo.json b/.zenodo.json new file mode 100644 index 00000000..19f344c7 --- /dev/null +++ b/.zenodo.json @@ -0,0 +1,14 @@ +{ + "title": "xHydro", + "creators": [ + { + "name": "Filion, Thomas-Charles Fortier" + } + ], + "keywords": [ ], + "license": "Apache-2.0", + "language": "eng", + "communities": [ ], + "upload_type": "software", + "access_right": "open" +} diff --git a/AUTHORS.rst b/AUTHORS.rst index 959720e5..95db7fc5 100644 --- a/AUTHORS.rst +++ b/AUTHORS.rst @@ -5,7 +5,12 @@ Credits Development Lead ---------------- -* Thomas-Charles Fortier Filion +* Thomas-Charles Fortier Filion `@TC-FF `_ + +Co-Developers +------------- + +None yet. Why not be the first? Contributors ------------ diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index 7423e59f..ce3346b3 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -68,22 +68,32 @@ Ready to contribute? Here's how to set up `xhydro` for local development. $ mkvirtualenv xhydro $ cd xhydro/ - $ python setup.py develop + $ pip install -e . -4. Create a branch for local development:: +4. To ensure a consistent style, please install the pre-commit hooks to your repo:: + + $ pre-commit install + + Special style and formatting checks will be run when you commit your changes. You + can always run the hooks on their own with: + + $ pre-commit run -a + +5. Create a branch for local development:: $ git checkout -b name-of-your-bugfix-or-feature Now you can make your changes locally. -5. When you're done making changes, check that your changes pass flake8 and the +6. When you're done making changes, check that your changes pass flake8, black, and the tests, including testing other Python versions with tox:: $ flake8 xhydro tests + $ black --check xhydro tests $ python setup.py test or pytest $ tox - To get flake8 and tox, just pip install them into your virtualenv. + To get flake8, black, and tox, just pip install them into your virtualenv. 6. Commit your changes and push your branch to GitHub:: @@ -91,6 +101,13 @@ Ready to contribute? Here's how to set up `xhydro` for local development. $ git commit -m "Your detailed description of your changes." $ git push origin name-of-your-bugfix-or-feature +7. If you are editing the docs, compile and open them with:: + + $ make docs + # or to simply generate the html + $ cd docs/ + $ make html + 7. Submit a pull request through the GitHub website. Pull Request Guidelines @@ -102,9 +119,7 @@ Before you submit a pull request, check that it meets these guidelines: 2. If the pull request adds functionality, the docs should be updated. Put your new functionality into a function with a docstring, and add the feature to the list in README.rst. -3. The pull request should work for Python 3.5, 3.6, 3.7 and 3.8, and for PyPy. Check - https://travis-ci.com/TC-FF/xhydro/pull_requests - and make sure that the tests pass for all supported Python versions. +3. The pull request should work for Python 3.8, 3.9, 3.10, and 3.11. Check that the tests pass for all supported Python versions. Tips ---- @@ -114,15 +129,85 @@ To run a subset of tests:: $ pytest tests.test_xhydro -Deploying ---------- +Versioning/Tagging +------------------ A reminder for the maintainers on how to deploy. Make sure all your changes are committed (including an entry in HISTORY.rst). Then run:: -$ bump2version patch # possible: major / minor / patch +$ bumpversion patch # possible: major / minor / patch $ git push $ git push --tags -Travis will then deploy to PyPI if tests pass. +Packaging +--------- + +When a new version has been minted (features have been successfully integrated test coverage and stability is adequate), +maintainers should update the pip-installable package (wheel and source release) on PyPI as well as the binary on conda-forge. + +The simple approach +~~~~~~~~~~~~~~~~~~~ + +The simplest approach to packaging for general support (pip wheels) requires the following packages installed: + * build + * setuptools + * twine + * wheel + +From the command line on your Linux distribution, simply run the following from the clone's main dev branch:: + + # To build the packages (sources and wheel) + $ python -m build --sdist --wheel + + # To upload to PyPI + $ twine upload dist/* + +The new version based off of the version checked out will now be available via `pip` (`$ pip install xhydro`). + +Releasing on conda-forge +~~~~~~~~~~~~~~~~~~~~~~~~ + +Initial Release +^^^^^^^^^^^^^^^ + +In order to prepare an initial release on conda-forge, we *strongly* suggest consulting the following links: + * https://conda-forge.org/docs/maintainer/adding_pkgs.html + * https://github.com/conda-forge/staged-recipes + +Before updating the main conda-forge recipe, we echo the conda-forge documentation and *strongly* suggest performing the following checks: + * Ensure that dependencies and dependency versions correspond with those of the tagged version, with open or pinned versions for the `host` requirements. + * If possible, configure tests within the conda-forge build CI (e.g. `imports: xhydro`, `commands: pytest xhydro`) + +Subsequent releases +^^^^^^^^^^^^^^^^^^^ + +If the conda-forge feedstock recipe is built from PyPI, then when a new release is published on PyPI, `regro-cf-autotick-bot` will open Pull Requests automatically on the conda-forge feedstock. +It is up to the conda-forge feedstock maintainers to verify that the package is building properly before merging the Pull Request to the main branch. + +Building sources for wide support with `manylinux` image +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. warning:: + This section is for building source files that link to or provide links to C/C++ dependencies. + It is not necessary to perform the following when building pure Python packages. + +In order to do ensure best compatibility across architectures, we suggest building wheels using the `PyPA`'s `manylinux` +docker images (at time of writing, we endorse using `manylinux_2_24_x86_64`). + +With `docker` installed and running, begin by pulling the image:: + + $ sudo docker pull quay.io/pypa/manylinux_2_24_x86_64 + +From the xhydro source folder we can enter into the docker container, providing access to the `xhydro` source files by linking them to the running image:: + + $ sudo docker run --rm -ti -v $(pwd):/xhydro -w /xhydro quay.io/pypa/manylinux_2_24_x86_64 bash + +Finally, to build the wheel, we run it against the provided Python3.8 binary:: + + $ /opt/python/cp38-cp38m/bin/python setup.py sdist bdist_wheel + +This will then place two files in `xhydro/dist/` ("xhydro-1.2.3-py3-none-any.whl" and "xhydro-1.2.3.tar.gz"). +We can now leave our docker container (`$ exit`) and continue with uploading the files to PyPI:: + + $ twine upload dist/* diff --git a/CHANGES.rst b/HISTORY.rst similarity index 100% rename from CHANGES.rst rename to HISTORY.rst diff --git a/LICENSE b/LICENSE index e2b8b29f..2b3b5ab0 100644 --- a/LICENSE +++ b/LICENSE @@ -13,4 +13,3 @@ distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. - diff --git a/MANIFEST.in b/MANIFEST.in index 965b2dda..988d9721 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -3,9 +3,20 @@ include CONTRIBUTING.rst include HISTORY.rst include LICENSE include README.rst - +include requirements_dev.txt +include requirements_docs.txt +include .zenodo.json recursive-include tests * recursive-exclude * __pycache__ recursive-exclude * *.py[co] recursive-include docs *.rst conf.py Makefile make.bat *.jpg *.png *.gif + +exclude .coveralls.yml +exclude .editorconfig +exclude .pre-commit-config.yaml +exclude .readthedocs.yml +exclude .yamllint.yaml +exclude Makefile +exclude environment-docs.yml +exclude tox.ini diff --git a/Makefile b/Makefile index f7cdb8c1..908dc754 100644 --- a/Makefile +++ b/Makefile @@ -35,6 +35,11 @@ clean-build: ## remove build artifacts find . -name '*.egg-info' -exec rm -fr {} + find . -name '*.egg' -exec rm -f {} + +clean-docs: ## remove docs artifacts + rm -f docs/apidoc/xhydro*.rst + rm -f docs/apidoc/modules.rst + $(MAKE) -C docs clean + clean-pyc: ## remove Python file artifacts find . -name '*.pyc' -exec rm -f {} + find . -name '*.pyo' -exec rm -f {} + @@ -49,10 +54,9 @@ clean-test: ## remove test and coverage artifacts lint/flake8: ## check style with flake8 flake8 xhydro tests -lint/black: ## check style with black - black --check xhydro tests -lint: lint/flake8 lint/black ## check style +lint/black: ## check style with black + black --check xhydro testslint: lint/flake8 lint/black ## check style test: ## run tests quickly with the default Python pytest @@ -65,24 +69,25 @@ coverage: ## check code coverage quickly with the default Python coverage report -m coverage html $(BROWSER) htmlcov/index.html +autodoc: clean-docs ## create sphinx-apidoc files: + sphinx-apidoc -o docs/apidoc --private --module-first xhydro -docs: ## generate Sphinx HTML documentation, including API docs - rm -f docs/xhydro.rst - rm -f docs/modules.rst - sphinx-apidoc -o docs/ xhydro - $(MAKE) -C docs clean +linkcheck: autodoc ## run checks over all external links found throughout the documentation + $(MAKE) -C docs linkcheck + +docs: autodoc ## generate Sphinx HTML documentation, including API docs $(MAKE) -C docs html +ifndef READTHEDOCS $(BROWSER) docs/_build/html/index.html +endif servedocs: docs ## compile the docs watching for changes - watchmedo shell-command -p '*.rst' -c '$(MAKE) -C docs html' -R -D . - -release: dist ## package and upload a release + watchmedo shell-command -p '*.rst' -c '$(MAKE) -C docs html' -R -D .release: dist ## package and upload a release twine upload dist/* dist: clean ## builds source and wheel package - python setup.py sdist - python setup.py bdist_wheel + python -m build --sdist + python -m build --wheel ls -l dist install: clean ## install the package to the active Python's site-packages diff --git a/README.rst b/README.rst index 826f582f..29227872 100644 --- a/README.rst +++ b/README.rst @@ -9,22 +9,16 @@ xHydro .. image:: https://img.shields.io/travis/TC-FF/xhydro.svg :target: https://travis-ci.com/TC-FF/xhydro -.. image:: https://github.com/hydrologie/xhydro/actions/workflows/gh-pages.yml/badge.svg - :target: https://hydrologie.github.io/xhydro/ +.. image:: https://readthedocs.org/projects/xhydro/badge/?version=latest + :target: https://xhydro.readthedocs.io/en/latest/?version=latest :alt: Documentation Status -.. image:: https://pyup.io/repos/github/TC-FF/xhydro/shield.svg - :target: https://pyup.io/repos/github/TC-FF/xhydro/ - :alt: Updates +Hydrological analysis library built with xarray - -Hydrology analysis build with xarray - - -* Free software: Apache Software License 2.0 -* Documentation: https://hydrologie.github.io/xhydro/ +* Free software: Apache-2.0 +* Documentation: https://xhydro.readthedocs.io. Features @@ -35,7 +29,7 @@ Features Credits ------- -This package was created with Cookiecutter_ and the `audreyr/cookiecutter-pypackage`_ project template. +This package was created with Cookiecutter_ and the `Ouranosinc/cookiecutter-pypackage`_ project template. -.. _Cookiecutter: https://github.com/audreyr/cookiecutter -.. _`audreyr/cookiecutter-pypackage`: https://github.com/audreyr/cookiecutter-pypackage +.. _Cookiecutter: https://github.com/audreyfeldroy/cookiecutter-pypackage +.. _`Ouranosinc/cookiecutter-pypackage`: https://github.com/Ouranosinc/cookiecutter-pypackage diff --git a/docs/changes.rst b/docs/changes.rst deleted file mode 100644 index d9e113ec..00000000 --- a/docs/changes.rst +++ /dev/null @@ -1 +0,0 @@ -.. include:: ../CHANGES.rst diff --git a/docs/conf.py b/docs/conf.py old mode 100644 new mode 100755 index 694cf65b..3ffe280e --- a/docs/conf.py +++ b/docs/conf.py @@ -31,7 +31,28 @@ # Add any Sphinx extension module names here, as strings. They can be # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones. -extensions = ['sphinx.ext.autodoc', 'sphinx.ext.viewcode', 'nbsphinx'] +extensions = [ + 'sphinx.ext.autodoc', + 'sphinx.ext.autosectionlabel', + 'sphinx.ext.viewcode' + 'sphinx.ext.todo', + 'sphinx_codeautolink', + 'sphinx_copybutton', + "nbsphinx" +] + +autosectionlabel_prefix_document = True +autosectionlabel_maxdepth = 2 + +# To ensure that underlined fields (e.g. `_field`) are shown in the docs. +autodoc_default_options = { + "members": True, + "undoc-members": True, + "private-members": False, + "special-members": False, +} + +# Generate documentation from Jupyter notebooks. nbsphinx_execute = 'always' # Add any paths that contain templates here, relative to this directory. @@ -41,7 +62,7 @@ # You can specify multiple suffix as a list of string: # # source_suffix = ['.rst', '.md'] -source_suffix = '.rst' +source_suffix = ['.rst'] # The master toctree document. master_doc = 'index' @@ -65,7 +86,7 @@ # # This is also used if you do content translation via gettext catalogs. # Usually you set "language" from the command line for these cases. -language = None +language = "en" # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. @@ -155,9 +176,6 @@ 'xHydro Documentation', author, 'xhydro', - 'Hydrological analysis build with xarray.', + 'Hydrological analysis library built with xarray.', 'Miscellaneous'), ] - - - diff --git a/docs/history.rst b/docs/history.rst new file mode 100644 index 00000000..25064996 --- /dev/null +++ b/docs/history.rst @@ -0,0 +1 @@ +.. include:: ../HISTORY.rst diff --git a/docs/index.rst b/docs/index.rst index 830a706e..4d4f1fb4 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -1,5 +1,5 @@ Welcome to xHydro's documentation! -====================================== +================================== .. toctree:: :maxdepth: 2 diff --git a/docs/installation.rst b/docs/installation.rst index 56a1d0b5..a75c2f9b 100644 --- a/docs/installation.rst +++ b/docs/installation.rst @@ -1,5 +1,3 @@ -.. highlight:: shell - ============ Installation ============ @@ -32,7 +30,7 @@ You can either clone the public repository: .. code-block:: console - $ git clone git://github.com/TC-FF/xhydro + $ git clone git@github.com:TC-FF/xhydro Or download the `tarball`_: diff --git a/environment-docs.yml b/environment-docs.yml new file mode 100644 index 00000000..c9455a95 --- /dev/null +++ b/environment-docs.yml @@ -0,0 +1,13 @@ +name: xhydro +channels: + - conda-forge + - defaults +dependencies: + - sphinx + - pandoc + - sphinx_rtd_theme >=1.0 + - sphinx-autoapi + - sphinx-codeautolink + - sphinx-copybutton + - sphinxcontrib-napoleon- click + - sphinx-click diff --git a/environment.yml b/environment.yml index 0714086b..22c314b9 100644 --- a/environment.yml +++ b/environment.yml @@ -1,36 +1,33 @@ name: xhydro channels: - - conda-forge + - conda-forge dependencies: - - python >=3.10,<3.11 - - IPyKernel - - bottleneck >=1.3.1 - - cartopy - - cftime >=1.4.1 - - cf_xarray >=0.6.1 - - dask >=2.6 - - furo - - geopandas - - geoviews - - h5netcdf - - hvplot - - intake - - intake-geopandas - - intake-xarray >=0.6.1 - - jsonpickle - - matplotlib-base - - nbsphinx - - netCDF4 - - numba - - numpy >=1.16.0 - - pymannkendall - - rioxarray - - s3fs >=2022.7.0 - - scipy >=1.2 - - sphinx - - xarray >=0.17.0 - - xclim >=0.43.0 - - zarr >=2.11.1 - - pip - - pip: - - sphinx-pangeo-theme # is this needed? Looks like the furo theme is being used. + - python >=3.10,<3.11 + - IPyKernel + - bottleneck >=1.3.1 + - cartopy + - cftime >=1.4.1 + - cf_xarray >=0.6.1 + - dask >=2.6 + - furo + - geopandas + - geoviews + - h5netcdf + - hvplot + - intake + - intake-geopandas + - intake-xarray >=0.6.1 + - jsonpickle + - matplotlib-base + - nbsphinx + - netCDF4 + - numba + - numpy >=1.16.0 + - pymannkendall + - rioxarray + - s3fs >=2022.7.0 + - scipy >=1.2 + - sphinx + - xarray >=0.17.0 + - xclim >=0.43.0 + - zarr >=2.11.1 diff --git a/requirements_dev.txt b/requirements_dev.txt index ebb3f1d1..47ac23e0 100644 --- a/requirements_dev.txt +++ b/requirements_dev.txt @@ -1,12 +1,17 @@ -pip==19.2.3 -bump2version==0.5.11 -wheel==0.33.6 -watchdog==0.9.0 -flake8==3.7.8 -tox==3.14.0 -coverage==4.5.4 -Sphinx==1.8.5 -twine==1.14.0 - -pytest==6.2.4 -black==21.7b0 +pip==23.1.2 +bump2version==1.0.1 +wheel==0.40.0 +build==0.10.0 +watchdog==3.0.0 +flake8==6.0.0 +tox==4.5.1 +coverage==7.2.5 +coveralls==3.3.1 +sphinx==7.0.1 +twine==4.0.2 +Click==8.1.3 +pytest==7.3.1 +pytest-cov==4.0.0 +black==23.3.0 +isort==5.12.0 +pre-commit==3.3.2 diff --git a/requirements_docs.txt b/requirements_docs.txt new file mode 100644 index 00000000..d425dc90 --- /dev/null +++ b/requirements_docs.txt @@ -0,0 +1,10 @@ +sphinx +sphinx-click +sphinx-codeautolink +sphinx-copybutton +sphinx-rtd-theme>=1.0 +nbsphinx +pandoc +ipython +ipykernel +jupyter_client diff --git a/setup.cfg b/setup.cfg index 852c3ce3..18343f1c 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 0.1.2 +current_version = 0.1.3 commit = True tag = True @@ -11,11 +11,64 @@ replace = version='{new_version}' search = __version__ = '{current_version}' replace = __version__ = '{new_version}' -[bdist_wheel] -universal = 1 +[bumpversion:file:.cruft.json] +search = "version": "{current_version}", +replace = "version": "{new_version}", -[flake8] -exclude = docs +[aliases] +# Define setup.py command aliases here +test = pytest [tool:pytest] collect_ignore = ['setup.py'] +addopts = + --verbose +filterwarnings = + ignore::UserWarning + +[flake8] +exclude = + .git, + docs, + build, + .eggs, + docs/conf.py, +max-line-length = 88 +max-complexity = 12 +ignore = + C901 + E203 + E231 + E266 + E501 + F401 + F403 + W503 + W504 +per-file-ignores = + tests/*:E402 +rst-roles = + mod, + py:attr, + py:attribute, + py:class, + py:const, + py:data, + py:func, + py:meth, + py:mod, + py:obj, + py:ref, + ref + +[coverage:run] +relative_files = True +omit = */tests/*.py + +[isort] +profile = black +py_version = 38 + +[pydocstyle] +convention = numpy +match = ((?!test_|conf).)*\.py diff --git a/setup.py b/setup.py index 035e9bc0..f06f4e4b 100644 --- a/setup.py +++ b/setup.py @@ -2,12 +2,12 @@ """The setup script.""" -from setuptools import setup, find_packages +from setuptools import find_packages, setup -with open('README.rst') as readme_file: +with open("README.rst") as readme_file: readme = readme_file.read() -with open('CHANGES.rst') as history_file: +with open("HISTORY.rst") as history_file: history = history_file.read() requirements = [ @@ -33,33 +33,52 @@ "zarr>=2.11.1" ] -test_requirements = ['pytest>=3', ] +test_requirements = ["pytest>=3"] + +docs_requirements = [ + dependency for dependency in open("requirements_docs.txt").readlines() +] + +dev_requirements = [ + dependency for dependency in open("requirements_dev.txt").readlines() +] setup( author="Thomas-Charles Fortier Filion", - author_email='tcff_hydro@outlook.com', - python_requires='>=3.8', + author_email="tcff_hydro@outlook.com", + python_requires=">=3.8", classifiers=[ - 'Development Status :: 2 - Pre-Alpha', - 'Intended Audience :: Developers', - 'License :: OSI Approved :: Apache Software License', - 'Natural Language :: English', - 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.8', - 'Programming Language :: Python :: 3.9', - 'Programming Language :: Python :: 3.10', + "Development Status :: 2 - Pre-Alpha", + "Intended Audience :: Developers", + "License :: OSI Approved :: Apache Software License", + "Natural Language :: English", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", ], - description="Hydrology analysis build with xarray", + description="Hydrological analysis library built with xarray", + entry_points={ + "console_scripts": [ + "xhydro=xhydro.cli:main", + ], + }, install_requires=requirements, - license="Apache Software License 2.0", - long_description=readme + '\n\n' + history, + license="Apache-2.0", + long_description=readme + "\n\n" + history, + long_description_content_type="text/x-rst", include_package_data=True, - keywords='xhydro', - name='xhydro', - packages=find_packages(include=['xhydro', 'xhydro.*']), - test_suite='tests', + keywords="xhydro", + name="xhydro", + packages=find_packages(include=["xhydro", "xhydro.*"]), + test_suite="tests", tests_require=test_requirements, - url='https://github.com/TC-FF/xhydro', - version='0.1.2', + extras_require={ + "docs": docs_requirements, + "dev": dev_requirements, + }, + url="https://github.com/TC-FF/xhydro", + version="0.1.3", zip_safe=False, ) diff --git a/tests/test_xhydro.py b/tests/test_xhydro.py index 13b8e0b3..8925451b 100644 --- a/tests/test_xhydro.py +++ b/tests/test_xhydro.py @@ -12,7 +12,7 @@ def response(): """Sample pytest fixture. - See more at: http://doc.pytest.org/en/latest/fixture.html + See more at: https://doc.pytest.org/en/latest/explanation/fixtures.html """ # import requests # return requests.get('https://github.com/audreyr/cookiecutter-pypackage') diff --git a/tox.ini b/tox.ini index 8c26ace4..876dd7b0 100644 --- a/tox.ini +++ b/tox.ini @@ -1,26 +1,48 @@ [tox] -envlist = py36, py37, py38, flake8 +min_version = 4.0 +envlist = + black + py{38,39,310,311} + docs + coveralls +requires = + pip >= 21.0 +opts = + --verbose -[travis] -python = - 3.8: py38 - 3.7: py37 - 3.6: py36 +[testenv:black] +skip_install = True +deps = + flake8 + black +commands = + make lint +allowlist_externals = + make -[testenv:flake8] -basepython = python -deps = flake8 -commands = flake8 xhydro tests +[testenv:docs] +extras = + docs +commands = + make --directory=docs clean html +allowlist_externals = + make [testenv] setenv = + PYTEST_ADDOPTS = "--color=yes" PYTHONPATH = {toxinidir} +passenv = + GITHUB_* +extras = + dev +download = True +install_command = python -m pip install --no-user {opts} {packages} deps = - -r{toxinidir}/requirements_dev.txt ; If you want to make tox run the tests with the same versions, create a ; requirements.txt with the pinned versions and uncomment the following line: ; -r{toxinidir}/requirements.txt commands = - pip install -U pip - pytest --basetemp={envtmpdir} - + pytest --cov xhydro + # Coveralls requires access to a repo token set in .coveralls.yml in order to report stats + coveralls: - coveralls diff --git a/xhydro/__init__.py b/xhydro/__init__.py index 7b023a7c..f72c0783 100644 --- a/xhydro/__init__.py +++ b/xhydro/__init__.py @@ -1,5 +1,5 @@ """Top-level package for xHydro.""" __author__ = """Thomas-Charles Fortier Filion""" -__email__ = 'tcff_hydro@outlook.com' -__version__ = '0.1.2' +__email__ = "tcff_hydro@outlook.com" +__version__ = "0.1.3" From e304074960fe1015970c230db0cabf01d41ea3e7 Mon Sep 17 00:00:00 2001 From: Zeitsperre <10819524+Zeitsperre@users.noreply.github.com> Date: Fri, 9 Jun 2023 16:44:18 -0400 Subject: [PATCH 08/26] black/isort changes, update MANIFEST.in --- MANIFEST.in | 6 ++++-- setup.py | 4 ++-- tests/test_xhydro.py | 1 - 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/MANIFEST.in b/MANIFEST.in index 988d9721..ac2d2ed7 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -7,16 +7,18 @@ include requirements_dev.txt include requirements_docs.txt include .zenodo.json recursive-include tests * -recursive-exclude * __pycache__ -recursive-exclude * *.py[co] recursive-include docs *.rst conf.py Makefile make.bat *.jpg *.png *.gif +recursive-exclude * __pycache__ +recursive-exclude * *.py[co] exclude .coveralls.yml +exclude .cruft.json exclude .editorconfig exclude .pre-commit-config.yaml exclude .readthedocs.yml exclude .yamllint.yaml exclude Makefile +exclude environment.yml exclude environment-docs.yml exclude tox.ini diff --git a/setup.py b/setup.py index f06f4e4b..efcdc38f 100644 --- a/setup.py +++ b/setup.py @@ -30,8 +30,8 @@ "scipy>=1.2", "xarray>=0.17.0", "xclim>=0.43.0", - "zarr>=2.11.1" - ] + "zarr>=2.11.1", +] test_requirements = ["pytest>=3"] diff --git a/tests/test_xhydro.py b/tests/test_xhydro.py index 8925451b..3b94523f 100644 --- a/tests/test_xhydro.py +++ b/tests/test_xhydro.py @@ -4,7 +4,6 @@ import pytest - from xhydro import xhydro From 7fb8083edbf5db493f443b253121c0ca0a08773a Mon Sep 17 00:00:00 2001 From: Zeitsperre <10819524+Zeitsperre@users.noreply.github.com> Date: Fri, 9 Jun 2023 17:00:20 -0400 Subject: [PATCH 09/26] relax dev requirement freeze, fix a few autogenerated errors --- environment-docs.yml | 3 +-- requirements_dev.txt | 34 +++++++++++++++++----------------- tox.ini | 3 ++- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/environment-docs.yml b/environment-docs.yml index c9455a95..dc042a98 100644 --- a/environment-docs.yml +++ b/environment-docs.yml @@ -9,5 +9,4 @@ dependencies: - sphinx-autoapi - sphinx-codeautolink - sphinx-copybutton - - sphinxcontrib-napoleon- click - - sphinx-click + - sphinxcontrib-napoleon diff --git a/requirements_dev.txt b/requirements_dev.txt index 47ac23e0..71d54aa8 100644 --- a/requirements_dev.txt +++ b/requirements_dev.txt @@ -1,17 +1,17 @@ -pip==23.1.2 -bump2version==1.0.1 -wheel==0.40.0 -build==0.10.0 -watchdog==3.0.0 -flake8==6.0.0 -tox==4.5.1 -coverage==7.2.5 -coveralls==3.3.1 -sphinx==7.0.1 -twine==4.0.2 -Click==8.1.3 -pytest==7.3.1 -pytest-cov==4.0.0 -black==23.3.0 -isort==5.12.0 -pre-commit==3.3.2 +Click +black>=23.3.0 +build +bump2version +coverage +coveralls +flake8 +isort>=5.12.0 +pip +pre-commit +pytest +pytest-cov +sphinx +tox +twine +watchdog +wheel diff --git a/tox.ini b/tox.ini index 876dd7b0..03f8fb3d 100644 --- a/tox.ini +++ b/tox.ini @@ -16,7 +16,8 @@ deps = flake8 black commands = - make lint + make lint/black + make lint/flake8 allowlist_externals = make From 18bc2134ab3e26329433986194b570f815e2f72e Mon Sep 17 00:00:00 2001 From: Zeitsperre <10819524+Zeitsperre@users.noreply.github.com> Date: Fri, 9 Jun 2023 17:03:42 -0400 Subject: [PATCH 10/26] update setup.cfg bumpversion for black formatting, add a test for metadata --- setup.cfg | 12 ++++++++---- tests/test_xhydro.py | 14 ++++++++++++++ 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/setup.cfg b/setup.cfg index 18343f1c..275350c8 100644 --- a/setup.cfg +++ b/setup.cfg @@ -4,12 +4,16 @@ commit = True tag = True [bumpversion:file:setup.py] -search = version='{current_version}' -replace = version='{new_version}' +search = version="{current_version}" +replace = version="{new_version}" [bumpversion:file:xhydro/__init__.py] -search = __version__ = '{current_version}' -replace = __version__ = '{new_version}' +search = __version__ = "{current_version}" +replace = __version__ = "{new_version}" + +[bumpversion:file:tests/test_xhydro.py] +search = __version__ = "{current_version}" +replace = __version__ = "{new_version}" [bumpversion:file:.cruft.json] search = "version": "{current_version}", diff --git a/tests/test_xhydro.py b/tests/test_xhydro.py index 3b94523f..3f54947a 100644 --- a/tests/test_xhydro.py +++ b/tests/test_xhydro.py @@ -2,6 +2,8 @@ """Tests for `xhydro` package.""" +from pathlib import Path + import pytest from xhydro import xhydro @@ -15,9 +17,21 @@ def response(): """ # import requests # return requests.get('https://github.com/audreyr/cookiecutter-pypackage') + pass def test_content(response): """Sample pytest test function with the pytest fixture as an argument.""" # from bs4 import BeautifulSoup # assert 'GitHub' in BeautifulSoup(response.content).title.string + pass + + +def test_imports(): + metadata = Path(xhydro.__file__).resolve().parent.joinpath("__init__.py") + + with open(metadata) as f: + contents = f.read() + assert '__author__ = """Thomas-Charles Fortier Filion"""' in contents + assert '__email__ = "tcff_hydro@outlook.com"' in contents + assert '__version__ = "0.1.3"' in contents From edc82e36832edf0dded2f84699f9229b8b2cd71e Mon Sep 17 00:00:00 2001 From: Zeitsperre <10819524+Zeitsperre@users.noreply.github.com> Date: Fri, 9 Jun 2023 17:05:58 -0400 Subject: [PATCH 11/26] fix an error from jinja template in Makefile --- Makefile | 4 +++- tox.ini | 3 +-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 908dc754..bd8c99d9 100644 --- a/Makefile +++ b/Makefile @@ -56,7 +56,9 @@ lint/flake8: ## check style with flake8 flake8 xhydro tests lint/black: ## check style with black - black --check xhydro testslint: lint/flake8 lint/black ## check style + black --check xhydro tests + +lint: lint/flake8 lint/black ## check style test: ## run tests quickly with the default Python pytest diff --git a/tox.ini b/tox.ini index 03f8fb3d..876dd7b0 100644 --- a/tox.ini +++ b/tox.ini @@ -16,8 +16,7 @@ deps = flake8 black commands = - make lint/black - make lint/flake8 + make lint allowlist_externals = make From ab2348994ba7ad2593748eace2ab3cc01d8e860e Mon Sep 17 00:00:00 2001 From: Zeitsperre <10819524+Zeitsperre@users.noreply.github.com> Date: Fri, 9 Jun 2023 17:07:46 -0400 Subject: [PATCH 12/26] fix another error from jinja template in Makefile --- docs/conf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/conf.py b/docs/conf.py index 3ffe280e..f553711d 100755 --- a/docs/conf.py +++ b/docs/conf.py @@ -34,7 +34,7 @@ extensions = [ 'sphinx.ext.autodoc', 'sphinx.ext.autosectionlabel', - 'sphinx.ext.viewcode' + 'sphinx.ext.viewcode', 'sphinx.ext.todo', 'sphinx_codeautolink', 'sphinx_copybutton', From e09c3ee2e9de836892021cd31f7bfa6fa62ebbcd Mon Sep 17 00:00:00 2001 From: Zeitsperre <10819524+Zeitsperre@users.noreply.github.com> Date: Fri, 9 Jun 2023 17:10:12 -0400 Subject: [PATCH 13/26] add missing sphinx extensions --- environment.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/environment.yml b/environment.yml index 22c314b9..25affbc6 100644 --- a/environment.yml +++ b/environment.yml @@ -28,6 +28,10 @@ dependencies: - s3fs >=2022.7.0 - scipy >=1.2 - sphinx + - sphinx-autoapi + - sphinx-codeautolink + - sphinx-copybutton + - sphinxcontrib-napoleon - xarray >=0.17.0 - xclim >=0.43.0 - zarr >=2.11.1 From cdbb2af777ac9d3ad091254e6c634a9d6a9d91b2 Mon Sep 17 00:00:00 2001 From: Zeitsperre <10819524+Zeitsperre@users.noreply.github.com> Date: Fri, 9 Jun 2023 17:15:04 -0400 Subject: [PATCH 14/26] temporarily disable testing with tox and add a smoke test --- .github/workflows/main.yml | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index fce6f0fc..04b45b6e 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -57,15 +57,23 @@ jobs: uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} - - name: Install tox - run: pip install tox - - name: Test with tox - run: tox -e ${{ matrix.tox-env }} - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - COVERALLS_FLAG_NAME: run-${{ matrix.tox-env }} - COVERALLS_PARALLEL: true - COVERALLS_SERVICE_NAME: github +# - name: Install tox +# run: pip install tox +# - name: Test with tox +# run: tox -e ${{ matrix.tox-env }} +# env: +# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} +# COVERALLS_FLAG_NAME: run-${{ matrix.tox-env }} +# COVERALLS_PARALLEL: true +# COVERALLS_SERVICE_NAME: github + - name: Install xhydro (no dependencies) + run: | + python -m pip install -e . --no-dependencies + - name: Smoke tests + run: | + python -m pip install pytest + pytest + finish: needs: From e6b217b2a138195b055e15a3c16b2344c2c1d872 Mon Sep 17 00:00:00 2001 From: Zeitsperre <10819524+Zeitsperre@users.noreply.github.com> Date: Fri, 9 Jun 2023 17:54:19 -0400 Subject: [PATCH 15/26] more small template-based bugfixes --- .github/workflows/bump-version.yml | 3 ++- .github/workflows/main.yml | 28 ++++++++++++++-------------- .github/workflows/tag-testpypi.yml | 2 +- 3 files changed, 17 insertions(+), 16 deletions(-) diff --git a/.github/workflows/bump-version.yml b/.github/workflows/bump-version.yml index d582c33f..9abf1c4a 100644 --- a/.github/workflows/bump-version.yml +++ b/.github/workflows/bump-version.yml @@ -12,13 +12,14 @@ on: - .pre-commit-config.yaml - .yamllint.yaml - AUTHORS.rst - - CHANGES.rst - CONTRIBUTING.rst + - HISTORY.rst - MANIFEST.in - Makefile - docs/*.py - docs/*.rst - docs/notebooks + - environment-docs.yml - environment.yml - requirements_dev.txt - setup.cfg diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 04b45b6e..897a974c 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -74,17 +74,17 @@ jobs: python -m pip install pytest pytest - - finish: - needs: - - test - runs-on: ubuntu-latest - container: python:3-slim - steps: - - name: Coveralls Finished - run: | - pip install --upgrade coveralls - coveralls --finish - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - COVERALLS_SERVICE_NAME: github +# FIXME: Needs the Coveralls Pro webhook +# finish: +# needs: +# - test +# runs-on: ubuntu-latest +# container: python:3-slim +# steps: +# - name: Coveralls Finished +# run: | +# pip install --upgrade coveralls +# coveralls --finish +# env: +# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} +# COVERALLS_SERVICE_NAME: github diff --git a/.github/workflows/tag-testpypi.yml b/.github/workflows/tag-testpypi.yml index 92877a74..5bc8e5c0 100644 --- a/.github/workflows/tag-testpypi.yml +++ b/.github/workflows/tag-testpypi.yml @@ -25,6 +25,6 @@ jobs: uses: pypa/gh-action-pypi-publish@release/v1 with: user: __token__ - password: __TEST_PYPI_API_TOKEN__ + password: ${{ secrets.TEST_PYPI_API_TOKEN }} repository_url: https://test.pypi.org/legacy/ skip_existing: true From 4338bed43954ef58a7002c03986991ff5805919e Mon Sep 17 00:00:00 2001 From: Zeitsperre <10819524+Zeitsperre@users.noreply.github.com> Date: Mon, 12 Jun 2023 11:58:22 -0400 Subject: [PATCH 16/26] add json-related configurations, add TJS to .zenodo.json and AUTHORS.rst --- .pre-commit-config.yaml | 3 +++ .zenodo.json | 12 ++++++++++-- AUTHORS.rst | 2 +- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 97e5eed1..149b797b 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -13,9 +13,12 @@ repos: - id: trailing-whitespace exclude: setup.cfg - id: end-of-file-fixer + - id: check-json - id: check-yaml args: ['--allow-multiple-documents'] - id: debug-statements + - id: pretty-format-json + args: [ '--autofix', '--no-ensure-ascii', '--no-sort-keys' ] - repo: https://github.com/pre-commit/pygrep-hooks rev: v1.10.0 hooks: diff --git a/.zenodo.json b/.zenodo.json index 19f344c7..9bf14b1e 100644 --- a/.zenodo.json +++ b/.zenodo.json @@ -3,12 +3,20 @@ "creators": [ { "name": "Filion, Thomas-Charles Fortier" + }, + { + "name": "Smith, Trevor James", + "affiliation": "Ouranos, MontrΓ©al, QuΓ©bec, Canada", + "orcid": "0000-0001-5393-8359" } ], - "keywords": [ ], + "keywords": [ + "hydrology", + "xarray" + ], "license": "Apache-2.0", "language": "eng", - "communities": [ ], + "communities": [], "upload_type": "software", "access_right": "open" } diff --git a/AUTHORS.rst b/AUTHORS.rst index 95db7fc5..68dec349 100644 --- a/AUTHORS.rst +++ b/AUTHORS.rst @@ -10,7 +10,7 @@ Development Lead Co-Developers ------------- -None yet. Why not be the first? +* Trevor James Smith `@Zeitsperre `_ Contributors ------------ From c985fb0253ba3811ef2180d59b11f7627e6d3a18 Mon Sep 17 00:00:00 2001 From: Zeitsperre <10819524+Zeitsperre@users.noreply.github.com> Date: Mon, 12 Jun 2023 11:58:37 -0400 Subject: [PATCH 17/26] fix autogeneration inaccuracies --- docs/conf.py | 2 +- docs/installation.rst | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index f553711d..fda34a83 100755 --- a/docs/conf.py +++ b/docs/conf.py @@ -177,5 +177,5 @@ author, 'xhydro', 'Hydrological analysis library built with xarray.', - 'Miscellaneous'), + 'hydrology'), ] diff --git a/docs/installation.rst b/docs/installation.rst index a75c2f9b..d499bd94 100644 --- a/docs/installation.rst +++ b/docs/installation.rst @@ -30,13 +30,13 @@ You can either clone the public repository: .. code-block:: console - $ git clone git@github.com:TC-FF/xhydro + $ git clone git@github.com:hydrologie/xhydro Or download the `tarball`_: .. code-block:: console - $ curl -OJL https://github.com/TC-FF/xhydro/tarball/master + $ curl -OJL https://github.com/hydrologie/xhydro/tarball/master Once you have a copy of the source, you can install it with: @@ -45,5 +45,5 @@ Once you have a copy of the source, you can install it with: $ python setup.py install -.. _Github repo: https://github.com/TC-FF/xhydro -.. _tarball: https://github.com/TC-FF/xhydro/tarball/master +.. _Github repo: https://github.com/hydrologie/xhydro +.. _tarball: https://github.com/hydrologie/xhydro/tarball/master From e09ffd13e758cfa018da375ce2a49a1350c16815 Mon Sep 17 00:00:00 2001 From: Zeitsperre <10819524+Zeitsperre@users.noreply.github.com> Date: Mon, 12 Jun 2023 11:58:58 -0400 Subject: [PATCH 18/26] replace sphinx_rtd_theme with furo, add mock --- environment-docs.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/environment-docs.yml b/environment-docs.yml index dc042a98..32509da7 100644 --- a/environment-docs.yml +++ b/environment-docs.yml @@ -4,8 +4,9 @@ channels: - defaults dependencies: - sphinx + - furo + - mock - pandoc - - sphinx_rtd_theme >=1.0 - sphinx-autoapi - sphinx-codeautolink - sphinx-copybutton From 501f1637d357f75cb0d17551cba08234d6ae1fe8 Mon Sep 17 00:00:00 2001 From: Zeitsperre <10819524+Zeitsperre@users.noreply.github.com> Date: Mon, 12 Jun 2023 13:57:57 -0400 Subject: [PATCH 19/26] fast-forward cookiecutter adjustments --- .cruft.json | 3 +-- .pre-commit-config.yaml | 6 +++--- MANIFEST.in | 2 +- Makefile | 1 + README.rst | 11 ++++++++--- 5 files changed, 14 insertions(+), 9 deletions(-) diff --git a/.cruft.json b/.cruft.json index 433b21e6..5a8bd961 100644 --- a/.cruft.json +++ b/.cruft.json @@ -1,6 +1,6 @@ { "template": "https://github.com/Ouranosinc/cookiecutter-pypackage", - "commit": "49c15f3ab0a7aff9ccb2019abb117b226444dacb", + "commit": "f295bf6f7568694b200b383193c5585950762d56", "checkout": null, "context": { "cookiecutter": { @@ -14,7 +14,6 @@ "version": "0.1.3", "use_pytest": "y", "use_black": "y", - "use_pypi_deployment_with_travis": "n", "add_pyup_badge": "n", "make_docs": "y", "command_line_interface": "No command-line interface", diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 149b797b..14aa1866 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -13,12 +13,12 @@ repos: - id: trailing-whitespace exclude: setup.cfg - id: end-of-file-fixer - - id: check-json - - id: check-yaml - args: ['--allow-multiple-documents'] - id: debug-statements + - id: check-json - id: pretty-format-json args: [ '--autofix', '--no-ensure-ascii', '--no-sort-keys' ] + - id: check-yaml + args: [ '--allow-multiple-documents' ] - repo: https://github.com/pre-commit/pygrep-hooks rev: v1.10.0 hooks: diff --git a/MANIFEST.in b/MANIFEST.in index ac2d2ed7..35ca6d1c 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -6,9 +6,9 @@ include README.rst include requirements_dev.txt include requirements_docs.txt include .zenodo.json -recursive-include tests * recursive-include docs *.rst conf.py Makefile make.bat *.jpg *.png *.gif +recursive-include tests * recursive-exclude * __pycache__ recursive-exclude * *.py[co] diff --git a/Makefile b/Makefile index bd8c99d9..f43a6a24 100644 --- a/Makefile +++ b/Makefile @@ -71,6 +71,7 @@ coverage: ## check code coverage quickly with the default Python coverage report -m coverage html $(BROWSER) htmlcov/index.html + autodoc: clean-docs ## create sphinx-apidoc files: sphinx-apidoc -o docs/apidoc --private --module-first xhydro diff --git a/README.rst b/README.rst index 29227872..afdf989b 100644 --- a/README.rst +++ b/README.rst @@ -6,13 +6,18 @@ xHydro .. image:: https://img.shields.io/pypi/v/xhydro.svg :target: https://pypi.python.org/pypi/xhydro -.. image:: https://img.shields.io/travis/TC-FF/xhydro.svg - :target: https://travis-ci.com/TC-FF/xhydro +.. image:: https://github.com/TC-FF/xhydro/workflows/xhydro/badge.svg + :target: https://github.com/TC-FF/xhydro + :alt: Build Status .. image:: https://readthedocs.org/projects/xhydro/badge/?version=latest :target: https://xhydro.readthedocs.io/en/latest/?version=latest :alt: Documentation Status +.. image:: https://img.shields.io/github/license/TC-FF/xhydro.svg + :target: https://github.com/TC-FF/xhydro/blob/main/LICENSE + :alt: License + Hydrological analysis library built with xarray @@ -31,5 +36,5 @@ Credits This package was created with Cookiecutter_ and the `Ouranosinc/cookiecutter-pypackage`_ project template. -.. _Cookiecutter: https://github.com/audreyfeldroy/cookiecutter-pypackage +.. _Cookiecutter: https://github.com/cookiecutter/cookiecutter .. _`Ouranosinc/cookiecutter-pypackage`: https://github.com/Ouranosinc/cookiecutter-pypackage From 68dc2f3356851c313baf7244d336d1bafe35f621 Mon Sep 17 00:00:00 2001 From: Zeitsperre <10819524+Zeitsperre@users.noreply.github.com> Date: Mon, 12 Jun 2023 14:11:35 -0400 Subject: [PATCH 20/26] cleaner README.rst formatting, point documentation to GitHub.io deploy-docs --- README.rst | 40 +++++++++++++++++++++++----------------- 1 file changed, 23 insertions(+), 17 deletions(-) diff --git a/README.rst b/README.rst index afdf989b..a2ebe118 100644 --- a/README.rst +++ b/README.rst @@ -2,26 +2,10 @@ xHydro ====== - -.. image:: https://img.shields.io/pypi/v/xhydro.svg - :target: https://pypi.python.org/pypi/xhydro - -.. image:: https://github.com/TC-FF/xhydro/workflows/xhydro/badge.svg - :target: https://github.com/TC-FF/xhydro - :alt: Build Status - -.. image:: https://readthedocs.org/projects/xhydro/badge/?version=latest - :target: https://xhydro.readthedocs.io/en/latest/?version=latest - :alt: Documentation Status - -.. image:: https://img.shields.io/github/license/TC-FF/xhydro.svg - :target: https://github.com/TC-FF/xhydro/blob/main/LICENSE - :alt: License - +|pypi| |build| |docs| |license| Hydrological analysis library built with xarray - * Free software: Apache-2.0 * Documentation: https://xhydro.readthedocs.io. @@ -38,3 +22,25 @@ This package was created with Cookiecutter_ and the `Ouranosinc/cookiecutter-pyp .. _Cookiecutter: https://github.com/cookiecutter/cookiecutter .. _`Ouranosinc/cookiecutter-pypackage`: https://github.com/Ouranosinc/cookiecutter-pypackage + + +.. |pypi| image:: https://img.shields.io/pypi/v/xhydro.svg + :target: https://pypi.python.org/pypi/xhydro + + +.. |build| image:: https://github.com/hydrologie/xhydro/workflows/xhydro/badge.svg + :target: https://github.com/hydrologie/xhydro + :alt: Build Status + +.. |docs| image:: https://img.shields.io/badge/Docs-GitHub.io-blue + :target: https://hydrologie.github.io/xhydro/ + :alt: Documentation + +.. + .. |docs| image:: https://readthedocs.org/projects/xhydro/badge/?version=latest + :target: https://xhydro.readthedocs.io/en/latest/?version=latest + :alt: Documentation Status + +.. |license| image:: https://img.shields.io/pypi/l/xhydro + :target: https://github.com/hydrologie/xhydro/blob/main/LICENSE + :alt: License From 828d812f866295d64ff54b1f05b7484a5a509f6f Mon Sep 17 00:00:00 2001 From: Zeitsperre <10819524+Zeitsperre@users.noreply.github.com> Date: Mon, 12 Jun 2023 14:20:46 -0400 Subject: [PATCH 21/26] let bumpversion augment the version number ($ bump2version --no-commit --no-tag --new-version 0.1.2 patch) --- .cruft.json | 2 +- setup.cfg | 15 +++++++-------- setup.py | 2 +- tests/test_xhydro.py | 2 +- 4 files changed, 10 insertions(+), 11 deletions(-) diff --git a/.cruft.json b/.cruft.json index 5a8bd961..ac54c32a 100644 --- a/.cruft.json +++ b/.cruft.json @@ -11,7 +11,7 @@ "project_slug": "xhydro", "project_short_description": "Hydrological analysis library built with xarray", "pypi_username": "TC-FF", - "version": "0.1.3", + "version": "0.1.2", "use_pytest": "y", "use_black": "y", "add_pyup_badge": "n", diff --git a/setup.cfg b/setup.cfg index 275350c8..a438e6fd 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 0.1.3 +current_version = 0.1.2 commit = True tag = True @@ -20,18 +20,17 @@ search = "version": "{current_version}", replace = "version": "{new_version}", [aliases] -# Define setup.py command aliases here test = pytest [tool:pytest] collect_ignore = ['setup.py'] -addopts = +addopts = --verbose -filterwarnings = +filterwarnings = ignore::UserWarning [flake8] -exclude = +exclude = .git, docs, build, @@ -39,7 +38,7 @@ exclude = docs/conf.py, max-line-length = 88 max-complexity = 12 -ignore = +ignore = C901 E203 E231 @@ -49,9 +48,9 @@ ignore = F403 W503 W504 -per-file-ignores = +per-file-ignores = tests/*:E402 -rst-roles = +rst-roles = mod, py:attr, py:attribute, diff --git a/setup.py b/setup.py index efcdc38f..3b461781 100644 --- a/setup.py +++ b/setup.py @@ -79,6 +79,6 @@ "dev": dev_requirements, }, url="https://github.com/TC-FF/xhydro", - version="0.1.3", + version="0.1.2", zip_safe=False, ) diff --git a/tests/test_xhydro.py b/tests/test_xhydro.py index 3f54947a..e58c13e8 100644 --- a/tests/test_xhydro.py +++ b/tests/test_xhydro.py @@ -34,4 +34,4 @@ def test_imports(): contents = f.read() assert '__author__ = """Thomas-Charles Fortier Filion"""' in contents assert '__email__ = "tcff_hydro@outlook.com"' in contents - assert '__version__ = "0.1.3"' in contents + assert '__version__ = "0.1.2"' in contents From 70ea7de3eecec98da458679d085111acdb4b0f42 Mon Sep 17 00:00:00 2001 From: Zeitsperre <10819524+Zeitsperre@users.noreply.github.com> Date: Mon, 12 Jun 2023 14:24:22 -0400 Subject: [PATCH 22/26] let bumpversion augment the version number ($ bump2version --no-commit --no-tag --new-version 0.1.2 patch) --- xhydro/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xhydro/__init__.py b/xhydro/__init__.py index f72c0783..399b3aa6 100644 --- a/xhydro/__init__.py +++ b/xhydro/__init__.py @@ -2,4 +2,4 @@ __author__ = """Thomas-Charles Fortier Filion""" __email__ = "tcff_hydro@outlook.com" -__version__ = "0.1.3" +__version__ = "0.1.2" From eb1f1987725357e126635bbe70ddcd543bf8287c Mon Sep 17 00:00:00 2001 From: Zeitsperre <10819524+Zeitsperre@users.noreply.github.com> Date: Mon, 12 Jun 2023 16:46:29 -0400 Subject: [PATCH 23/26] drop Python3.8, specify Python3.9 in many places --- .github/workflows/bump-version.yml | 2 +- .github/workflows/main.yml | 2 -- .github/workflows/publish-pypi.yml | 2 +- .github/workflows/tag-testpypi.yml | 2 +- .pre-commit-config.yaml | 4 ++-- CONTRIBUTING.rst | 2 +- requirements_dev.txt | 1 - requirements_docs.txt | 12 ++++++------ setup.cfg | 14 +++++++------- setup.py | 3 +-- tox.ini | 2 +- 11 files changed, 21 insertions(+), 25 deletions(-) diff --git a/.github/workflows/bump-version.yml b/.github/workflows/bump-version.yml index 9abf1c4a..d7881b90 100644 --- a/.github/workflows/bump-version.yml +++ b/.github/workflows/bump-version.yml @@ -35,7 +35,7 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-python@v4 with: - python-version: "3.x" + python-version: "3.9" - name: Config Commit Bot run: | git config --local user.email "bumpversion[bot]@hydrologie.com" diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 897a974c..dc34cd36 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -43,8 +43,6 @@ jobs: strategy: matrix: include: - - tox-env: "py38" - python-version: "3.8" - tox-env: "py39" python-version: "3.9" - tox-env: "py310" diff --git a/.github/workflows/publish-pypi.yml b/.github/workflows/publish-pypi.yml index f5dee654..f54bc32f 100644 --- a/.github/workflows/publish-pypi.yml +++ b/.github/workflows/publish-pypi.yml @@ -14,7 +14,7 @@ jobs: - name: Set up Python3 uses: actions/setup-python@v4 with: - python-version: "3.x" + python-version: "3.9" - name: Install packaging libraries run: | pip install setuptools wheel diff --git a/.github/workflows/tag-testpypi.yml b/.github/workflows/tag-testpypi.yml index 5bc8e5c0..4539f1be 100644 --- a/.github/workflows/tag-testpypi.yml +++ b/.github/workflows/tag-testpypi.yml @@ -14,7 +14,7 @@ jobs: - name: Set up Python3 uses: actions/setup-python@v4 with: - python-version: "3.x" + python-version: "3.9" - name: Install packaging libraries run: | pip install setuptools wheel diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 14aa1866..d185ec5b 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -6,7 +6,7 @@ repos: rev: v3.4.0 hooks: - id: pyupgrade - args: [--py38-plus] + args: [--py39-plus] - repo: https://github.com/pre-commit/pre-commit-hooks rev: v4.4.0 hooks: @@ -39,7 +39,7 @@ repos: hooks: - id: black exclude: ^docs/ - args: [ '--target-version=py38' ] + args: [ '--target-version=py39' ] - repo: https://github.com/PyCQA/isort rev: 5.12.0 hooks: diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index ce3346b3..1f3ed83c 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -119,7 +119,7 @@ Before you submit a pull request, check that it meets these guidelines: 2. If the pull request adds functionality, the docs should be updated. Put your new functionality into a function with a docstring, and add the feature to the list in README.rst. -3. The pull request should work for Python 3.8, 3.9, 3.10, and 3.11. Check that the tests pass for all supported Python versions. +3. The pull request should work for Python 3.9, 3.10, and 3.11. Check that the tests pass for all supported Python versions. Tips ---- diff --git a/requirements_dev.txt b/requirements_dev.txt index 71d54aa8..86782b21 100644 --- a/requirements_dev.txt +++ b/requirements_dev.txt @@ -10,7 +10,6 @@ pip pre-commit pytest pytest-cov -sphinx tox twine watchdog diff --git a/requirements_docs.txt b/requirements_docs.txt index d425dc90..4eb3499c 100644 --- a/requirements_docs.txt +++ b/requirements_docs.txt @@ -1,10 +1,10 @@ +furo +ipykernel +ipython +jupyter_client +nbsphinx +pandoc sphinx sphinx-click sphinx-codeautolink sphinx-copybutton -sphinx-rtd-theme>=1.0 -nbsphinx -pandoc -ipython -ipykernel -jupyter_client diff --git a/setup.cfg b/setup.cfg index a438e6fd..e2a40b9d 100644 --- a/setup.cfg +++ b/setup.cfg @@ -24,13 +24,13 @@ test = pytest [tool:pytest] collect_ignore = ['setup.py'] -addopts = +addopts = --verbose -filterwarnings = +filterwarnings = ignore::UserWarning [flake8] -exclude = +exclude = .git, docs, build, @@ -38,7 +38,7 @@ exclude = docs/conf.py, max-line-length = 88 max-complexity = 12 -ignore = +ignore = C901 E203 E231 @@ -48,9 +48,9 @@ ignore = F403 W503 W504 -per-file-ignores = +per-file-ignores = tests/*:E402 -rst-roles = +rst-roles = mod, py:attr, py:attribute, @@ -70,7 +70,7 @@ omit = */tests/*.py [isort] profile = black -py_version = 38 +py_version = 39 [pydocstyle] convention = numpy diff --git a/setup.py b/setup.py index 3b461781..87f5c31e 100644 --- a/setup.py +++ b/setup.py @@ -46,14 +46,13 @@ setup( author="Thomas-Charles Fortier Filion", author_email="tcff_hydro@outlook.com", - python_requires=">=3.8", + python_requires=">=3.9", classifiers=[ "Development Status :: 2 - Pre-Alpha", "Intended Audience :: Developers", "License :: OSI Approved :: Apache Software License", "Natural Language :: English", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", diff --git a/tox.ini b/tox.ini index 876dd7b0..a844459f 100644 --- a/tox.ini +++ b/tox.ini @@ -2,7 +2,7 @@ min_version = 4.0 envlist = black - py{38,39,310,311} + py{39,310,311} docs coveralls requires = From bfb206aea66f913ef2ba60512204cf1e7b8d546e Mon Sep 17 00:00:00 2001 From: Zeitsperre <10819524+Zeitsperre@users.noreply.github.com> Date: Tue, 13 Jun 2023 11:35:02 -0400 Subject: [PATCH 24/26] update cookiecutter version --- .cruft.json | 4 ++-- setup.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.cruft.json b/.cruft.json index ac54c32a..bb50722a 100644 --- a/.cruft.json +++ b/.cruft.json @@ -1,6 +1,6 @@ { "template": "https://github.com/Ouranosinc/cookiecutter-pypackage", - "commit": "f295bf6f7568694b200b383193c5585950762d56", + "commit": "8e44c8f85d93b68ac036b79f56c90846da689f46", "checkout": null, "context": { "cookiecutter": { @@ -18,7 +18,7 @@ "make_docs": "y", "command_line_interface": "No command-line interface", "create_author_file": "y", - "open_source_license": "Apache-2.0", + "open_source_license": "Apache Software License 2.0", "generated_with_cruft": "y", "_template": "https://github.com/Ouranosinc/cookiecutter-pypackage" } diff --git a/setup.py b/setup.py index 87f5c31e..b07cb531 100644 --- a/setup.py +++ b/setup.py @@ -64,7 +64,7 @@ ], }, install_requires=requirements, - license="Apache-2.0", + license="Apache Software License 2.0", long_description=readme + "\n\n" + history, long_description_content_type="text/x-rst", include_package_data=True, From 359dedcc3f98d981405d3bec28df23636e4a82f7 Mon Sep 17 00:00:00 2001 From: Zeitsperre <10819524+Zeitsperre@users.noreply.github.com> Date: Tue, 13 Jun 2023 11:39:54 -0400 Subject: [PATCH 25/26] fix documentation hyperlinks --- CONTRIBUTING.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index 1f3ed83c..1e2a220b 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -15,7 +15,7 @@ Types of Contributions Report Bugs ~~~~~~~~~~~ -Report bugs at https://github.com/TC-FF/xhydro/issues. +Report bugs at https://github.com/hydrologie/xhydro/issues. If you are reporting a bug, please include: @@ -45,7 +45,7 @@ articles, and such. Submit Feedback ~~~~~~~~~~~~~~~ -The best way to send feedback is to file an issue at https://github.com/TC-FF/xhydro/issues. +The best way to send feedback is to file an issue at https://github.com/hydrologie/xhydro/issues. If you are proposing a feature: From 39c6923d06443a4a3b35f3f45551c61360285d1b Mon Sep 17 00:00:00 2001 From: Zeitsperre <10819524+Zeitsperre@users.noreply.github.com> Date: Tue, 13 Jun 2023 11:52:59 -0400 Subject: [PATCH 26/26] adjust Thomas-Charles's name --- .zenodo.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.zenodo.json b/.zenodo.json index 9bf14b1e..1150026f 100644 --- a/.zenodo.json +++ b/.zenodo.json @@ -2,7 +2,7 @@ "title": "xHydro", "creators": [ { - "name": "Filion, Thomas-Charles Fortier" + "name": "Fortier Filion, Thomas-Charles" }, { "name": "Smith, Trevor James",