Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch to copier template #85

Merged
merged 61 commits into from
Jan 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
88cdbce
Basic clean up and write TODO's
znicholls Jan 9, 2024
00519fe
Keep cleaning up
znicholls Jan 9, 2024
dcfe6fa
Add gitkeep etc
znicholls Jan 9, 2024
f9a7931
Start fixing test errors
znicholls Jan 9, 2024
baa8d68
Clean up TODOs
znicholls Jan 9, 2024
1bb72d8
CHANGELOG
znicholls Jan 9, 2024
b2cb33a
Switch over README
znicholls Jan 9, 2024
ab3e5d1
Change CHANGELOG
znicholls Jan 14, 2024
c8f64b6
Convert docs from rst to md
znicholls Jan 14, 2024
b3f5543
Start converting notebooks
znicholls Jan 14, 2024
0e18313
Realise that ciceroscmpy requires pandas<2
znicholls Jan 18, 2024
3d533db
Convert notebooks to .py
znicholls Jan 18, 2024
861c90c
Try updating CI
znicholls Jan 18, 2024
75fbb51
Try again
znicholls Jan 18, 2024
b4a3ce0
Check CICERO notebook
znicholls Jan 19, 2024
5442454
Fix up tests
znicholls Jan 19, 2024
076c572
Fix up CICERO tests
znicholls Jan 19, 2024
ef0e7f7
Fix linting errors
znicholls Jan 19, 2024
ea2eea8
Clean files
znicholls Jan 19, 2024
1c06dbe
Make mypy failure optional
znicholls Jan 19, 2024
3719b4f
Drop code coverage
znicholls Jan 19, 2024
5cb8477
Update caching
znicholls Jan 19, 2024
26e176c
More CI trickery
znicholls Jan 19, 2024
799fa3c
More windows jumping
znicholls Jan 19, 2024
704531b
Fix packaging
znicholls Jan 19, 2024
159b517
Next attempt
znicholls Jan 19, 2024
31e8bb5
Next attempt after reading https://github.com/snok/install-poetry\?ta…
znicholls Jan 19, 2024
7cf974d
Try to diagnose mac issues
znicholls Jan 19, 2024
b1700ca
Get more info
znicholls Jan 19, 2024
320c98a
Try wget on windows
znicholls Jan 19, 2024
b60e6f3
Drop MAGICC tests from windows, downloading in too hard basket for now
znicholls Jan 19, 2024
0991361
Fix up silly mistakes
znicholls Jan 19, 2024
b9004e8
Remove more unneeded lines
znicholls Jan 19, 2024
f7efaa4
Move to pyproject.toml alone
znicholls Jan 19, 2024
4d965e9
Try fixing up caching issue
znicholls Jan 19, 2024
594ea8b
Next fix
znicholls Jan 19, 2024
b1e9a45
Next attempt
znicholls Jan 19, 2024
20cbe4f
Try a different route
znicholls Jan 19, 2024
e320480
Add missing value
znicholls Jan 19, 2024
170e53d
Next wrong value
znicholls Jan 19, 2024
8c77eec
One more try
znicholls Jan 19, 2024
09efc6e
Next attempt
znicholls Jan 19, 2024
5fe6aac
Add MAGICC download to docs build
znicholls Jan 19, 2024
9d17082
Urgh windows
znicholls Jan 19, 2024
499dfa9
Fix up missing doc file
znicholls Jan 19, 2024
781bb2c
Clean out unnecessary step
znicholls Jan 19, 2024
2e04a2d
Try to set up better caching
znicholls Jan 19, 2024
d3704cd
See if we can get docs to build
znicholls Jan 19, 2024
b0b30e3
Extend docs build time for RtD
znicholls Jan 19, 2024
ecd820d
Fix up and condition
znicholls Jan 19, 2024
b72bba1
Fix RtD environment variable
znicholls Jan 19, 2024
812e491
Try RtD again
znicholls Jan 19, 2024
b896f99
Quote the link
znicholls Jan 19, 2024
3c0c277
Next RtD attempt
znicholls Jan 19, 2024
36df40a
Try different option
znicholls Jan 19, 2024
77ba91a
Update TODOs
znicholls Jan 19, 2024
fabb1b8
Tick off TODO
znicholls Jan 19, 2024
3ec8811
Move out TODOs
znicholls Jan 19, 2024
3c4e9a4
Allow mypyw failure
znicholls Jan 21, 2024
035fed5
Fix up workflow
znicholls Jan 21, 2024
363f801
Update pyproject.toml
znicholls Jan 22, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .copier-answers.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Changes here will be overwritten by Copier; NEVER EDIT MANUALLY
_commit: v0.4.1
_src_path: /Users/znicholls/Documents/repos/copier-core-python-repository
email: [email protected]
initial_setup: true
name: Zebedee Nicholls
notebook_dependencies: true
pandas_doctests: true
plot_dependencies: false
project_description_short: Thin wrapper to run emissions scenarios with simple climate
models
project_name_human: OpenSCM-Runner
project_name_pip: openscm-runner
project_name_python: openscm_runner
project_url: https://github.com/openscm/openscm-runner
41 changes: 41 additions & 0 deletions .github/ISSUE_TEMPLATE/bug.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
---
name: Bug report
about: Report a bug
title: ''
labels: bug
assignees: ''

