Skip to content

Commit

Permalink
perf(template): Improving the git workflow for the template (#162)
Browse files Browse the repository at this point in the history
* Editing `prepare_git` function in `src/scicookie/hooks/post_gen_project.py`.
* Editing files in `src/scicookie/{{cookiecutter.project_slug}}/.github/workflows/`
* Fix an unnecessary space.
* Adding virtualenv workflow
* Updating guide.md
  • Loading branch information
Anavelyz authored Oct 30, 2023
1 parent a035fe3 commit 7ab065e
Show file tree
Hide file tree
Showing 8 changed files with 84 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,5 @@ Copy and paste this template for your review's note:
- [ ] I managed to reproduce the problem locally from the `main` branch
- [ ] I managed to test the new changes locally
- [ ] I confirm that the issues mentioned were fixed/resolved .
- [ ] I confirm that the issues mentioned were fixed/resolved
```
19 changes: 12 additions & 7 deletions docs/guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ The structure of the guide is as follows:
- [Command-line interfaces (CLIs)](#command-line-interfaces-clis)
- [Documentation engine](#documentation-engine)
- [Project tools](#project-tools)
- [Virtual Environment](#virtual-environment)
- [Virtual environment](#virtual-environment)
- [Code formatter](#code-formatter)
- [Code Security Vulnerabilities](#code-security-vulnerabilities)
- [Code security vulnerabilities](#code-security-vulnerabilities)
- [Code coverage testing](#code-coverage-testing)
- [Code style and logic (code quality)](#code-style-and-logic-code-quality)
- [Testing framework](#testing-framework)
Expand All @@ -29,7 +29,7 @@ The structure of the guide is as follows:
- [Code of conduct](#code-of-conduct)
- [Governance document](#governance-document)
- [Roadmap document](#roadmap-document)
- [Control Version](#control-version)
- [Version control](#version-control)

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

Expand Down Expand Up @@ -449,7 +449,7 @@ errors and vulnerabilities in your code, and much more.

The tools are described below according to their functionality.

### Virtual Environment
### Virtual environment

When working with Python, you should always have a virtual environment.
This is an isolated space where you can install and run applications and
Expand All @@ -473,6 +473,11 @@ community.
is a good option. It is included in all versions of Anaconda and
Miniconda.

If you select this option, a conda folder will appear in the project
directory, containing a dev.yaml file that you can use to manage the
development project's dependencies. If you do not select this option, a
requirements.txt will be added for you to manage with virtualenv.

### Code formatter

A code formatter is a tool that automatically reformats code to conform to a set
Expand Down Expand Up @@ -510,7 +515,7 @@ process will be stopped.
Using code formatters such as *Black* or *Blue* in your project helps ensure
consistent and readable code, making it easier to maintain and collaborate on.

### Code Security Vulnerabilities
### Code security vulnerabilities

The code security vulnerabilities are errors or weaknesses in code that can be
exploited by attackers to gain unauthorized access, steal data, or cause damage
Expand Down Expand Up @@ -769,7 +774,7 @@ In case you do not want to include DevOps in your project, you can do so
by selecting the option `None` (this is the default option).


## Automation Tools
## Automation tools

An automation tool is software or a platform designed to automate repetitive
tasks, processes, or workflows that are traditionally performed manually.
Expand Down Expand Up @@ -896,7 +901,7 @@ Ignite Roadmap, click [here](https://github.com/pytorch/ignite/wiki/Roadmap).
In case you do not want to include this file in your project, you can do so by
selecting the option `None` (this is the default option).

## Control Version
## Version control

Version control is essential for any project because it enables us to track and
store all versions and changes made to our codebase. With this in mind, we have
Expand Down
6 changes: 5 additions & 1 deletion src/scicookie/hooks/post_gen_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,11 @@ def clean_up_code_of_conduct():

def clean_up_conda():
if not USE_CONDA:
remove_dir("conda")
shutil.move(PROJECT_DIRECTORY / "virtualenvs" / "pyenv" / "requirements.txt", PROJECT_DIRECTORY)
remove_dir("virtualenvs")
else:
shutil.move(PROJECT_DIRECTORY / "virtualenvs" / "conda", PROJECT_DIRECTORY)
remove_dir("virtualenvs")


def clean_up_governance():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,5 @@ Copy and paste this template for your review's note:
- [ ] I managed to reproduce the problem locally from the `main` branch
- [ ] I managed to test the new changes locally
- [ ] I confirm that the issues mentioned were fixed/resolved .
- [ ] I confirm that the issues mentioned were fixed/resolved
```
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ jobs:

steps:
- uses: actions/checkout@v3
{% if cookiecutter.use_conda == "yes" %}
- uses: conda-incubator/setup-miniconda@v2
with:
miniconda-version: "latest"
Expand All @@ -26,6 +27,18 @@ jobs:
activate-environment: {{ cookiecutter.project_slug }}
use-mamba: true
miniforge-variant: Mambaforge
{% else %}

- uses: actions/checkout@v3
with:
python-version : "pypy3.9"

- name: Create virtual environment
run: source {{ cookiecutter.project_slug }}/bin/activate

- name: Install build-system
run: pip install -r requests.txt
{%- endif %}

- name: Install dependencies
run: |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ jobs:

steps:
- uses: actions/checkout@v3
{% if cookiecutter.use_conda == "yes" %}

- uses: conda-incubator/setup-miniconda@v2
with:
Expand All @@ -35,6 +36,20 @@ jobs:
activate-environment: {{ cookiecutter.project_slug }}
use-mamba: true
miniforge-variant: Mambaforge
{% else %}
- uses: actions/setup-python@v4
with:
python-version: "pypy3.9"

- name: Create virtual environment
run: python -m venv {{ cookiecutter.project_slug }}

- name: Activate virtual environment
run: source {{ cookiecutter.project_slug }}/bin/activate

- name: Install build-system
run: pip install -r requests.txt
{% endif %}

- name: Install deps
run: |
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
python < 3.11
{%- if cookiecutter.build_system == "poetry" %}
poetry
{%- elif cookiecutter.build_system == "flit" %}
flit
{%- elif cookiecutter.build_system == "mesonpy" %}
meson-python
{%- elif cookiecutter.build_system == "setuptools" %}
setuptools
build
{%- elif cookiecutter.build_system == "pdm" %}
pdm
{%- elif cookiecutter.build_system == "hatch" %}
hatch
{%- elif cookiecutter.build_system == "maturin" %}
maturin
rust
{%- elif cookiecutter.build_system == "scikit-build-core" %}
scikit-build-core
cmake
{%- elif cookiecutter.build_system == "pybind11" %}
pybind11
cmake
{%- endif %}
nodejs # used by semantic-release
{%- if cookiecutter.use_shellcheck == "yes" %}
shellcheck
{%- endif %}
{%- if cookiecutter.documentation_engine == "sphinx" %}
pandoc
{%- endif %}
{%- if cookiecutter.use_mypy == "yes" %}
mypy
{%- endif %}
{%- if cookiecutter.use_make == "yes" %}
make
{%- endif %}

0 comments on commit 7ab065e

Please sign in to comment.