Skip to content

Commit

Permalink
employ a src layout for code base
Browse files Browse the repository at this point in the history
  • Loading branch information
Zeitsperre committed Oct 22, 2024
1 parent df86b39 commit b197bec
Show file tree
Hide file tree
Showing 102 changed files with 334 additions and 205 deletions.
2 changes: 1 addition & 1 deletion .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ ignore =
F,
W503
per-file-ignores =
xclim/core/locales.py:RST399
src/xclim/core/locales.py:RST399
rst-directives =
bibliography,
autolink-skip
Expand Down
10 changes: 5 additions & 5 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@
'indicators':
- changed-files:
- any-glob-to-any-file:
- 'xclim/indicators/**/*'
- 'xclim/indices/**/_*.py'
- 'xclim/data/**/*.json'
- 'xclim/data/**/*.yml'
- 'src/xclim/indicators/**/*'
- 'src/xclim/indices/**/_*.py'
- 'src/xclim/data/**/*.json'
- 'src/xclim/data/**/*.yml'

'information':
- changed-files:
Expand All @@ -53,5 +53,5 @@
'sdba':
- changed-files:
- any-glob-to-any-file:
- 'xclim/sdba/**/*'
- 'src/xclim/sdba/**/*'
- 'tests/test_sdba/*.py'
6 changes: 3 additions & 3 deletions .github/workflows/bump-version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ on:
- environment.yml
- pylintrc
- pyproject.toml
- src/xclim/__init__.py
- tox.ini
- xclim/__init__.py

permissions:
contents: read
Expand Down Expand Up @@ -68,7 +68,7 @@ jobs:
trust_level: 5
- name: Current Version
run: |
CURRENT_VERSION="$(grep -E '__version__' xclim/__init__.py | cut -d ' ' -f3)"
CURRENT_VERSION="$(grep -E '__version__' src/xclim/__init__.py | cut -d ' ' -f3)"
echo "current_version=${CURRENT_VERSION}"
echo "CURRENT_VERSION=${CURRENT_VERSION}" >> $GITHUB_ENV
- name: Install CI libraries
Expand All @@ -83,7 +83,7 @@ jobs:
echo "Version is stable, bumping 'patch' version"
bump-my-version bump patch
fi
NEW_VERSION="$(grep -E '__version__' xclim/__init__.py | cut -d ' ' -f3)"
NEW_VERSION="$(grep -E '__version__' src/xclim/__init__.py | cut -d ' ' -f3)"
echo "new_version=${NEW_VERSION}"
echo "NEW_VERSION=${NEW_VERSION}" >> $GITHUB_ENV
- name: Push Changes
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:
- Makefile
- pyproject.toml
- tox.ini
- xclim/__init__.py
- src/xclim/__init__.py
- docs/*/*.ipynb
- docs/*/*.py
- docs/*/*.rst
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
- CHANGELOG.rst
- README.rst
- pyproject.toml
- xclim/__init__.py
- src/xclim/__init__.py
pull_request:
types:
- opened
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish-mastodon.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ jobs:
echo "${{ steps.render_template.outputs.result }}${{ env.contributors }}"
- name: Send toot to Mastodon
if: ${{ github.event.inputs.dry-run != 'true' }} || ${{ github.event_name == 'release' }}
if: ${{ github.event.inputs.dry-run != 'true' || github.event_name == 'release' }}
uses: cbrgm/mastodon-github-action@b26d62619432b20c2129edd86f07f7ede9797fc9 # v2.1.9
with:
url: ${{ secrets.MASTODON_URL }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/upstream.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
- CHANGELOG.rst
- README.rst
- pyproject.toml
- xclim/__init__.py
- src/xclim/__init__.py
schedule:
- cron: "0 0 * * *" # Daily “At 00:00” UTC
workflow_dispatch: # allows you to trigger the workflow run manually
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ parts/
sdist/
var/
wheels/
src/
*.egg-info/
.installed.cfg
*.egg
Expand Down
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ repos:
hooks:
- id: pyupgrade
args: ['--py39-plus']
exclude: 'xclim/core/indicator.py'
exclude: 'src/xclim/core/indicator.py'
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
Expand Down Expand Up @@ -91,7 +91,7 @@ repos:
hooks:
- id: blackdoc
additional_dependencies: [ 'black==24.10.0' ]
exclude: '(xclim/indices/__init__.py|docs/installation.rst)'
exclude: '(src/xclim/indices/__init__.py|docs/installation.rst)'
- id: blackdoc-autoupdate-black
- repo: https://github.com/codespell-project/codespell
rev: v2.3.0
Expand Down
4 changes: 2 additions & 2 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ build:
python: "mambaforge-22.9"
jobs:
pre_build:
- sphinx-apidoc -o docs/apidoc/ --private --module-first xclim xclim/testing/tests xclim/indicators xclim/indices
- sphinx-apidoc -o docs/apidoc/ --private --module-first xclim src/xclim/testing/tests src/xclim/indicators src/xclim/indices
- rm docs/apidoc/xclim.rst
- env SPHINX_APIDOC_OPTIONS="members,undoc-members,show-inheritance,noindex" sphinx-apidoc -o docs/apidoc/ --private --module-first xclim xclim/testing/tests
- env SPHINX_APIDOC_OPTIONS="members,undoc-members,show-inheritance,noindex" sphinx-apidoc -o docs/apidoc/ --private --module-first xclim src/xclim/testing/tests
- sphinx-build -b linkcheck docs/ _build/linkcheck || true

conda:
Expand Down
31 changes: 31 additions & 0 deletions .yamllint.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,39 @@
---

rules:

brackets:
forbid: false
min-spaces-inside: 0
max-spaces-inside: 1

commas:
min-spaces-after: 1

document-start: disable

float-values:
require-numeral-before-decimal: true

hyphens:
max-spaces-after: 1

indentation:
indent-sequences: whatever
spaces: consistent

key-duplicates:
forbid-duplicated-merge-keys: true

line-length:
allow-non-breakable-words: true
allow-non-breakable-inline-mappings: true
max: 120
level: warning

new-lines:
type: unix

trailing-spaces: {}

truthy: disable
8 changes: 8 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@
Changelog
=========

v0.54.0 (unreleased)
--------------------
Contributors to this version: Trevor James Smith (:user:`Zeitsperre`).

Internal changes
^^^^^^^^^^^^^^^^
* `xclim` now uses a `src` layout for the codebase. Structure-dependent functions, documentation, and build commands have been adapted to reflect these changes.

v0.53.1 (2024-10-21)
--------------------
Contributors to this version: Trevor James Smith (:user:`Zeitsperre`).
Expand Down
Loading

0 comments on commit b197bec

Please sign in to comment.