Skip to content

Commit

Permalink
Merge pull request #28 from hydrologie/use-cruft
Browse files Browse the repository at this point in the history
Use cruft and Ouranosinc/cookiecutter-pypackage
  • Loading branch information
sebastienlanglois authored Nov 30, 2023
2 parents aeebcb1 + 0457ad4 commit 39906ed
Show file tree
Hide file tree
Showing 66 changed files with 3,323 additions and 8,292 deletions.
1 change: 1 addition & 0 deletions .coveralls.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
service_name: github
28 changes: 28 additions & 0 deletions .cruft.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"template": "https://github.com/Ouranosinc/cookiecutter-pypackage",
"commit": "64eceda7d95aeb8937fa9961989d3d617a525c04",
"checkout": null,
"context": {
"cookiecutter": {
"full_name": "Sebastien Langlois",
"email": "[email protected]",
"github_username": "sebastienlanglois",
"project_name": "xdatasets",
"project_slug": "xdatasets",
"project_short_description": "Easy access to Earth observation datasets with xarray.",
"pypi_username": "sebastienlanglois",
"version": "0.3.0",
"use_pytest": "y",
"use_black": "y",
"use_conda": "y",
"add_pyup_badge": "n",
"make_docs": "y",
"command_line_interface": "No command-line interface",
"create_author_file": "y",
"open_source_license": "MIT license",
"generated_with_cruft": "y",
"_template": "https://github.com/Ouranosinc/cookiecutter-pypackage"
}
},
"directory": null
}
24 changes: 24 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# http://editorconfig.org

root = true

[*]
indent_style = space
indent_size = 4
trim_trailing_whitespace = true
insert_final_newline = true
charset = utf-8
end_of_line = lf

[*.{yaml,yml}]
indent_size = 2

[*.bat]
indent_style = tab
end_of_line = crlf

[LICENSE]
insert_final_newline = false

[Makefile]
indent_style = tab
30 changes: 30 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
[flake8]
exclude =
.eggs,
.git,
build,
docs,
tests
ignore =
AZ100,
AZ200,
AZ300,
C,
D,
E,
F,
W503
per-file-ignores =
rst-roles =
doc,
mod,
py:attr,
py:attribute,
py:class,
py:const,
py:data,
py:func,
py:meth,
py:mod,
py:obj,
py:ref
2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -113,4 +113,4 @@

# Jupyter Notebooks
# =================
*.ipynb text
*.ipynb text
15 changes: 15 additions & 0 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
* xdatasets version:
* Python version:
* Operating System:

### Description

Describe what you were trying to get done.
Tell us what happened, what went wrong, and what you expected to happen.

### What I Did

```
Paste the command(s) you ran and the output.
If there was a crash, please include the traceback here.
```
34 changes: 34 additions & 0 deletions .github/ISSUE_TEMPLATE/0001-GENERIC-ISSUE-TEMPLATE.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Generic issue template
description: For detailing generic/uncategorized issues in xdatasets

