Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
11cd8a9
add a hint in the documentation to execute the provided bash scripts …
clairemerker Apr 5, 2023
b0b487b
re-introduce logging controlled with -v
DanielLeuenberger May 11, 2023
bf3c042
bug fix
DanielLeuenberger May 11, 2023
ab8411a
bug fix 2
DanielLeuenberger May 11, 2023
6a09577
bug fix 3
DanielLeuenberger May 11, 2023
e4721e6
bug fix 4
DanielLeuenberger May 11, 2023
e69c99e
fix pylint directives
May 11, 2023
e521057
swap order of pylint disable-next and decorator
May 11, 2023
e10c305
set logging level via callback
May 11, 2023
3329f84
fix import headings
May 11, 2023
66e8911
uncomment command declaration
May 11, 2023
97946b2
bug fix 5
DanielLeuenberger May 11, 2023
a733e6b
use root logger
May 11, 2023
a1040e7
fix log level decorator
May 11, 2023
ce2c690
rename internal verbosity level variable and move print_operation nex…
May 11, 2023
9324ddd
Merge branch 'verbosity' of github.com:MeteoSwiss-APN/mch-python-blue…
May 11, 2023
2d0764b
fix quotes (black) and return type (mypy)
May 11, 2023
b8b7d6a
Merge remote-tracking branch 'upstream/main' into main
Jul 20, 2023
836f68c
adapt bluprint to new copier version >=8.1.0
clairemerker Aug 21, 2023
f7bee25
adapt pre-commit github workflow to new copier version
clairemerker Aug 21, 2023
154a65a
bug fix in copier command
clairemerker Aug 21, 2023
11f8e0e
bug fix in copier command
clairemerker Aug 21, 2023
0a350ed
add check to bash scripts to avoid sourcing
clairemerker Aug 21, 2023
862e338
Merge remote-tracking branch 'upstream/verbosity' into main
Sep 14, 2023
f8c2c6a
Merge remote-tracking branch 'upstream/improve-docs' into main
Sep 14, 2023
b9ac391
move rstcheck to pip and add comment
Sep 14, 2023
b6138c5
update year
Sep 14, 2023
f82ec8d
update codespell config
Oct 10, 2023
76c1812
Merge remote-tracking branch 'upstream/main' into main
Nov 7, 2023
65952f2
Merge branch 'main' of github.com:meteoswiss-apn/mch-python-blueprint…
Dec 21, 2023
8281051
Merge branch 'main' into codespell-config
Dec 21, 2023
8ef06e4
ignore images in notebooks; make exclusion of requirements robust
Dec 21, 2023
deb8815
revert copier syntax to <8
Dec 21, 2023
4b0bcfb
restore rstcheck (accidentally commented) and update envs
Dec 21, 2023
1f47229
fix typo
Dec 21, 2023
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 .github/workflows/blueprint-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- name: Create new project
run: |
# Note: Make sure python_version is consistent with python-version hardcoded above
conda run --name blueprint copier --force --vcs-ref=HEAD python_version=3.9 copy . ./docs/example_project
conda run --name blueprint copier --force --vcs-ref=HEAD copy . ./docs/example_project
ls
echo "==================================="
ls docs
Expand Down
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,18 +42,19 @@ conda create --name blueprint
conda activate blueprint
conda install "copier<8.0"
```
Make sure to have at least copier version 8.1.0. Otherwise, please update copier.

## Create your Python package from our template
You can now produce your Python package from a copier template by running
```
conda activate blueprint
copier [email protected]:MeteoSwiss-APN/mch-python-blueprint.git </path/to/destination>
copier copy [email protected]:MeteoSwiss-APN/mch-python-blueprint.git </path/to/destination>
```
If you need to generate your project from a specific commit hash or branch of the blueprint you can run with --vcs-ref

```
conda activate blueprint
copier --vcs-ref <branch> [email protected]:MeteoSwiss-APN/mch-python-blueprint.git </path/to/destination>
copier copy --vcs-ref <branch> [email protected]:MeteoSwiss-APN/mch-python-blueprint.git </path/to/destination>
```

**Warning:**
Expand Down Expand Up @@ -91,7 +92,7 @@ out more about provided development tools and setting up CI/CD pipelines on http
To update your package to the latest version of the underlying meta template, run:

```bash
copier -a .copier-answers.yml -f update
copier update -a .copier-answers.yml -f update
```

With `-f`, conflicting files are overwritten (which doesn't mean that in the end, the files are changed as those conflicts can be purely internal).
Expand Down
2 changes: 1 addition & 1 deletion copier.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -76,5 +76,5 @@ python_version:

year:
help: "This year"
default: "2022"
default: "2023"
type: str
15 changes: 13 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,16 @@ ignore_directives = [
]

[tool.codespell]
ignore-words-list = "inout"
skip = "requirements/*"
ignore-regex = '(\b[A-Z]+\b|.*([#!"]|<!--) *codespell-ignore\b|^ *"image/[a-z]+": ".*",$)'
# - Ignore all-uppercase words (acronyms)
# - Ignore lines with codespell-ignore comment
# - Ignore lines "image/...": "..." (images in *.ipynb files)
ignore-words = './tmpl/codespell_ignored_words.txt'
# Note: To skip local files by their full path, codespell (v2.2.2) requires
# './src/...` when called from the command line but 'src/...' when called via
# pre-commit (as local hook); '*src/...` matches both
skip = """\
.git,\
*.codespell-ignore.*,\
*requirements/*,\
"""
55 changes: 26 additions & 29 deletions requirements/environment.yml
Original file line number Diff line number Diff line change
@@ -1,51 +1,48 @@
name: mch-python-blueprint
channels:
- conda-forge
- defaults
dependencies:
- _libgcc_mutex=0.1
- _openmp_mutex=4.5
- alabaster=0.7.13
- babel=2.13.0
- babel=2.14.0
- brotli-python=1.1.0
- bzip2=1.0.8
- ca-certificates=2023.7.22
- certifi=2023.7.22
- ca-certificates=2023.11.17
- certifi=2023.11.17
- cffi=1.16.0
- cfgv=3.3.1
- charset-normalizer=3.3.1
- charset-normalizer=3.3.2
- colorama=0.4.6
- distlib=0.3.7
- docutils=0.20.1
- filelock=3.12.4
- identify=2.5.30
- idna=3.4
- distlib=0.3.8
- filelock=3.13.1
- identify=2.5.33
- idna=3.6
- imagesize=1.4.1
- importlib-metadata=6.8.0
- importlib-metadata=7.0.0
- jinja2=3.1.2
- ld_impl_linux-64=2.40
- libexpat=2.5.0
- libffi=3.4.2
- libgcc-ng=13.2.0
- libgomp=13.2.0
- libnsl=2.0.1
- libsqlite=3.43.2
- libsqlite=3.44.2
- libstdcxx-ng=13.2.0
- libuuid=2.38.1
- libzlib=1.2.13
- markupsafe=2.1.3
- ncurses=6.4
- nodeenv=1.8.0
- openssl=3.1.3
- openssl=3.2.0
- packaging=23.2
- pip=23.3.1
- platformdirs=3.11.0
- pre-commit=3.5.0
- pip=23.3.2
- platformdirs=4.1.0
- pre-commit=3.6.0
- pycparser=2.21
- pygments=2.16.1
- pygments=2.17.2
- pysocks=1.7.1
- python=3.12.0
- python_abi=3.12
- python=3.10.13
- python_abi=3.10
- pytz=2023.3.post1
- pyyaml=6.0.1
- readline=8.2
Expand All @@ -60,29 +57,29 @@ dependencies:
- sphinxcontrib-qthelp=1.0.6
- sphinxcontrib-serializinghtml=1.1.9
- tk=8.6.13
- typing-extensions=4.8.0
- typing_extensions=4.8.0
- tzdata=2023c
- ukkonen=1.0.1
- urllib3=2.0.7
- virtualenv=20.24.4
- wheel=0.41.2
- urllib3=2.1.0
- virtualenv=20.25.0
- wheel=0.42.0
- xz=5.2.6
- yaml=0.2.5
- zipp=3.17.0
- pip:
- annotated-types==0.6.0
- copier==7.2.0
- docutils==0.19
- dunamai==1.19.0
- funcy==2.0
- jinja2-ansible-filters==1.3.2
- mistune==2.0.5
- pathspec==0.11.2
- pathspec==0.12.1
- plumbum==1.8.2
- prompt-toolkit==3.0.36
- pydantic==1.10.13
- pydantic-core==2.10.1
- pyyaml-include==1.3.1
- questionary==2.0.1
- rstcheck-core==1.0.3
- sphinx-mdinclude==0.5.3
- wcwidth==0.2.8
- types-docutils==0.19.1.9
- typing-extensions==4.9.0
- wcwidth==0.2.12
2 changes: 2 additions & 0 deletions tmpl/README.md.j2
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ is based on top-level dependencies listed in `requirements/requirements.yml`. If
```bash
tools/setup_env.sh -u -e -n <package_env_name>
```
*Hint*: Make sure to execute the bash scripts in `tools/` (do not source them as this can lead to issues)!

