Skip to content

Commit

Permalink
chore: wire the repository to the copier pypackage (#20)
Browse files Browse the repository at this point in the history
  • Loading branch information
12rambau authored Feb 1, 2024
2 parents f56195f + 3074fdb commit 2a37095
Show file tree
Hide file tree
Showing 39 changed files with 474 additions and 341 deletions.
12 changes: 12 additions & 0 deletions .copier-answers.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Changes here will be overwritten by Copier
_commit: 0.1.5
_src_path: gh:12rambau/pypackage
author_email: alice.barthe@cern.ch
author_first_name: Alice
author_last_name: Barthe
author_orcid: 0000-0002-1766-188X
github_repo_name: qutree
github_user: alice4space
project_name: qutree
project_slug: qutree
short_description: plot Bloch Sphere Binary Tree
9 changes: 9 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"name": "Python 3",
"image": "mcr.microsoft.com/devcontainers/python:1-3.11-bullseye",
"features": {
"ghcr.io/devcontainers-contrib/features/nox:2": {},
"ghcr.io/devcontainers-contrib/features/pre-commit:2": {}
},
"postCreateCommand": "pre-commit install"
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
---
name: Pull request template
about: Create a pull request
title: ''
labels: ''
assignees: ''

title: ""
labels: ""
assignees: ""
---

## reference the related issue
Expand All @@ -21,4 +20,4 @@ Describe the changes you propose

## comments

any other comments we should pay attention to
any other comments we should pay attention to
22 changes: 4 additions & 18 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -1,38 +1,24 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''

title: ""
labels: ""
assignees: ""
---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:

1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

**Expected behavior**
A clear and concise description of what you expected to happen.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Desktop (please complete the following information):**
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]

**Smartphone (please complete the following information):**
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]

**Additional context**
Add any other context about the problem here.
10 changes: 0 additions & 10 deletions .github/ISSUE_TEMPLATE/custom.md

This file was deleted.

7 changes: 3 additions & 4 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''

title: ""
labels: ""
assignees: ""
---

**Is your feature request related to a problem? Please describe.**
Expand Down
52 changes: 52 additions & 0 deletions .github/workflows/pypackage_check.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: template update check

on:
workflow_dispatch:
schedule:
- cron: "0 0 1 * *" # Run at 00:00 on the first day of each month

jobs:
check_version:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: install dependencies
run: pip install requests
- name: get latest pypackage release
id: get_latest_release
run: |
RELEASE=$(curl -s https://api.github.com/repos/12rambau/pypackage/releases | jq -r '.[0].tag_name')
echo "latest=$RELEASE" >> $GITHUB_OUTPUT
echo "latest release: $RELEASE"
- name: get current pypackage version
id: get_current_version
run: |
RELEASE=$(yq -r "._commit" .copier-answers.yml)
echo "current=$RELEASE" >> $GITHUB_OUTPUT
echo "current release: $RELEASE"
- name: open issue
if: steps.get_current_version.outputs.current != steps.get_latest_release.outputs.latest
uses: rishabhgupta/git-action-issue@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
title: "Update template to ${{ steps.get_latest_release.outputs.latest }}"
body: |
The package is based on the ${{ steps.get_current_version.outputs.current }} version of [@12rambau/pypackage](https://github.com/12rambau/pypackage).
The latest version of the template is ${{ steps.get_latest_release.outputs.latest }}.
Please consider updating the template to the latest version to include all the latest developments.
Run the following code in your project directory to update the template:
```
copier update --trust --defaults --vcs-ref ${{ steps.get_latest_release.outputs.latest }}
```
> **Note**
> You may need to reinstall ``copier`` and ``jinja2-time`` if they are not available in your environment.
After solving the merging issues you can push back the changes to your main branch.
12 changes: 7 additions & 5 deletions .github/workflows/release.yml → .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,14 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine build
run: pip install twine build nox
- name: update citation date
run: nox -s release-date
- name: Build and publish
env:
TWINE_USERNAME: __token__
Expand Down
86 changes: 86 additions & 0 deletions .github/workflows/unit.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
name: Unit tests

on:
push:
branches:
- main
pull_request:

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.10"
- uses: pre-commit/action@v3.0.0

mypy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Install nox
run: pip install nox
- name: run mypy checks
run: nox -s mypy

docs:
needs: [lint, mypy]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Install nox
run: pip install nox
- name: build static docs
run: nox -s docs

build:
needs: [lint, mypy]
strategy:
fail-fast: true
matrix:
os: [ubuntu-latest]
python-version: ["3.8", "3.9", "3.10", "3.11"]
include:
- os: macos-latest # macos test
python-version: "3.11"
- os: windows-latest # windows test
python-version: "3.11"
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install nox
run: pip install nox
- name: test with pytest
run: nox -s test

coverage:
needs: [build]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Install deps
run: pip install nox
- name: test with pytest
run: nox -s test
- name: assess dead fixtures
run: nox -s dead-fixtures
- name: codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true
52 changes: 0 additions & 52 deletions .github/workflows/unit.yml

This file was deleted.

9 changes: 6 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ instance/

# Sphinx documentation
docs/_build/
docs/source/_api/
docs/api/

# PyBuilder
target/
Expand Down Expand Up @@ -130,5 +130,8 @@ dmypy.json
# Pyre type checker
.pyre/

# system IDE
.vscode/
# system IDE
.vscode/

# image tmp file
*Zone.Identifier
Loading

0 comments on commit 2a37095

Please sign in to comment.