Skip to content

Commit

Permalink
Update {{ cookiecutter.package_name }}/.github/workflows/sub_package_…
Browse files Browse the repository at this point in the history
…update.yml

Co-authored-by: Stuart Mumford <[email protected]>
  • Loading branch information
CyclingNinja and Cadair committed Jan 29, 2024
1 parent 84614fa commit 4c49712
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 32 deletions.
2 changes: 1 addition & 1 deletion cookiecutter.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
"short_description": "",
"author_name": "",
"author_email": "",
"project_url": "",
"license": [
"BSD 3-Clause",
"GNU GPL v3+",
"Apache Software License 2.0",
"BSD 2-Clause",
"Other"
],
"project_url": "",
"minimum_python_version": [
"3.9",
"3.10",
Expand Down
2 changes: 1 addition & 1 deletion hooks/post_gen_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def process_version(enable_dynamic_dev_versions):

def process_github_workflow(include_cruft_update_github_workflow):
if include_cruft_update_github_workflow != "y":
remove_dir(os.path.join(PROJECT_DIRECTORY, '{{ cookiecutter.module_name }}', '.github'))
remove_dir(os.path.join(PROJECT_DIRECTORY, '.github'))


if __name__ == '__main__':
Expand Down
2 changes: 2 additions & 0 deletions tests/test_rendered_tox.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ def test_tox_runs(cookiejar_examples, tox_project):
cj = cookiejar_examples
# We have to git init so that setuptools_scm and it's generated manifest
path = str(cj.project_path)
print("==============================")
print("PATH IS : {}".format(path))

subprocess.call(["git", "config", "--global", "init.defaultBranch", "main"])
subprocess.call(["git", "init", path])
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
name: Update SunPy Sub Packages
"""
This template is taken from the cruft example code, for further information please see:
https://cruft.github.io/cruft/#automating-updates-with-github-actions
"""
name: Automatic Update from package template
permissions:
contents: write
pull-requests: write
Expand All @@ -17,13 +21,13 @@ jobs:
- add-paths: .
body: Use this to merge the changes to the repo
branch: cruft/update
commit-message: "SunPy package template update"
title: New Updates to SunPy Template
commit-message: "Automate package template update"
title: Incoming updates from package template
- add-paths: .cruft.json
body: Use this to reject changes in the repo
branch: cruft/reject
commit-message: "Chore: reject this cruft update"
title: Reject new SunPy template updates
title: Reject new updates from package template

steps:
- uses: actions/checkout@v3
Expand Down Expand Up @@ -52,10 +56,9 @@ jobs:
- name: Run update if available
if: steps.check.outputs.has_changes == '1'
# this needs to be sunpy details I think?
run: |
git config --global user.email ""
git config --global user.name "SunPy Org"
git config --global user.email "[email protected]"
git config --global user.name "Gromit"
cruft update --skip-apply-ask --refresh-private-variables
git restore --staged
Expand All @@ -73,5 +76,5 @@ jobs:
title: ${{ matrix.title }}
body: |
This is an autogenerated PR. ${{ matrix.body }}
[Cruft](https://cruft.github.io/cruft/) has detected updates from the SunPy Package Template
[Cruft](https://cruft.github.io/cruft/) has detected updates from the Package Template
31 changes: 15 additions & 16 deletions {{ cookiecutter.package_name }}/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ requires = [
"setuptools>=62.1",
"setuptools_scm[toml]>=6.2",
"wheel",
{% if cookiecutter.use_compiled_extensions == 'y' %}
{%- if cookiecutter.use_compiled_extensions == 'y' %}
"extension-helpers",
"oldest-supported-numpy",
"cython"
{% endif %}
{% endif -%}
]
build-backend = "setuptools.build_meta"

Expand All @@ -17,16 +17,21 @@ description = "{{ cookiecutter.short_description }}"
readme = "README.rst"
requires-python = ">={{ cookiecutter.minimum_python_version }}"
license = { file = "licenses/LICENSE.rst", content-type = "text/plain" }
{% if cookiecutter.author_name and cookiecutter.author_email %}
{%- if cookiecutter.author_name and cookiecutter.author_email %}
authors = [
{ name = "{{ cookiecutter.author_name }}", email = "{{ cookiecutter.author_email }}" },
]
{% endif %}
{%- endif %}
dependencies = [
{{ cookiecutter._install_requires }}
{{- cookiecutter._install_requires -}}
]
dynamic = ["version"]

{% if cookiecutter.include_example_code == 'y' -%}
[project.scripts]
open_astronomy_package_template_example = "{{ cookiecutter.module_name }}.example_mod:main"

{% endif -%}
[project.optional-dependencies]
test = [
"pytest",
Expand All @@ -38,15 +43,10 @@ docs = [
"tomli; python_version <\"3.11\"",
]

{%- if cookiecutter.include_example_code == 'y' %}
[project.scripts]
astropy_package_template_example = "{{ cookiecutter.module_name }}.example_mod:main"
{% endif -%}

{%- if cookiecutter.project_url %}
{% if cookiecutter.project_url -%}
[project.urls]
repository = "{{ cookiecutter.project_url }}"
{% endif -%}
{%- endif %}

[tool.setuptools]
zip-safe = false
Expand All @@ -55,12 +55,11 @@ include-package-data = true
[tool.setuptools.packages.find]

[tool.setuptools_scm]
{%- if cookiecutter.enable_dynamic_dev_versions == 'y' %}
{% if cookiecutter.enable_dynamic_dev_versions == 'y' -%}
write_to = "{{ cookiecutter.module_name }}/_version.py"
{% else %}
{%- else -%}
write_to = "{{ cookiecutter.module_name }}/version.py"
{% endif -%}

{%- endif %}

[tool.pytest.ini_options]
testpaths = [
Expand Down
8 changes: 3 additions & 5 deletions {{ cookiecutter.package_name }}/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@
from setuptools import setup
{%- if cookiecutter.use_compiled_extensions == 'y' %}
from extension_helpers import get_extensions
{% endif -%}
{%- endif %}

{%- if cookiecutter.use_compiled_extensions == 'y' %}
setup(
setup( {%- if cookiecutter.use_compiled_extensions == 'y' -%}
ext_modules=get_extensions()
)
{% endif -%}
{%- endif -%} )
2 changes: 1 addition & 1 deletion {{ cookiecutter.package_name }}/tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ commands =
description = invoke sphinx-build to build the HTML docs
change_dir =
docs
extras =
extras =
docs
commands =
sphinx-build -j auto --color -W --keep-going -b html -d _build/.doctrees . _build/html {posargs}

0 comments on commit 4c49712

Please sign in to comment.