Skip to content

Commit

Permalink
Merge pull request #8 from GenevieveBuckley/main-sync
Browse files Browse the repository at this point in the history
Synchronize main branch of cookiecutter-napari-plugin with this repo
  • Loading branch information
GenevieveBuckley authored Jul 11, 2024
2 parents 7ea777d + 50317cc commit ce12dd0
Show file tree
Hide file tree
Showing 9 changed files with 64 additions and 9 deletions.
13 changes: 13 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Dependabot configuration
# https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuring-dependabot-version-updates#enabling-github-dependabot-version-updates
# https://til.simonwillison.net/github/dependabot-python-setup
version: 2
updates:
- package-ecosystem: pip
directory: "/"
schedule:
interval: monthly
groups:
python-packages:
patterns:
- "*"
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
fail-fast: false
matrix:
platform: [ubuntu-latest, windows-latest, macos-latest]
python-version: [3.9, "3.10", "3.11", "3.12"]
python-version: ["3.9", "3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v4
Expand All @@ -36,6 +36,6 @@ jobs:
python -m pip install pytest pytest-cookies tox
- name: Test
uses: aganders3/headless-gui@v1
uses: aganders3/headless-gui@v2
with:
run: python -m pytest -s -v --color=yes
16 changes: 16 additions & 0 deletions PROMPTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,22 @@ In order to use this option, you must run `git init` once in
your package's root directory.
```

## install_precommit

The default for this prompt is `"n"`.

If you choose "y" for this prompt, then [pre-commit](ttps://pre-commit.com/) will be installed.
Among other things, it includes checks for code linting and best practices in napari plugins.

## install_dependabot

The default for this prompt is `"n"`.

If you choose "y" for this prompt, then a [Dependabot](https://docs.github.com/en/code-security/dependabot) configuration file will be created at `.github/dependabot.yml`.

You will still need to enable Dependabot in your github settings, [see the instructions at this link](https://docs.github.com/en/code-security/dependabot/dependabot-security-updates/configuring-dependabot-security-updates#managing-dependabot-security-updates-for-your-repositories).


## license

This prompt allows you to choose from a variety of open source licensing options
Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,12 @@ pre-commit install
You can also have these checks run automatically for you when you push to github
by installing [pre-commit ci](https://pre-commit.ci/) on your repository.

## Dependabot

This template also includes a default yaml configuration for [Dependabot](https://docs.github.com/en/code-security/dependabot). This can help you check for security updates to easily update vulnerable dependencies.

You will still need to enable Dependabot in your github settings, [see the instructions at this link](https://docs.github.com/en/code-security/dependabot/dependabot-security-updates/configuring-dependabot-security-updates#managing-dependabot-security-updates-for-your-repositories). Your Dependabot configuration file is located at `.github/dependabot.yml`.

## Features

- Installable [PyPI] package
Expand Down
1 change: 1 addition & 0 deletions cookiecutter.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"include_widget_plugin": "y",
"use_git_tags_for_versioning": "n",
"install_precommit": "n",
"install_dependabot": "n",
"license": [
"BSD-3",
"MIT",
Expand Down
4 changes: 4 additions & 0 deletions hooks/post_gen_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ def remove_unrequested_plugin_examples():
remove_file(f"src/{module}/_{name}.py")
remove_file(f"src/{module}/_tests/test_{name}.py")
logger.debug(f"removing {module}/_{name}.py")
# remove dependabot config if unrequested
{% elif key.startswith("install_dependabot") and value != 'y' %}
remove_file(".github/dependabot.yml")
logger.debug("removing .github/dependabot.yml")
{% endif %}
{% endfor %}

Expand Down
15 changes: 15 additions & 0 deletions {{cookiecutter.plugin_name}}/.github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Dependabot configuration
# https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuring-dependabot-version-updates#enabling-github-dependabot-version-updates
# https://til.simonwillison.net/github/dependabot-python-setup
{% raw %}
version: 2
updates:
- package-ecosystem: pip
directory: "/"
schedule:
interval: monthly
groups:
python-packages:
patterns:
- "*"
{% endraw %}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
strategy:
matrix:
platform: [ubuntu-latest, windows-latest, macos-latest]
python-version: ['3.8', '3.9', '3.10']
python-version: ["3.9", "3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -55,7 +55,7 @@ jobs:
# this runs the platform-specific tests declared in tox.ini
- name: Test with tox
uses: aganders3/headless-gui@v1
uses: aganders3/headless-gui@v2
with:
run: python -m tox
env:
Expand Down
10 changes: 5 additions & 5 deletions {{cookiecutter.plugin_name}}/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ testing = [
{%- endif %}

[build-system]
{% if cookiecutter.use_git_tags_for_versioning == 'y' and cookiecutter.plugin_name != "foo-bar" -%}
{% if cookiecutter.use_git_tags_for_versioning == 'y' -%}
requires = ["setuptools>=42.0.0", "wheel", "setuptools_scm"]
{%- else -%}
requires = ["setuptools>=42.0.0", "wheel"]
Expand All @@ -75,18 +75,18 @@ build-backend = "setuptools.build_meta"
[tool.setuptools]
include-package-data = true

[tool.setuptools.dynamic]
version = {attr = "{{cookiecutter.module_name}}.__init__.__version__"}

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

[tool.setuptools.package-data]
"*" = ["*.yaml"]

{% if cookiecutter.use_git_tags_for_versioning == 'y' and cookiecutter.plugin_name != "foo-bar" %}
{% if cookiecutter.use_git_tags_for_versioning == 'y' %}
[tool.setuptools_scm]
write_to = "src/{{cookiecutter.module_name}}/_version.py"
{% else %}
[tool.setuptools.dynamic]
version = {attr = "{{cookiecutter.module_name}}.__init__.__version__"}
{%- endif %}

[tool.black]
Expand Down

0 comments on commit ce12dd0

Please sign in to comment.