Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Employ a src-based layout for code base #1971

Merged
merged 11 commits into from
Dec 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ ignore =
RST213,
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 @@ -23,8 +23,8 @@ on:
- environment.yml
- pylintrc
- pyproject.toml
- src/xclim/__init__.py
- tox.ini
- xclim/__init__.py

permissions:
contents: read
Expand Down Expand Up @@ -70,7 +70,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 @@ -85,7 +85,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
4 changes: 2 additions & 2 deletions .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 Expand Up @@ -86,7 +86,7 @@ jobs:
key: ${{ runner.os }}-xclim-testdata-${{ env.XCLIM_TESTDATA_BRANCH }}-${{ hashFiles('pyproject.toml', 'tox.ini') }}-lint
- name: Run pylint
run: |
python -m pylint --rcfile=.pylintrc.toml --disable=import-error --exit-zero xclim
python -m pylint --rcfile=.pylintrc.toml --disable=import-error --exit-zero src/xclim
- name: Run linting suite
run: |
python -m tox -e lint
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
6 changes: 3 additions & 3 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: ['--py310-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 All @@ -104,7 +104,7 @@ repos:
hooks:
- id: numpydoc-validation
# Exclude the missing submodule from the xclim.core, see:
exclude: ^docs/|^tests/|^xclim/sdba|^xclim/core/missing.py
exclude: ^docs/|^tests/|^src/xclim/sdba|^src/xclim/core/missing.py
- repo: https://github.com/gitleaks/gitleaks
rev: v8.21.2
hooks:
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 src/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 src/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: {}

Zeitsperre marked this conversation as resolved.
Show resolved Hide resolved
truthy: disable
2 changes: 2 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ Internal changes
* In order to address 403 (forbidden) request errors when retrieving data from GitHub via ReadTheDocs, the ``nimbus`` class has been modified to use an overloaded `fetch` method that appends a User-Agent header to the request. (:pull:`2001`).
* Addressed a very rare race condition that can happen if `pytest` is tearing down the test environment when running across multiple workers. (:pull:`1863`).
* The `numpydoc` linting tool has been added to the development dependencies, linting checks, and the `pre-commit` configuration. (:pull:`1988`).
* `xclim` now uses a `src` layout for the codebase. Structure-dependent functions, documentation, and build commands have been adapted to reflect these changes. (:pull:`1971`).
* Added a more robust `yamllint` configuration to ensure that all YAML files are linted consistently. (:pull:`1971`).

CI changes
^^^^^^^^^^
Expand Down
Loading
Loading