Skip to content

Commit

Permalink
Merge pull request #66 from ASFHyP3/develop
Browse files Browse the repository at this point in the history
Release v0.3.0
  • Loading branch information
jhkennedy authored Oct 11, 2024
2 parents cdc1a71 + 823e6db commit e7b1e20
Show file tree
Hide file tree
Showing 23 changed files with 121 additions and 76 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ on:

jobs:
call-changelog-check-workflow:
uses: ASFHyP3/actions/.github/workflows/[email protected].1
uses: ASFHyP3/actions/.github/workflows/[email protected].2
2 changes: 1 addition & 1 deletion .github/workflows/create-jira-issue.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:

jobs:
call-create-jira-issue-workflow:
uses: ASFHyP3/actions/.github/workflows/[email protected].1
uses: ASFHyP3/actions/.github/workflows/[email protected].2
secrets:
JIRA_BASE_URL: ${{ secrets.JIRA_BASE_URL }}
JIRA_USER_EMAIL: ${{ secrets.JIRA_USER_EMAIL }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/labeled-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ on:

jobs:
call-labeled-pr-check-workflow:
uses: ASFHyP3/actions/.github/workflows/[email protected].1
uses: ASFHyP3/actions/.github/workflows/[email protected].2
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:

jobs:
call-release-workflow:
uses: ASFHyP3/actions/.github/workflows/[email protected].1
uses: ASFHyP3/actions/.github/workflows/[email protected].2
with:
release_prefix: HyP3 Cookiecutter
secrets:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/static-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ on: push

jobs:
call-secrets-analysis-workflow:
uses: ASFHyP3/actions/.github/workflows/[email protected].1
uses: ASFHyP3/actions/.github/workflows/[email protected].2
2 changes: 1 addition & 1 deletion .github/workflows/tag-version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ on:

jobs:
call-bump-version-workflow:
uses: ASFHyP3/actions/.github/workflows/[email protected].1
uses: ASFHyP3/actions/.github/workflows/[email protected].2
secrets:
USER_TOKEN: ${{ secrets.TOOLS_BOT_PAK }}
42 changes: 42 additions & 0 deletions .github/workflows/update_actions_version.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Update ASFHyP3/actions version

on:
workflow_dispatch:
inputs:
version:
description: 'Version to set all ASFHyP3/actions to'
required: true
type: string

jobs:
update_actions_examples:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.TOOLS_BOT_PAK }}