---

## Describe the bug
<!--- A clear and concise description of what the bug is. -->

## Failing Test
<!---
Please put the code (ideally in the form of a unit test) which fails below.

e.g.

```python
def test_bug_12():
# Python code here which fails because of the bug
# This is best if other developers can simply copy and paste this test in
# order to run it
```
-->

## Expected behavior
<!--- A clear and concise description of what you expected to happen. -->

## Screenshots
<!--- If applicable, add screenshots to help explain your problem. -->

## System
<!--- Please complete the following information. -->

- OS: [e.g. Windows, Linux, macOS]
- Python version [e.g. Python 3.11]
- Please also upload your `poetry.lock` file (first run `poetry lock` to make sure the lock file is up-to-date)

## Additional context
<!--- Add any other context about the problem here. -->
30 changes: 0 additions & 30 deletions .github/ISSUE_TEMPLATE/bug_report.md

This file was deleted.

23 changes: 23 additions & 0 deletions .github/ISSUE_TEMPLATE/default.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
name: Default
about: Report an issue or problem
title: ''
labels: triage
assignees: ''
---

## The problem

<!--- Useful to breakdown to "As a [persona], I [want to do], so that [reason] -->

## Definition of "done"

<!---
What are the things that must be true in order to close this issue

We find that describing these as dot points works well.
-->

## Additional context

<!--- Add any additional context can go here -->
30 changes: 20 additions & 10 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,31 @@
---
name: Feature Request
about: Suggest an idea for this project

about: Request a feature or suggest an idea for this project
title: ''
labels: feature-request
assignees: ''
---

**Is your feature request related to a problem? Please describe.**
## The motivation

<!--- Useful to breakdown to "As a [persona], I [want to do], so that [reason] -->

## The proposed solution

A clear and concise description of what the problem is. E.g. It's annoying that I always have to [...]
<!---
If you'd like, please provide a description of the solution you would like to see

**Describe the solution you'd like**
If you don't have any ideas for the solution, simply leave this blank
-->

A clear and concise description of the solution you would like to see.
## Alternatives

**Describe alternatives you've considered**
<!---
If you've considered any alternatives, please describe them here

A clear and concise description of any alternative solutions or features you've considered.
If you don't have any alternatives, simply leave this blank
-->

**Additional context**
## Additional context

Add any other context or screenshots about the feature request here.
<!--- Add any additional context can go here -->
9 changes: 9 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE/default.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
## Description

## Checklist

