Skip to content

Commit

Permalink
fix: Split build system config by tools, fix typos, and fix the `defa…
Browse files Browse the repository at this point in the history
…ult` attribute in profile (#323)

- split build system config by tools
- fix the creation of .github folder
- fix the usage of the attribute `default` in the profile yaml file
- fix typo `continuos` to `continuous`
- create an alias for check_schema.py command in the ci.sh
- fix compose.yaml content structure
- improve configuration .editorconfig
- update makim to 1.19.0
  • Loading branch information
xmnlab authored Oct 27, 2024
1 parent 8a058f6 commit 010a0dd
Show file tree
Hide file tree
Showing 35 changed files with 542 additions and 530 deletions.
24 changes: 13 additions & 11 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,27 @@
root = true

[*]
indent_style = space
indent_size = 2
trim_trailing_whitespace = true
insert_final_newline = true
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

[*.py]
[*.{py,rst,ini}]
indent_style = space
indent_size = 4

[*.bat]
indent_style = tab
end_of_line = crlf
[*.{html,css,scss,json,yml,xml}]
indent_style = space
indent_size = 2

[LICENSE]
insert_final_newline = true
[*.md]
trim_trailing_whitespace = false

[default.conf]
indent_style = space
indent_size = 2

[Makefile]
["Makefile"]
indent_style = tab

[*.{diff,patch}]
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ jobs:
- name: Run tests
if: ${{ matrix.os != 'windows' }}
run: makim tests.unittest
run: makim tests.unit

- name: Run tests
if: ${{ matrix.os == 'windows' }}
Expand Down
34 changes: 18 additions & 16 deletions .makim.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
version: 1.0
groups:
clean:
tasks:
tmp:
help: Clean unnecessary temporary files
shell: bash
backend: bash
run: |
rm -fr build/
rm -fr dist/
Expand Down Expand Up @@ -59,23 +58,26 @@ groups:
help: Run linter tools
run: pre-commit run --all-files --verbose

unittest:
unit:
help: Run tests
run: pytest -s -vv --template src/scicookie tests

smoke:
help: Run smoke tests
matrix:
script:
- auto-format-tools.sh
- build-systems.sh
- ci.sh
- cli.sh
- containers.sh
- docs-jupyter-book.sh
- docs-mkdocs.sh
- docs-quarto.sh
- docs-sphinx.sh
- files.sh
- linters.sh
- tests.sh
- virtual-envs.sh
run: |
./tests/smoke/auto-format-tools.sh
./tests/smoke/build-systems.sh
./tests/smoke/ci.sh
./tests/smoke/cli.sh
./tests/smoke/containers.sh
./tests/smoke/docs-jupyter-book.sh
./tests/smoke/docs-mkdocs.sh
./tests/smoke/docs-quarto.sh
./tests/smoke/docs-sphinx.sh
./tests/smoke/files.sh
./tests/smoke/linters.sh
./tests/smoke/tests.sh
./tests/smoke/virtual-envs.sh
./tests/smoke/${{ matrix.script }}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ For testing your changes locally, you can run:

```bash
makim tests.lint
makim tests.unittest
makim tests.unit
makim tests.smoke
```

Expand Down
2 changes: 1 addition & 1 deletion conda/dev-win.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ dependencies:
- compilers
- pip
- pip:
- makim==1.18.1
- makim==1.19.0
- paginate
2 changes: 1 addition & 1 deletion conda/dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ dependencies:
- compilers
- pip
- pip:
- makim==1.18.1
- makim==1.19.0
- paginate==0.5.6
2 changes: 1 addition & 1 deletion docs/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ environment:
or

```bash
$ makim tests.unittest
$ makim tests.unit
```

9. **Commit and Push Changes**: Stage, commit, and push your changes to GitHub.
Expand Down
4 changes: 2 additions & 2 deletions docs/guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ The structure of the guide is as follows:
- [Governance document](#governance-document)
- [Roadmap document](#roadmap-document)
- [Version control](#version-control)
- [Continuos Integration](#continuos-integration)
- [Continuous Integration](#continuous-integration)

## Notes about the text-based user interface (TUI)

Expand Down Expand Up @@ -973,7 +973,7 @@ GitHub and take advantage of its powerful version control features. These
functionalities in SciCookie make it easy to manage your project and collaborate
with others, while ensuring that your code is properly versioned and tracked.

## Continuos integration
## Continuous integration

Continuous Integration (CI) is a development practice where code changes are
frequently merged into a shared repository. Each change is automatically built
Expand Down
2 changes: 1 addition & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ For testing your changes locally, you can run:

```bash
makim tests.lint
makim tests.unittest
makim tests.unit
makim tests.smoke
```

Expand Down
2 changes: 1 addition & 1 deletion docs/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ environment:
or

```bash
$ makim tests.unittest
$ makim tests.unit
```

- **Commit and Push Changes**: Stage, commit, and push your changes to GitHub.
Expand Down
726 changes: 360 additions & 366 deletions poetry.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ mkdocs-material = ">=8.3.9"
mkdocstrings-python = ">=0.7.1"
mkdocstrings-python-legacy = ">=0.2.3"
pymdown-extensions = ">=9.5"
makim = "1.15.1"
makim = "1.19.0"
pexpect = ">=4.9.0"
ensureconda = ">=1.4"

Expand Down
9 changes: 8 additions & 1 deletion src/scicookie/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,11 @@ def call_cookiecutter(profile: Profile, answers: dict) -> None:
answers_profile[question_id] = answer
continue

for choice in answer:
answer_clean: list[str] = (
answer if isinstance(answer, list) else [answer]
)

for choice in answer_clean:
choice_id = f"use_{choice.replace('-', '_')}"
answers_profile[choice_id] = "yes"

Expand All @@ -107,6 +111,9 @@ def call_cookiecutter(profile: Profile, answers: dict) -> None:
new_path: list[str] = [*pipx_path, os.getenv("PATH", "")]
os.environ["PATH"] = env_path_sep.join(new_path)

# TODO: print answers with --verbose
# print(answers_profile)

cookiecutter(
str(PACKAGE_PATH), no_input=True, extra_context=answers_profile
)
Expand Down
2 changes: 1 addition & 1 deletion src/scicookie/profiles/base.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ git_main_branch:
default: main
visible: true

continuos_integration:
continuous_integration:
message: Select one option for Continuous Integration
help: "For more information, check:\n https://osl-incubator.github.io/scicookie/guide/#continuous-integration"
type: multiple-choices
Expand Down
3 changes: 2 additions & 1 deletion src/scicookie/profiles/osl.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,8 @@ git_https_upstream:
git_main_branch:
visible: true

continuos_integration:
continuous_integration:
default: github_actions
choices:
- github_actions
visible: false
29 changes: 19 additions & 10 deletions src/scicookie/{{cookiecutter.project_slug}}/.editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,32 @@
root = true

[*]
indent_style = space
indent_size = 2
trim_trailing_whitespace = true
insert_final_newline = true
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

[*.py]
[*.{py,rst,ini}]
indent_style = space
indent_size = 4

[*.bat]
[*.{html,css,scss,json,yml,xml}]
indent_style = space
indent_size = 2

[*.md]
trim_trailing_whitespace = false

[default.conf]
indent_style = space
indent_size = 2

["Makefile"]
indent_style = tab
end_of_line = crlf

[LICENSE]
insert_final_newline = true
[*.{diff,patch}]
trim_trailing_whitespace = false

[Makefile]
[*.bat]
indent_style = tab
end_of_line = crlf
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
shell: bash -l {0}

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
{%- endraw %}
{% if cookiecutter.use_conda == "yes" %}
- name: Cache Conda Packages
Expand All @@ -61,7 +61,7 @@ jobs:
auto-update-conda: true
conda-solver: libmamba
{% else %}
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "pypy3.9"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
shell: bash -l {0}

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
{% if cookiecutter.use_conda == "yes" %}
- uses: conda-incubator/setup-miniconda@v3
with:
Expand Down
14 changes: 8 additions & 6 deletions src/scicookie/{{cookiecutter.project_slug}}/.makim.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
{%- else -%}
{%- set package_path = cookiecutter.package_slug -%}
{%- endif -%}
version: 1.0
groups:
clean:
tasks:
all:
help: Clean unnecessary temporary files
backend: bash
run: |
rm -fr build/
rm -fr dist/
Expand Down Expand Up @@ -46,8 +46,9 @@ groups:
preview:
help: Preview documentation page locally
dependencies:
- task: docs.build
hooks:
pre-run:
- task: docs.build
run: |
{%- if cookiecutter.documentation_engine == "jupyter-book" %}
cd docs/_build/html/ && python -m http.server
Expand Down Expand Up @@ -90,9 +91,10 @@ groups:
ci:
help: run the sames tests executed on CI
dependencies:
- task: tests.unit
- task: tests.linter
hooks:
pre-run:
- task: tests.unit
- task: tests.linter

package:
tasks:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
{%- set package_path = cookiecutter.package_slug -%}
{%- endif -%}
default_stages:
- commit
- pre-commit
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.1.0
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{%- if cookiecutter.use_bandit == "yes" %}
[tool.bandit]
exclude_dirs = ["tests"]
targets = "./"
{% endif -%}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{%- if cookiecutter.use_black == "yes" %}
[tool.black]
line-length = 79
target-version = ["py39"]
force-exclude = '''(?x)(
docs/*
| .*\\.egg-info
)''' # TOML's single-quoted strings do not require escaping backslashes
{% endif -%}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{%- if cookiecutter.use_isort == "yes" %}
[tool.isort]
ensure_newline_before_comments = true
line_length = 79
multi_line_output = 3
include_trailing_comma = true
skip_glob = ["docs/*", "*.egg-info"]
{% endif -%}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{%- if cookiecutter.use_mypy == "yes" %}
[tool.mypy]
python_version = "3.9"
check_untyped_defs = true
strict = true
ignore_missing_imports = true
warn_unused_ignores = true
warn_redundant_casts = true
warn_unused_configs = true
exclude = ["scripts/"]
{% endif -%}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{%- if cookiecutter.use_pytest == "yes" %}
[tool.pytest.ini_options]
testpaths = [
"tests",
]
{% endif -%}
Loading

0 comments on commit 010a0dd

Please sign in to comment.