Yet Another Python Copier template for a Python modules and applications focussing on data science, processing and analysis.
-
In your python environment, install the required packages first. A list is provided in
requirements.txt:pip install -r requirements.txt -
The create a new project scaffolding in the to-be-created directory
my-test-project, run:copier copy yapy-copier-template my-test-project -
Finally, init version control in that directory:
cd my-test-project git init git add -A git commit -m "initial import" -
Optionally, set the remote of the repository to a server where you created this respective project and push the changes up to now:
git remote add <URL of the repository> git push origin --set-upstream main
For the target repository where this template was applied on, first create an empty gh-pages branch for publishing. This is how to make an orphan branch with no history and no files initially:
-
Create the orphan
gh-pagesbranch (a new root branch with no commit history):git switch --orphan gh-pages -
Remove all tracked files from the staging area and working directory:
git rm --cached -r . git clean -fd -
Create an initial empty commit (or add minimal files like an empty
index.html):git commit --allow-empty -m "Initial empty gh-pages commit" -
Push the new branch to GitHub and set it as the upstream branch:
git push -u origin gh-pages
This creates a clean, empty gh-pages branch that you can later add your static site files to for GitHub Pages publishing.
git switch --orphan gh-pages
git rm --cached -r .
git clean -fd
git commit --allow-empty -m "Initial empty gh-pages commit"
git push -u origin gh-pages
After this, on your GitHub repository under Settings -> Pages, choose the gh-pages branch as the source to enable publishing.
This method ensures your gh-pages branch is completely separate and empty initially, good for publishing static content without mixing with your main codebase.
The publish job of the GitHub Action Workflows which come with this template will attempt to upload built packages to PyPI or TestPyPi, depending on your choice in the questionaire.
For this to succeed, you will need to create an account on the respective platform and add a new *For this to succeed, you will need to create an account on the respective platform and add a new Trusted Publisher via Your Account -> Publishing. It needs to know the
- PyPI Project Name, lower case name without spaces, dashes instead of underscore
- Repository Owner, user or organization where the repo is hosted, `repo_userorg` in `.copier-answers.yml`
- Repository name, asked for in the questionaire: `repo_name` in `.copier-answers.yml`
- Workflow name, here it'll be the top-most workflow file `ci-cd.yml`