Please confirm that this pull request has done the following:

- [ ] Tests added
- [ ] Documentation added (where applicable)
- [ ] Changelog item added to `changelog/`
61 changes: 61 additions & 0 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: "Setup Python and Poetry"
description: "setup Python and Poetry with caches"

inputs:
os:
description: "Operating system to use"
required: false
default: "ubuntu-latest"
python-version:
description: "Python version to use"
required: true
venv-id:
description: "ID to identify cached environment (should be unique from other steps)"
required: true
poetry-dependency-install-flags:
description: "Flags to pass to poetry when running `poetry install --no-interaction --no-root`"
required: true
run-poetry-install:
description: "Should we run the poetry install steps"
required: false
default: true


runs:
using: "composite"
steps:
- name: Install poetry
shell: bash
run: |
pipx install poetry
which poetry
poetry --version # Check poetry installation
- name: Set up Python ${{ inputs.python-version }}
id: setup-python
uses: actions/setup-python@v5
with:
python-version: ${{ inputs.python-version }}
cache: poetry
- name: Set Poetry environment
shell: bash
run: |
# This line used to be needed, but seems to have been
# sorted with newer poetry versions. The check is whether
# the right version of python is shown below after running
# `poetry run which python` and whether the right version
# of python is used in the tests
# poetry env use "python${{ inputs.python-version }}"
poetry config virtualenvs.create true
poetry config virtualenvs.in-project true
- name: Install dependencies
if: ${{ (inputs.run-poetry-install == 'true') && (steps.setup-python.outputs.cache-hit != 'true') }}
shell: bash
run: |
poetry install --no-interaction --no-root ${{ inputs.poetry-dependency-install-flags }}
# Now run same command but let the package install too
- name: Install package
if: ${{ inputs.run-poetry-install == 'true' }}
shell: bash
run: |
poetry install --no-interaction ${{ inputs.poetry-dependency-install-flags }}
poetry run python --version # Check python version just in case
6 changes: 0 additions & 6 deletions .github/pull_request_template.md

This file was deleted.

7 changes: 7 additions & 0 deletions .github/release_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
## Announcements

* Announcement 1

## Changes

* Change 1
60 changes: 60 additions & 0 deletions .github/workflows/bump.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Bump version

on:
workflow_dispatch:
inputs:
bump_rule:
type: choice
description: How to bump the project's version (see https://python-poetry.org/docs/cli/#version)
options:
- patch
- minor
- major
- prepatch
- preminor
- premajor
- prerelease
required: true

jobs:
bump_version:
name: "Bump version and create changelog"
if: "!startsWith(github.event.head_commit.message, 'bump:')"
runs-on: ubuntu-latest
env:
CI_COMMIT_EMAIL: "[email protected]"
steps:
- name: Check out repository
uses: actions/checkout@v3
with:
fetch-depth: 0
token: "${{ secrets.PERSONAL_ACCESS_TOKEN }}"

# towncrier imports the package as part of building so we have to
# install the pacakage (to keep things slim, we only install the main
# dependencies, which also means that we get a test that we can import
# the package with only the compulsory dependencies installed for free)
- uses: ./.github/actions/setup
with:
python-version: "3.11"
venv-id: "bump"
poetry-dependency-install-flags: "--only main"

- name: Install towncrier
run: |
poetry run pip install towncrier

- name: Create bump and changelog

run: |
BASE_VERSION=`poetry version -s`
NEW_VERSION=`poetry version -s ${{ github.event.inputs.bump_rule }}`
poetry run towncrier build --yes --version v$NEW_VERSION

git config --global user.name "$GITHUB_ACTOR"
git config --global user.email "$CI_COMMIT_EMAIL"

git commit -a -m "bump: version $BASE_VERSION -> $NEW_VERSION"
git tag v$NEW_VERSION
git push && git push --tags
echo "Bumped to version $NEW_VERSION"
Loading