Skip to content

Commit

Permalink
fix: Fix issues with docs, makim/make, release, and CI (#182)
Browse files Browse the repository at this point in the history
- Implement properly the makim targets, including tests and documentation tasks
- Fix main CI workflow and the Release workflow
- Fix the semantic-release configuration
- Fix the some URLs in the GitHub ISSUES templates that was pointing to the repository
- Fix some configurations in the pyprojet.toml
- Add tests for the automation tools to CI
- Update cookiecutter.json and the base profile respect to makim and make
- Update some python pinning from 3.8 to 3.8.1
  • Loading branch information
xmnlab committed Aug 31, 2023
1 parent 0c5337e commit 12efe9a
Show file tree
Hide file tree
Showing 32 changed files with 345 additions and 157 deletions.
1 change: 1 addition & 0 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ jobs:
strategy:
matrix:
smoke_file:
- automation.sh
- auto-format-tools.sh
- build-systems.sh
- containers.sh
Expand Down
42 changes: 22 additions & 20 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,27 +1,29 @@
Copyright (c) Open Science Labs and individual contributors.
BSD License

Copyright (c) 2023, Open Science Labs
All rights reserved.

Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of Audrey Roy Greenfeld nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.

* Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from this
software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
OF THE POSSIBILITY OF SUCH DAMAGE.
25 changes: 13 additions & 12 deletions docs/guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ The structure of the guide is as follows:
- [Static analysis of shell scripts](#static-analysis-of-shell-scripts)
- [Pre-commit verification](#pre-commit-verification)
- [Integration with DevOps tools](#integration-with-devops-tools)
- [Automation tools](#automation-tools)
- [Project team](#project-team)
- [Code of conduct](#code-of-conduct)
- [Governance document](#governance-document)
Expand Down Expand Up @@ -189,7 +190,7 @@ two alternatives: *src* and *flat*.
subdirectories that represent different modules or packages. Each module or
package within the "src" directory focuses on a specific aspect of the
project's functionality.

For example, a project following the src structure might have the following
layout:

Expand All @@ -215,7 +216,7 @@ two alternatives: *src* and *flat*.
code files directly in the project's root directory without any
subdirectories. This means that all modules and packages are at the same level
and there is no explicit separation between different aspects of the project.

Here's an example of a flat structure:

```python
Expand Down Expand Up @@ -305,7 +306,7 @@ packages. SciCookie support the following:
PEP 517 compilation backend, PEP 621 project metadata, a flexible and
powerful plugin system. It also offers, among other things, versatile
user scripting, PyPI integration and version management.

- [**Hatch**](https://hatch.pypa.io): It's a PEP 517/PEP 660 compatible
build backend used by Hatch, a modern, extensible Python project manager.
It provides a standardized build system with reproducible builds by default,
Expand Down Expand Up @@ -333,7 +334,7 @@ packages. SciCookie support the following:
cross-compilation, and efficient dependency locating with their associated
build requirements. With its capabilities, it facilitates cross-platform
builds using CMake and effortless integration with C/C++ libraries, making
it a valuable asset for research software engineers.
it a valuable asset for research software engineers.

- [**setuptools + pybind11**](https://pybind11.readthedocs.io/en/stable/): It's build system designed
for C++ library that simplifies the creation of Python bindings for C++ code,
Expand All @@ -346,8 +347,8 @@ packages. SciCookie support the following:
support have made it a popular choice for projects requiring seamless interoperability
between C++ and Python, ranging from scientific computing to game development and
automation. Staying up-to-date with the latest pybind11 documentation ensures the
best practices are followed.
best practices are followed.

The idea behind the options in SciCookie is that you can choose from some of the
most popular system compilers to suit your needs and preferences for developing
Python packages. If you think we should add more options, you can submit your
Expand Down Expand Up @@ -770,18 +771,18 @@ by selecting the option `None` (this is the default option).

## Automation Tools

An automation tool is software or a platform designed to automate repetitive
An automation tool is software or a platform designed to automate repetitive
tasks, processes, or workflows that are traditionally performed manually.
These tools are used to streamline and optimize various operations, reduce
These tools are used to streamline and optimize various operations, reduce
human intervention, increase efficiency, and minimize errors.
Currently SciCookie is using `make` and `Makim`
Currently, SciCookie allows you to use `Make` and/or `Makim`.

- [Makim](https://osl-incubator.github.io/makim): MakIm is an innovative tool
inspired by Make, designed to simplify target and dependency definition
- [Makim](https://osl-incubator.github.io/makim): Makim is an innovative tool
inspired by make, designed to simplify target and dependency definition
through YAML format. It introduces advanced features such as conditionals,
arguments, and dependencies with targeted parameters. It also facilitates
organized grouping of targets and supports user-defined variables and environment
variables. MakIm empowers users to streamline documentation and parameterize
variables. Makim empowers users to streamline documentation and parameterize
targets effectively. This free and open-source tool offers improved target
management while maintaining compatibility with familiar YAML syntax.

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ include = [
"scicookie" = "scicookie.__main__:app"

[tool.poetry.dependencies]
python = "^3.8.1"
python = ">=3.8.1,<4"
cookieninja = "1.0.0"
sh = "^2.0.4"
colorama = "^0.4.6"
Expand Down
6 changes: 2 additions & 4 deletions src/scicookie/cookiecutter.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,6 @@
"sphinx",
"jupyter-book"
],
"automation_tools": [
"Makim",
"Make"
],
"documentation_url": "{{ cookiecutter.project_url }}",
"code_of_conduct": [
"None",
Expand Down Expand Up @@ -63,6 +59,8 @@
"use_black": "yes",
"use_blue": "no",
"use_conda": "yes",
"use_makim": "yes",
"use_make": "no",
"use_containers": [
"None",
"Docker",
Expand Down
12 changes: 11 additions & 1 deletion src/scicookie/hooks/post_gen_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
USE_CONTAINERS = {{ cookiecutter.use_containers in ['Docker', 'Podman'] }}
USE_CLI = {{ cookiecutter.command_line_interface != "No command-line interface" }}
USE_CONDA = {{ cookiecutter.use_conda == "yes" }}
USE_MAKE = {{ cookiecutter.use_make == "yes" }}
USE_MAKIM = {{ cookiecutter.use_makim == "yes" }}
USE_MYPY = {{ cookiecutter.use_mypy == "yes" }}
{% if cookiecutter.code_of_conduct == "contributor-covenant" -%}
COC_PATH = PROJECT_DIRECTORY / 'coc' / 'CONTRIBUTOR_COVENANT.md'
Expand Down Expand Up @@ -106,6 +108,13 @@ def move_selected_doc_dir():
shutil.rmtree(DOCS_SPEC_DIR)


def clean_up_automation():
if not USE_MAKE:
remove_project_file("Makefile")

if not USE_MAKIM:
remove_project_file(".makim.yaml")

def clean_up_docs():
remove_dirs(UNUSED_DOCS_DIRS)
move_selected_doc_dir()
Expand Down Expand Up @@ -231,7 +240,7 @@ def clean_up_build_system():
shutil.move(
build_system_dir / "setup.py",
PROJECT_DIRECTORY / 'setup.py'
)
)
else:
shutil.move(
build_system_dir / "base-pyproject.toml",
Expand Down Expand Up @@ -329,6 +338,7 @@ def post_gen():
# keep this one first, because it changes the package folder
clean_up_project_layout()
add_binding_source_files()
clean_up_automation()
clean_up_cli()
clean_up_mypy()
clean_up_code_of_conduct()
Expand Down
2 changes: 2 additions & 0 deletions src/scicookie/profiles/base.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,8 @@ use_tools:
- flake8
- ruff
- isort
- make
- makim
- mccabe
- mypy
- pre-commit
Expand Down
8 changes: 6 additions & 2 deletions src/scicookie/{{cookiecutter.project_slug}}/.editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,22 @@ root = true

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

[*.py]
indent_style = space
indent_size = 4

[*.bat]
indent_style = tab
end_of_line = crlf

[LICENSE]
insert_final_newline = false
insert_final_newline = true

[Makefile]
indent_style = tab

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
{%- if not cookiecutter.git_https_upstream -%}
{% set github_url = cookiecutter.git_https_upstream -%}
{%- elif not cookiecutter.git_https_origin -%}
{% set github_url = cookiecutter.git_https_origin -%}
{%- else -%}
{% set github_url = "https://github.com/" + cookiecutter.project_name + "/" + cookiecutter.project_name -%}
{%- endif -%}
---
name: 🐛 Bug Report
description: Create a report to help us improve
Expand All @@ -15,7 +22,7 @@ body:
GitHub][issue search].
[issue search]: https://github.com/{{ cookiecutter.project_name }}/issues?q=is%3Aopen+is%3Aissue+label%3Abug
[issue search]: {{ github_url }}/issues?q=is%3Aopen+is%3Aissue+label%3Abug
- type: textarea
attributes:
Expand Down Expand Up @@ -141,7 +148,7 @@ body:
description: |
Read the [`{{ cookiecutter.project_name }}` Code of Conduct][CoC] first.
[CoC]: https://github.com/{{cookiecutter.project_slug}}/coc/CODE_OF_CONDUCT.md
[CoC]: {{ github_url }}/coc/CODE_OF_CONDUCT.md
options:
- label: I agree to follow the Code of Conduct
required: true
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,22 @@
{%- if not cookiecutter.git_https_upstream -%}
{% set github_url = cookiecutter.git_https_upstream -%}
{%- elif not cookiecutter.git_https_origin -%}
{% set github_url = cookiecutter.git_https_origin -%}
{%- else -%}
{% set github_url = "https://github.com/" + cookiecutter.project_name + "/" + cookiecutter.project_name -%}
{%- endif -%}
# Ref: https://help.github.com/en/github/building-a-strong-community/configuring-issue-templates-for-your-repository#configuring-the-template-chooser
blank_issues_enabled: true
contact_links:
- name: 🙋 Usage Questions
url: https://github.com/{{cookiecutter.project_slug}}/discussions
url: {{ github_url }}/discussions
about: |
Use {{ cookiecutter.project_name }}'s GitHub Discussions to ask "How do I do X with Cookiecutter?".
- name: 📖 Tutorial
url: https://github.com/{{cookiecutter.project_slug}}
url: {{ github_url }}
about: |
The {{ cookiecutter.project_name }} tutorial is continually updated and provides an in depth walkthrough
of how to use the latest release of Cookiecutter.
- name: 📝 {{ cookiecutter.project_name }} Code of Conduct
url: https://github.com/{{cookiecutter.project_slug}}/coc/CODE_OF_CONDUCT.md
url: {{ github_url }}/coc/CODE_OF_CONDUCT.md
about: Expectations for how people will interact with each other on Cookiecutter's GitHub.
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
{%- if not cookiecutter.git_https_upstream -%}
{% set github_url = cookiecutter.git_https_upstream -%}
{%- elif not cookiecutter.git_https_origin -%}
{% set github_url = cookiecutter.git_https_origin -%}
{%- else -%}
{% set github_url = "https://github.com/" + cookiecutter.project_name + "/" + cookiecutter.project_name -%}
{%- endif -%}
---
name: 📝 Documentation Report
description: Create a report for problems with the docs
Expand All @@ -15,7 +22,7 @@ body:
GitHub][issue search].
[issue search]: https://github.com/{{ cookiecutter.project_name }}/issues?q=is%3Aopen+is%3Aissue+label%3Adocs
[issue search]: {{ github_url }}/issues?q=is%3Aopen+is%3Aissue+label%3Adocs
- type: textarea
attributes:
Expand Down Expand Up @@ -45,7 +52,7 @@ body:
description: |
Read the [`{{ cookiecutter.project_name }}` Code of Conduct][CoC] first.
[CoC]: https://github.com/{{ cookiecutter.project_name }}/blob/main/CODE_OF_CONDUCT.md
[CoC]: {{ github_url }}/blob/main/CODE_OF_CONDUCT.md
options:
- label: I agree to follow the Code of Conduct
required: true
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
{%- if not cookiecutter.git_https_upstream -%}
{% set github_url = cookiecutter.git_https_upstream -%}
{%- elif not cookiecutter.git_https_origin -%}
{% set github_url = cookiecutter.git_https_origin -%}
{%- else -%}
{% set github_url = "https://github.com/" + cookiecutter.project_name + "/" + cookiecutter.project_name -%}
{%- endif -%}
---
name: ✨ Feature Request
description: Suggest an idea for this project
Expand All @@ -17,7 +24,7 @@ body:
already be implemented in a development release.
[issue search]: https://github.com/{{ cookiecutter.project_name }}/issues?q=is%3Aopen+is%3Aissue+label%3Afeat%2Fenhancement
[issue search]: {{ github_url }}/issues?q=is%3Aopen+is%3Aissue+label%3Afeat%2Fenhancement
- type: textarea
Expand Down Expand Up @@ -73,7 +80,7 @@ body:
description: |
Read the [`{{ cookiecutter.project_name }}` Code of Conduct][CoC] first.
[CoC]: https://github.com/{{cookiecutter.project_slug}}/coc/CODE_OF_CONDUCT.md
[CoC]: {{ github_url }}/coc/CODE_OF_CONDUCT.md
options:
- label: I agree to follow the Code of Conduct
required: true
Expand Down
Loading

0 comments on commit 12efe9a

Please sign in to comment.