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

build: use 12rambau/pypackage as a tempalte #400

Draft
wants to merge 9 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
13 changes: 13 additions & 0 deletions .copier-answers.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Changes here will be overwritten by Copier
_commit: 0.1.16
_src_path: gh:12rambau/pypackage
author_email: [email protected]
author_first_name: Pierrick
author_last_name: Rambaud
author_orcid: 0000-0001-8764-5749
creation_year: "2017"
github_repo_name: geetools
github_user: gee-community
project_name: geetools
project_slug: geetools
short_description: A collection of tools to work with Google Earth Engine Python API
5 changes: 2 additions & 3 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
"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": {},
"ghcr.io/rocker-org/devcontainer-features/pandoc:1": {}
"ghcr.io/devcontainers-contrib/features/pre-commit:2": {}
},
"postCreateCommand": "pre-commit install"
"postCreateCommand": "python -m pip install commitizen uv && pre-commit install"
}
23 changes: 23 additions & 0 deletions .github/ISSUE_TEMPLATE/PULL_REQUEST_TEMPLATE/pr_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
name: Pull request template
about: Create a pull request
title: ""
labels: ""
assignees: ""
---

## reference the related issue

PR should answer problem stated in the issue tracker. please open one before starting a PR

## description of the changes

Describe the changes you propose

## mention

@mentions of the person or team responsible for reviewing proposed changes

## comments

any other comments we should pay attention to
24 changes: 24 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
name: Bug report
about: Create a report to help us improve
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

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

**Additional context**
Add any other context about the problem here.
19 changes: 19 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
name: Feature request
about: Suggest an idea for this project
title: ""
labels: ""
assignees: ""
---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.
53 changes: 53 additions & 0 deletions .github/workflows/pypackage_check.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: template update check

on:
workflow_dispatch:

env:
PIP_ROOT_USER_ACTION: ignore

jobs:
check_version:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
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.
26 changes: 15 additions & 11 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -1,26 +1,30 @@
name: Release
name: Upload Python Package

on:
workflow_dispatch:
release:
types: [created]

env:
PIP_ROOT_USER_ACTION: ignore

jobs:
tests:
uses: ./.github/workflows/unit.yaml

deploy:
needs: [tests]
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
#- uses: ./.github/workflows/unit.yaml
- uses: actions/setup-python@v4
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.10"
python-version: "3.11"
- name: Install dependencies
run: pip install twine build nox
run: pip install twine build nox[uv]
- name: update citation date
run: nox -s release-date
- name: Build and publish
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python -m build
twine upload dist/*
run: python -m build && twine upload dist/*
25 changes: 13 additions & 12 deletions .github/workflows/unit.yaml
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
name: Unit
name: Unit tests

on:
workflow_call:
push:
branches:
- main
pull_request:
workflow_dispatch:

env:
EARTHENGINE_SERVICE_ACCOUNT: ${{ secrets.EARTHENGINE_SERVICE_ACCOUNT }}
EARTHENGINE_PROJECT: ${{ secrets.EARTHENGINE_PROJECT }}
FORCE_COLOR: 1
PIP_ROOT_USER_ACTION: ignore

jobs:
lint:
Expand All @@ -18,32 +20,31 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.10"
- uses: pre-commit/[email protected].1
python-version: "3.11"
- uses: pre-commit/[email protected].0

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

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

Expand All @@ -53,7 +54,6 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest]
# dropping 3.12 for now because of https://github.com/r-earthengine/ee_extra/issues/56
python-version: ["3.9", "3.10", "3.11"]
include:
- os: macos-latest # macos test
Expand All @@ -68,7 +68,7 @@ jobs:
with:
python-version: ${{ matrix.python-version }}
- name: Install nox
run: pip install nox
run: pip install nox[uv]
- name: test with pytest
run: nox -s ci-test
- name: assess dead fixtures
Expand All @@ -88,6 +88,7 @@ jobs:
- uses: actions/download-artifact@v4
with:
name: coverage
path: coverage.xml
- name: codecov
uses: codecov/codecov-action@v4
with:
Expand Down
26 changes: 10 additions & 16 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ parts/
sdist/
var/
wheels/
pip-wheel-metadata/
share/python-wheels/
*.egg-info/
.installed.cfg
Expand Down Expand Up @@ -49,7 +50,7 @@ coverage.xml
*.py,cover
.hypothesis/
.pytest_cache/
cover/
.ruff_cache/

# Translations
*.mo
Expand All @@ -70,10 +71,9 @@ instance/

# Sphinx documentation
docs/_build/
warnings.txt
docs/api/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
Expand All @@ -84,9 +84,7 @@ profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version
.python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
Expand All @@ -95,7 +93,7 @@ ipython_config.py
# install all needed dependencies.
#Pipfile.lock

# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__pypackages__/

# Celery stuff
Expand Down Expand Up @@ -132,15 +130,11 @@ dmypy.json
# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/

# vscode config
# system IDE
.vscode/

# sandbox Notebook
sandbox.ipynb
# image tmp file
*Zone.Identifier

# debugging notebooks
test.ipynb
Loading
Loading