- name: Create update branch
id: update
env:
ACTIONS_VERSION: ${{ github.event.inputs.version }}
run: |
git config user.name "tools-bot"
git config user.email "[email protected]"
export UPDATE_BRANCH=update-actions-to-${ACTIONS_VERSION}
git switch -c ${UPDATE_BRANCH}
export SEARCH_PATTERN='(ASFHyP3/actions/.github/workflows/.*.yml)@v[0-9]+\.[0-9]+\.[0-9]+'
find -iwholename "*/workflows/*.yml" -exec sed -i -r "s|$SEARCH_PATTERN|\1@${ACTIONS_VERSION}|g" {} \;
git commit -am "Bump actions ASFHyP3/actions version to ${ACTIONS_VERSION}"
git push origin ${UPDATE_BRANCH}
- name: Open PR
env:
PR_TITLE: Update ASFHyP3/actions version to ${{ github.event.inputs.version }}
PR_BODY: PR created by a new `v*` tag push event
GH_TOKEN: ${{ secrets.TOOLS_BOT_PAK }}
run: |
gh pr create -t "${PR_TITLE}" -b "${PR_BODY}" -l tools-bot -l bumpless -B develop
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,20 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [PEP 440](https://www.python.org/dev/peps/pep-0440/)
and uses [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.3.0]
### Added
* Support for Python 3.13
* Workflow action to keep the reusable CI/CD action up to date within the cookiecutter template

### Changed
* Now uses ruff for linting and formatting instead of flake8

### Removed
* The unused `process.main` function as we don't register it as a console script entrypoint

### Fixed
* Tests using the `script_runner` fixture will no longer raise usage warnings

## [0.2.0]
### Removed
* Support for Python 3.8 and 3.9 has been dropped. The minimum version is now 3.10.
Expand Down
2 changes: 1 addition & 1 deletion cookiecutter.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"github_username": "username_for_github_actions",
"github_email": "email_for@github_actions.com",
"process_type": "RTC",
"short_description": "HyP3 plugin for {{cookiecutter.process_type}} processing",
"short_description": "HyP3 plugin for {{cookiecutter.process_type}} processing.",
"public_url": "https://github.com/ASFHyP3/hyp3-{{cookiecutter.process_type}}",
"copyright_year": "{% now 'utc', '%Y' %}",
"__project_name": "hyp3-{{cookiecutter.process_type | lower}}",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,4 @@ on:
jobs:
call-changelog-check-workflow:
# Docs: https://github.com/ASFHyP3/actions
uses: ASFHyP3/actions/.github/workflows/[email protected]
secrets:
USER_TOKEN: {{'${{ secrets.GITHUB_TOKEN }}'}}
uses: ASFHyP3/actions/.github/workflows/[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ on:
jobs:
call-labeled-pr-check-workflow:
# Docs: https://github.com/ASFHyP3/actions
uses: ASFHyP3/actions/.github/workflows/reusable-labeled-pr-check.yml@v0.7.1
uses: ASFHyP3/actions/.github/workflows/reusable-labeled-pr-check.yml@v0.11.2
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ on:
- opened
branches:
- main

jobs:
call-release-workflow:
# Docs: https://github.com/ASFHyP3/actions
uses: ASFHyP3/actions/.github/workflows/reusable-release-checklist-comment.yml@v0.7.1
uses: ASFHyP3/actions/.github/workflows/reusable-release-checklist-comment.yml@v0.11.2
permissions:
pull-requests: write
secrets:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
jobs:
call-release-workflow:
# Docs: https://github.com/ASFHyP3/actions
uses: ASFHyP3/actions/.github/workflows/reusable-release.yml@v0.7.1
uses: ASFHyP3/actions/.github/workflows/reusable-release.yml@v0.11.2
with:
release_prefix: {{ cookiecutter.__project_title }}
release_branch: main
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ on: push
jobs:
call-secrets-analysis-workflow:
# Docs: https://github.com/ASFHyP3/actions
uses: ASFHyP3/actions/.github/workflows/reusable-secrets-analysis.yml@v0.7.1
uses: ASFHyP3/actions/.github/workflows/reusable-secrets-analysis.yml@v0.11.2

call-flake8-workflow:
# Docs: https://github.com/ASFHyP3/actions
uses: ASFHyP3/actions/.github/workflows/reusable-flake8.yml@v0.7.1
uses: ASFHyP3/actions/.github/workflows/reusable-ruff.yml@v0.11.2
with:
local_package_names: {{ cookiecutter.__package_name }}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
jobs:
call-bump-version-workflow:
# Docs: https://github.com/ASFHyP3/actions
uses: ASFHyP3/actions/.github/workflows/reusable-bump-version.yml@v0.7.1
uses: ASFHyP3/actions/.github/workflows/reusable-bump-version.yml@v0.11.2
with:
user: {{ cookiecutter.github_username }}
email: {{ cookiecutter.github_email }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,20 @@ on:
jobs:
call-pytest-workflow:
# Docs: https://github.com/ASFHyP3/actions
uses: ASFHyP3/actions/.github/workflows/reusable-pytest.yml@v0.7.1
uses: ASFHyP3/actions/.github/workflows/reusable-pytest.yml@v0.11.2
with:
local_package_name: {{ cookiecutter.__package_name }}
python_versions: >-
["3.10", "3.11", "3.12"]
["3.10", "3.11", "3.12", "3.13"]
call-version-info-workflow:
# Docs: https://github.com/ASFHyP3/actions
uses: ASFHyP3/actions/.github/workflows/[email protected]
with:
python_version: "3.10"
uses: ASFHyP3/actions/.github/workflows/[email protected]

call-docker-ghcr-workflow:
needs: call-version-info-workflow
# Docs: https://github.com/ASFHyP3/actions
uses: ASFHyP3/actions/.github/workflows/reusable-docker-ghcr.yml@v0.7.1
uses: ASFHyP3/actions/.github/workflows/reusable-docker-ghcr.yml@v0.11.2
with:
version_tag: {{'${{ needs.call-version-info-workflow.outputs.version_tag }}'}}
release_branch: main
Expand Down
1 change: 0 additions & 1 deletion {{cookiecutter.__project_name}}/.trufflehog.txt

This file was deleted.

8 changes: 2 additions & 6 deletions {{cookiecutter.__project_name}}/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,11 @@ dependencies:
- python>=3.10
- pip
# For packaging, and testing
- flake8
- flake8-import-order
- flake8-blind-except
- flake8-builtins
- setuptools
- ruff
- setuptools_scm
- wheel
- pytest
- pytest-console-scripts
- pytest-cov
# For running
- hyp3lib>=3,<4
# TODO: insert conda-forge dependencies as list here
41 changes: 32 additions & 9 deletions {{cookiecutter.__project_name}}/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "{{ cookiecutter.__package_name }}"
readme = "README.md"
requires-python = ">=3.10"
authors = [
{name="{{ cookiecutter.github_username }}", email="{{ cookiecutter.github_email }}"},
Expand All @@ -19,19 +20,17 @@ classifiers=[
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
]
dependencies = [
"hyp3lib>=3,<4",
# insert python dependencies as list here
# TODO: insert Python dependencies as list here
]
dynamic = ["version", "readme"]
dynamic = ["version"]

[project.optional-dependencies]
develop = [
"flake8",
"flake8-import-order",
"flake8-blind-except",
"flake8-builtins",
"ruff",
"pytest",
"pytest-cov",
"pytest-console-scripts",
Expand All @@ -49,10 +48,34 @@ script_launch_mode = "subprocess"
include-package-data = true
zip-safe = false

[tool.setuptools.dynamic]
readme = {file = ["README.md"], content-type = "text/markdown"}

[tool.setuptools.packages.find]
where = ["src"]

[tool.setuptools_scm]

[tool.ruff]
line-length = 120
src = ["src", "tests"]

[tool.ruff.format]
indent-style = "space"
quote-style = "single"

[tool.ruff.lint]
extend-select = [
"I", # isort: https://docs.astral.sh/ruff/rules/#isort-i
"UP", # pyupgrade: https://docs.astral.sh/ruff/rules/#pyupgrade-up
"D", # pydocstyle: https://docs.astral.sh/ruff/rules/#pydocstyle-d
"ANN", # annotations: https://docs.astral.sh/ruff/rules/#flake8-annotations-ann
"PTH", # use-pathlib-pth: https://docs.astral.sh/ruff/rules/#flake8-use-pathlib-pth
]

[tool.ruff.lint.pydocstyle]
convention = "google"

[tool.ruff.lint.isort]
case-sensitive = true
lines-after-imports = 2

[tool.ruff.lint.extend-per-file-ignores]
"tests/*" = ["D100", "D103", "ANN"]
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

from importlib.metadata import version


__version__ = version(__name__)

__all__ = [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,32 +1,28 @@
"""
{{cookiecutter.process_type}} processing for HyP3
"""
"""{{cookiecutter.process_type}} processing for HyP3."""

import logging
from argparse import ArgumentParser

from hyp3lib.aws import upload_file_to_s3
from hyp3lib.image import create_thumbnail


from {{cookiecutter.__package_name}}.process import {{cookiecutter.__process_name}}


def main():
"""
HyP3 entrypoint for {{cookiecutter.__package_name}}
"""
def main() -> None:
"""HyP3 entrypoint for {{cookiecutter.__package_name}}."""
parser = ArgumentParser()
parser.add_argument('--bucket', help='AWS S3 bucket HyP3 for upload the final product(s)')
parser.add_argument('--bucket-prefix', default='', help='Add a bucket prefix to product(s)')

# TODO: Your arguments here
parser.add_argument('--greeting', default='Hello world!',
help='Write this greeting to a product file')
parser.add_argument('--greeting', default='Hello world!', help='Write this greeting to a product file')

args = parser.parse_args()

logging.basicConfig(format='%(asctime)s - %(levelname)s - %(message)s',
datefmt='%m/%d/%Y %I:%M:%S %p', level=logging.INFO)
logging.basicConfig(
format='%(asctime)s - %(levelname)s - %(message)s', datefmt='%m/%d/%Y %I:%M:%S %p', level=logging.INFO
)

product_file = {{cookiecutter.__process_name}}(
greeting=args.greeting,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
"""
{{cookiecutter.process_type}} processing
"""
"""{{cookiecutter.process_type}} processing."""

import argparse
import logging
from pathlib import Path

from {{cookiecutter.__package_name}} import __version__

log = logging.getLogger(__name__)


def {{cookiecutter.__process_name}}(greeting: str = 'Hello world!') -> Path:
"""Create a greeting product
"""Create a greeting product.
Args:
greeting: Write this greeting to a product file (Default: "Hello world!" )
Expand All @@ -21,21 +17,3 @@ def {{cookiecutter.__process_name}}(greeting: str = 'Hello world!') -> Path:
product_file = Path('greeting.txt')
product_file.write_text(greeting)
return product_file


def main():
"""{{cookiecutter.__process_name}} entrypoint"""
parser = argparse.ArgumentParser(
prog='{{cookiecutter.__process_name}}',
description=__doc__,
)
parser.add_argument('--greeting', default='Hello world!',
help='Write this greeting to a product file')
parser.add_argument('--version', action='version', version=f'%(prog)s {__version__}')
args = parser.parse_args()

{{cookiecutter.__process_name}}(**args.__dict__)


if __name__ == "__main__":
main()
2 changes: 1 addition & 1 deletion {{cookiecutter.__project_name}}/tests/test_entrypoints.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
def test_{{cookiecutter.__package_name}}(script_runner):
ret = script_runner.run('python', '-m', '{{cookiecutter.__package_name}}', '-h')
ret = script_runner.run(['python', '-m', '{{cookiecutter.__package_name}}', '-h'])
assert ret.success

0 comments on commit e7b1e20

Please sign in to comment.