*Hint*: If you are the package administrator, it is a good idea to understand what this script does, you can do everything manually with `conda` instructions.

*Hint*: Use the flag `-m` to speed up the installation using mamba. Of course you will have to install mamba first (we recommend to install mamba into your base
Expand Down
9 changes: 9 additions & 0 deletions tmpl/codespell_ignored_words.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# German
alle
ist
oder
# English
pres
rime
theses
trough
1 change: 1 addition & 0 deletions tmpl/docs/installation.rst.j2
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Preparation
-----------

To install {{ project_name }} you need a miniconda installation. You can either set up your miniconda installation manually or use the script `tools/setup_miniconda.sh`, which will download and install the latest version of miniconda.
Make sure to execute the script (do not source it as this can lead to issues)!


Installation of dependencies
Expand Down
15 changes: 13 additions & 2 deletions tmpl/pyproject.toml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -155,5 +155,16 @@ ignore_directives = [
]

[tool.codespell]
ignore-words-list = "inout"
skip = "requirements/*"
ignore-regex = '(\b[A-Z]+\b|.*([#!"]|<!--) *codespell-ignore\b|^ *"image/[a-z]+": ".*",$)'
# - Ignore all-uppercase words (acronyms)
# - Ignore lines with codespell-ignore comment
# - Ignore lines "image/...": "..." (images in *.ipynb files)
ignore-words = './codespell_ignored_words.txt'
# Note: To skip local files by their full path, codespell (v2.2.2) requires
# './src/...` when called from the command line but 'src/...' when called via
# pre-commit (as local hook); '*src/...` matches both
skip = """\
.git,\
*.codespell-ignore.*,\
*requirements/*,\
"""
1 change: 0 additions & 1 deletion tmpl/requirements/environment.yml.j2
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
name: {{ project_slug }}
channels:
- conda-forge
- defaults
dependencies:
- _libgcc_mutex=0.1
- _openmp_mutex=4.5
Expand Down
5 changes: 5 additions & 0 deletions tmpl/tools/setup_env.sh.j2
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
# Create conda environment with pinned or unpinned requirements


if [[ "${BASH_SOURCE[0]}" != "${0}" ]]; then
echo "Please simply call the script instead of sourcing it!"
return
fi

if [[ "${BASH_SOURCE[0]}" != "${0}" ]]; then
echo "Please simply call the script instead of sourcing it!"
return
Expand Down
5 changes: 5 additions & 0 deletions tmpl/tools/setup_miniconda.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
# Install miniconda if necessary


if [[ "${BASH_SOURCE[0]}" != "${0}" ]]; then
echo "Please simply call the script instead of sourcing it!"
return
fi

if [[ "${BASH_SOURCE[0]}" != "${0}" ]]; then
echo "Please simply call the script instead of sourcing it!"
return
Expand Down
2 changes: 1 addition & 1 deletion tools/update_env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ main()
if [[ -d "${tmpdir}" ]]; then
\rm -rfv "${tmpdir}" || return
fi
copier -f --vcs-ref=HEAD . "${tmpdir}" || return
copier copy -f --vcs-ref=HEAD . "${tmpdir}" || return

# Use script in project to update the root environment file
local env_name
Expand Down
2 changes: 1 addition & 1 deletion tools/update_tmpl_env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ main()
if [[ -d "${tmpdir}" ]]; then
\rm -rfv "${tmpdir}" || return
fi
copier -f --vcs-ref=HEAD . "${tmpdir}" || return
copier copy -f --vcs-ref=HEAD . "${tmpdir}" || return

# Update the project's environment file
\cd "${tmpdir}" || return
Expand Down