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: link to pypackage template #56

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
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
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
_commit: 0.1.15
_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: "2023"
github_repo_name: pygaul
github_user: gee-community
project_name: pyGAUL
project_slug: pygaul
short_description:
Easy access to administrative boundary defined by FAO GAUL from
Python scripts
8 changes: 6 additions & 2 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
{
"name": "Python 3",
"image": "mcr.microsoft.com/devcontainers/python",
"postCreateCommand": "python -m pip install nox pre-commit commitizen && pre-commit install"
"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": "python -m pip install commitizen uv && pre-commit install"
}
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.
25 changes: 14 additions & 11 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,27 @@ on:
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: 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: |
python -m pip install --upgrade pip
pip install setuptools wheel twine build

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/*
61 changes: 33 additions & 28 deletions .github/workflows/unit.yaml
Original file line number Diff line number Diff line change
@@ -1,46 +1,49 @@
name: Build
name: Unit tests

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

env:
EARTHENGINE_TOKEN: ${{ secrets.EARTHENGINE_TOKEN }}
FORCE_COLOR: 1
PIP_ROOT_USER_ACTION: ignore

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.10"
python-version: "3.11"
- uses: pre-commit/[email protected]

mypy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- 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 nox
run: pip install nox
run: pip install nox[uv]
- 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
- 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: build static docs
run: nox -s docs

Expand All @@ -58,34 +61,36 @@ jobs:
python-version: "3.11"
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
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 test
run: nox -s ci-test
- name: assess dead fixtures
if: ${{ matrix.python-version == '3.10' }}
shell: bash
run: nox -s dead-fixtures
- uses: actions/upload-artifact@v4
if: ${{ matrix.python-version == '3.10' }}
with:
name: coverage
path: coverage.xml

coverage:
needs: [build]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
- uses: actions/download-artifact@v4
with:
python-version: "3.10"
- name: Install nox
run: pip install nox coverage[toml]
- name: test with pytest
run: nox -s test
- name: assess dead fixtures
run: nox -s dead-fixtures
- name: coverage
run: coverage xml
name: coverage
path: coverage.xml
- name: codecov
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v4
with:
file: ./coverage.xml
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true
6 changes: 4 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ instance/
# Sphinx documentation
docs/_build/
docs/api/
warnings.txt

# PyBuilder
target/
Expand Down Expand Up @@ -135,4 +134,7 @@ dmypy.json
.vscode/

# image tmp file
*Zone.Identifier
*Zone.Identifier

# debugging notebooks
test.ipynb
44 changes: 21 additions & 23 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
default_install_hook_types: [pre-commit, commit-msg]

repos:
- repo: "https://github.com/psf/black"
rev: "22.3.0"
hooks:
- id: black
stages: [commit]

- repo: "https://github.com/commitizen-tools/commitizen"
rev: "v2.18.0"
hooks:
Expand All @@ -17,37 +11,41 @@ repos:
rev: "0.5.0"
hooks:
- id: nbstripout
stages: [commit]
stages: [pre-commit]

- repo: "https://github.com/pre-commit/mirrors-prettier"
rev: "v2.7.1"
- repo: "https://github.com/pycontribs/mirrors-prettier"
rev: "v3.4.2"
hooks:
- id: prettier
stages: [commit]
stages: [pre-commit]
exclude: tests\/test_.+\.

- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: "v0.0.215"
rev: "v0.7.0"
hooks:
- id: ruff
stages: [commit]

- repo: https://github.com/PyCQA/doc8
rev: "v1.1.1"
hooks:
- id: doc8
stages: [commit]
stages: [pre-commit]
- id: ruff-format
stages: [pre-commit]

- repo: https://github.com/FHPythonUtils/LicenseCheck
rev: "2023.1.1"
- repo: https://github.com/sphinx-contrib/sphinx-lint
rev: "v1.0.0"
hooks:
- id: licensecheck
stages: [commit]
- id: sphinx-lint
stages: [pre-commit]

- repo: https://github.com/codespell-project/codespell
rev: v2.2.4
hooks:
- id: codespell
stages: [commit]
stages: [pre-commit]
additional_dependencies:
- tomli

# Prevent committing inline conflict markers
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
hooks:
- id: check-merge-conflict
stages: [pre-commit]
args: [--assume-in-merge]
14 changes: 12 additions & 2 deletions AUTHORS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,18 @@ Thanks goes to these wonderful people (`emoji key <https://allcontributors.org/d

.. raw:: html

<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
<!-- ALL-CONTRIBUTORS-LIST:END -->
<table class="table table-bordered">
<tr>
<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
<td align="center">
<a href="https://github.com/12rambau">
<img src="https://github.com/12rambau.png" width="70px;" alt="12rambau"/><br />
<sub><b>Pierrick Rambaud</b></sub>
</a>
</td>
<!-- ALL-CONTRIBUTORS-LIST:END -->
</tr>
</table>

This project follows the `all-contributors <https://allcontributors.org>`_ specification.

Expand Down
11 changes: 11 additions & 0 deletions CITATION.cff
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
cff-version: "1.2.0"
message: "If you use this software, please cite it as below."
authors:
- family-names: "Rambaud"
given-names: "Pierrick"
orcid: "https://orcid.org/0000-0001-8764-5749"
title: "pyGAUL"
version: "0.3.4"
doi: ""
date-released: "2024-12-07"
url: "https://github.com/gee-community/pygaul"
Loading
Loading