body:
- type: textarea
id: generic-issue
attributes:
label: Generic Issue
description: Please fill in the following information fields as needed.
value: |
* xdatasets version:
* Python version:
* Operating System:
### Description
<!--Describe what you were trying to get done.
Tell us what happened, what went wrong, and what you expected to happen.-->
### What I Did
<!--Paste the command(s) you ran and the output.
If there was a crash, please include the traceback below.-->
```
$ pip install foo --bar
```
### What I Received
<!--Paste the output or the stack trace of the problem you experienced here.-->
```
Traceback (most recent call last):
File "/path/to/file/script.py", line 3326, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "<ipython-input-2-9e1622b385b6>", line 1, in <module>
1/0
ZeroDivisionError: division by zero
44 changes: 44 additions & 0 deletions .github/ISSUE_TEMPLATE/0002-BUG-REPORT.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Bug report
description: Help us improve xdatasets
labels: [ "bug" ]

body:
- type: markdown
attributes:
value: |
Thanks for taking the time to fill out this bug report!
- type: textarea
id: setup-information
attributes:
label: Setup Information
description: |
What software versions are you running? Example:
- xdatasets version: 0.55.0-gamma
- Python version: 4.2
- Operating System: Nutmeg Linux 12.34 | macOS 11.0 "Redmond"
value: |
- xdatasets version:
- Python version:
- Operating System:
- type: textarea
id: description
attributes:
label: Description
description: Describe what you were trying to get done. Tell us what happened, what went wrong, and what you expected to happen.
- type: textarea
id: steps-to-reproduce
attributes:
label: Steps To Reproduce
description: Paste the command(s) you ran and the output. If there was a crash, please include the traceback below.
- type: textarea
id: additional-context
attributes:
label: Additional context
description: Add any other context about the problem here.
- type: checkboxes
id: submit-pr
attributes:
label: Contribution
description: Do you intend to submit a fix for this bug? (The xdatasets developers will help with code compliance)
options:
- label: I would be willing/able to open a Pull Request to address this bug.
31 changes: 31 additions & 0 deletions .github/ISSUE_TEMPLATE/0003-FEATURE-REQUEST.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Feature request
description: Suggest an idea for xdatasets
labels: [ "enhancement" ]

body:
- type: markdown
attributes:
value: |
Thanks for taking the time to fill out this feature request!
- type: textarea
id: problem
attributes:
label: Addressing a Problem?
description: Is your feature request related to a problem? Please describe it.
- type: textarea
id: potential-solution
attributes:
label: Potential Solution
description: Describe the solution you'd like to see implemented.
- type: textarea
id: additional-context
attributes:
label: Additional context
description: Add any other context about the feature request here.
- type: checkboxes
id: submit-pr
attributes:
label: Contribution
description: Do you intend to submit a fix for this bug? (The xdatasets developers will help with code compliance)
options:
- label: I would be willing/able to open a Pull Request to contribute this feature.
23 changes: 23 additions & 0 deletions .github/ISSUE_TEMPLATE/0004-QUESTION-SUPPORT.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Question/Support
description: Ask for help from the developers
labels: [ "support" ]

body:
- type: textarea
id: setup-information
attributes:
label: Setup Information
description: |
What software versions are you running? Example:
- xdatasets version: 0.55.0-gamma
- Python version: 4.2
- Operating System: Nutmeg Linux 12.34 | macOS 11.0 "Redmond"
value: |
- xdatasets version:
- Python version:
- Operating System:
- type: textarea
id: description
attributes:
label: Context
description: Describe what you were trying to get done. Tell us what happened, what went wrong, and what you expected to happen.
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
blank_issues_enabled: true
18 changes: 18 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<!-- Please ensure the PR fulfills the following requirements! -->
<!-- If this is your first PR, make sure to add your details to the AUTHORS.rst! -->
### Pull Request Checklist:
- [ ] This PR addresses an already opened issue (for bug fixes / features)
- This PR fixes #xyz
- [ ] (If applicable) Documentation has been added / updated (for bug fixes / features).
- [ ] (If applicable) Tests have been added.
- [ ] CHANGES.rst has been updated (with summary of main changes).
- [ ] Link to issue (:issue:`number`) and pull request (:pull:`number`) has been added.

### What kind of change does this PR introduce?

* ...

### Does this PR introduce a breaking change?


### Other information:
24 changes: 24 additions & 0 deletions .github/workflows/actions-versions-updater.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: GitHub Actions Version Updater

on:
schedule:
# 12:00 AM on the first of every month
- cron: '0 0 1 * *'
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
with:
# This requires a personal access token with the privileges to push directly to `main`
token: ${{ secrets.WORKFLOW_TOKEN }}
persist-credentials: true
- name: Run GitHub Actions Version Updater
uses: saadmk11/[email protected]
with:
token: ${{ secrets.WORKFLOW_TOKEN }}
committer_email: 'bumpversion[bot]@ouranos.ca'
committer_username: 'update-github-actions[bot]'
pull_request_title: '[bot] Update GitHub Action Versions'
6 changes: 3 additions & 3 deletions .github/workflows/bump-version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,13 @@ jobs:
run: echo "current_version=$(grep -E '__version__' xdatasets/__init__.py | cut -d ' ' -f3)"
- name: Bump Patch Version
run: |
pip install bump2version
pip install bump-my-version
echo "Bumping version"
bump2version patch
bump-my-version bump --tag patch
echo "new_version=$(grep -E '__version__' xdatasets/__init__.py | cut -d ' ' -f3)"
- name: Push Changes
uses: ad-m/github-push-action@master
with:
force: false
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.ref }}
branch: ${{ github.ref }}
46 changes: 46 additions & 0 deletions .github/workflows/first_pull_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: First Pull Request

on:
pull_request_target:
types:
- opened

jobs:
welcome:
name: Welcome
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@v6
with:
script: |
// Get a list of all issues created by the PR opener
// See: https://octokit.github.io/rest.js/#pagination
const creator = context.payload.sender.login
const opts = github.rest.issues.listForRepo.endpoint.merge({
...context.issue,
creator,
state: 'all'
})
const issues = await github.paginate(opts)
for (const issue of issues) {
if (issue.number === context.issue.number) {
continue
}
if (issue.pull_request) {
return // Creator is already a contributor.
}
}
await github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: `**Welcome**, new contributor!
It appears that this is your first Pull Request. To give credit where it's due, we ask that you add your information to the \`AUTHORS.rst\` and \`.zenodo.json\`.:
- [ ] The relevant author information has been added to \`AUTHORS.rst\` and \`.zenodo.json\`.
Please make sure you've read our [contributing guide](CONTRIBUTING.rst). We look forward to reviewing your Pull Request shortly ✨`
})
Loading

0 comments on commit 39906ed

Please sign in to comment.