This repository provides a structured approach to creating new repositories under the EasyScience organization using predefined templates. It ensures consistency and accelerates project setup.
First, decide which template you need. This repository provides four templates:
project
β A template for a project hub repository.project-lib
β A template for a Python library repository.project-app
β A template for a Qt QML desktop application repository.common
β A set of shared files used across multiple projects.
The templates-copier
repository has the following structure:
templates-copier/
βββ copier.yaml # Root copier config
βββ templates/
β βββ common/ # A set of shared files used across multiple projects
β β βββ .gitignore
β β βββ {{_copier_conf.answers_file}}.jinja
βββ projects/
β βββ project/ # A template for a project hub repository
β βββ project-app/ # A template for a Qt QML desktop application repository
β βββ project-lib/ # A template for a Python library repository
β β βββ {{_copier_conf.answers_file}}.jinja
β β βββ README.md.jinja
To create a new repository, follow these steps:
- Navigate to GitHub and select "Create New Repository".
- Repository template: No template (as we will use Copier templates instead of GitHub templates).
- Enter the repository name, for example,
superduper-lib
. - Add a description based on the EasyScience organization profile. If a suitable description isn't available, consider adding one to the organization profile first.
- Set the repository visibility to Public.
- Ensure not to initialize the repository with a README,
.gitignore
, or license file, as these will be handled by Copier. - Click "Create repository" to finalize the process.
This step is required only if you have not set up GitHub access before. Access to GitHub can be done using Personal Access Tokens (PATs):
- πΉ Step 1: Generate a Personal Access Token (PAT)
- Go to GitHub β Settings β Developer Settings β Personal Access Tokens
- π GitHub PAT Settings
- Click βGenerate new tokenβ.
- Select:
- β’ β repo β Full control of repositories.
- β’ β workflow β Access GitHub Actions (optional).
- Click βGenerate tokenβ and copy it.
Now, you can use PAT to interact with GitHub via:
- The terminal (recommended for advanced users).
- A GUI client like GitKraken (for an intuitive interface).
Once access to GitHub is set up, clone the repository to your local machine.
In the terminal-based approach, this can be done with:
git clone https://github.com/easyscience/superduper-lib.git
Alternatively, you can use a GUI client like GitKraken for a visual interface to manage the repository.
Copier is used to generate project files from predefined templates.
If you havenβt installed Copier, do so with:
pip install copier
To initialize the repository, run the following command:
copier copy gh:easyscience/templates-copier superduper-lib
This command will prompt you for:
βοΈ The type of template (project
, project-lib
, project-app
, common
)
βοΈ The name of the project (superduper-lib
), etc.
Since the repository requires both project-specific and common templates, execute the command twice:
-
Run Copier for the project template:
copier copy gh:easyscience/templates-copier superduper-lib
Select the
project-lib
template. -
Run Copier for common files:
copier copy gh:easyscience/templates-copier superduper-lib
Select the
common
template.
The answers provided during setup are stored in:
- Project-specific answers β
superduper-lib/.copier-answers_project-lib.yml
- Common template answers β
superduper-lib/.copier-answers_common.yml
After generating the project structure, push the changes to GitHub. You can do this via:
- The terminal:
Use your username for 'https://github.com' along with the personal access token (PAT) as the password.
cd superduper-lib git add -A git commit -m "Initial project setup using Copier templates" git push origin master
- A GUI client like GitKraken.
Some repository settings might need manual adjustment:
- Set up CI/CD workflows (if applicable).
- Add repository secrets (e.g., API keys, deployment keys).
- Configure repository settings (branch protection, access control).
When the templates in templates-copier are updated, apply those updates to your project.
Go to the project directory:
cd superduper-lib
Step 1: Update the Common Template
copier update --answers-file=.copier-answers_common.yml
Step 2: Update the Project-Specific Template
copier update --answers-file=.copier-answers_project-lib.yml
Push changes to the repository.
- If conflicts arise, Copier will prompt you to review them.
Step | Description |
---|---|
Step 1 | Create a repository and initialize it using Copier templates. |
Step 2 | Perform manual configuration for repository settings. |
Step 3 | Keep the repository updated with the latest template changes using copier update . |
This repository provides a structured approach to creating new repositories under the EasyScience organization by using predefined templates. It ensures consistency and accelerates project setup.
First, decide which template you need. This repository provides four templates:
project
β A template for a project hub repository.project-lib
β A template for a Python library repository.project-app
β A template for a Qt QML desktop application repository.common
β A set of shared files used across multiple projects.
So the templates-copier
repository has the following structure:
templates-copier/
βββ copier.yaml # Root copier config
βββ templates/
β βββ common/ # A set of **shared files** used across multiple projects
β β βββ .gitignore
β β βββ {{_copier_conf.answers_file}}.jinja
βββ projects/
β βββ project/ # A template for a **project hub repository**
β βββ project-app/ # A template for a **Qt QML desktop application repository**
β βββ project-lib/ # A template for a **Python library repository**
β β βββ {{_copier_conf.answers_file}}.jinja
β β βββ README.md.jinja
To create a new repository, follow these steps:
- Go to GitHub β Create New Repository.
- Enter the repository name, e.g.,
superduper-lib
. - Add description, based on the github easyscience organization profile (https://github.com/easyscience/.github/blob/master/profile/README.md). If the description is not available, add it there first.
- Select Public as the repository visibility.
- Do not initialize the repository with a README,
.gitignore
or license files (Copier will handle this). - Click "Create repository".
This step is required only if you have not set up GitHub access before. Access to GitHub can be done using Personal Access Tokens (PATs):
πΉ Step 1: Generate a Personal Access Token (PAT) 1. Go to GitHub β Settings β Developer Settings β Personal Access Tokens π GitHub PAT Settings 2. Click βGenerate new tokenβ. 3. Select: β’ β repo β Full control of repositories. β’ β workflow β Access GitHub Actions (optional). 4. Click βGenerate tokenβ and copy it.
Now, you can use PAT to interact with GitHub via:
- The terminal (recommended for advanced users).
- A GUI client like GitKraken (for an intuitive interface).
Once access to GitHub is set up, clone the repository to your local machine.
In the terminal-based approach, this can be done with:
git clone https://github.com/easyscience/superduper-lib.git
Alternatively, you can use a GUI client like GitKraken for a visual interface to manage the repository.
Copier is used to generate project files from predefined templates.
If you havenβt installed Copier, do so with:
pip install copier
To initialize the repository, run the following command:
copier copy gh:easyscience/templates-copier superduper-lib
This command will prompt you for:
βοΈ The type of template (project
, project-lib
, project-app
, common
)
βοΈ The name of the project (superduper-lib
), etc.
Since the repository requires both project-specific and common templates, execute the command twice:
-
Run Copier for the project template:
copier copy gh:easyscience/templates-copier superduper-lib
Select the
project-lib
template. -
Run Copier for common files:
copier copy gh:easyscience/templates-copier superduper-lib
Select the
common
template.
The answers provided during setup are stored in:
- Project-specific answers β
superduper-lib/.copier-answers_project-lib.yml
- Common template answers β
superduper-lib/.copier-answers_common.yml
After generating the project structure, push the changes to GitHub. You can do this via:
- The terminal:
git add -A git commit -m "Initial project setup using Copier templates" git push origin master
- A GUI client like GitKraken.
Some repository settings might need manual adjustment:
- Set up CI/CD workflows (if applicable).
- Add repository secrets (e.g., API keys, deployment keys).
- Configure repository settings (branch protection, access control).
When the templates in templates-copier are updated, apply those updates to your project.
cd superduper-lib
copier update
- This updates files while preserving your custom modifications.
- If conflicts arise, Copier will prompt you to review them.
Step | Description |
---|---|
Step 1 | Create a repository and initialize it using Copier templates. |
Step 2 | Perform manual configuration for repository settings. |
Step 3 | Keep the repository updated with the latest template changes using copier update . |