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

Update to copier template 0.3.1, drop Python 3.8/Salt 3005 #16

Merged
merged 2 commits into from
May 29, 2024
Merged
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
8 changes: 4 additions & 4 deletions .copier-answers.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Autogenerated. Do not edit this by hand, use `copier update`.
---
_commit: 0.2.9
_commit: 0.3.1
_src_path: https://github.com/salt-extensions/salt-extension-copier
author: jeanluc
author_email: [email protected]
Expand All @@ -10,12 +10,12 @@ loaders:
- module
- returner
- state
max_salt_version: 3006
max_salt_version: 3007
no_saltext_namespace: false
package_name: pushover
project_name: pushover
python_requires: '3.7'
salt_version: '3005'
python_requires: '3.8'
salt_version: '3006'
source_url: https://github.com/salt-extensions/saltext-pushover
ssh_fixtures: false
summary: Salt Extension for interacting with Pushover
Expand Down
36 changes: 18 additions & 18 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
minimum_pre_commit_version: 2.4.0
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v4.6.0
hooks:
- id: check-merge-conflict # Check for files that contain merge conflict strings.
- id: trailing-whitespace # Trims trailing whitespace.
Expand Down Expand Up @@ -37,7 +37,7 @@ repos:

- repo: https://github.com/s0undt3ch/salt-rewrite
# Automatically rewrite code with known rules
rev: 2.2.0
rev: 2.5.2
hooks:
- id: salt-rewrite
alias: rewrite-docstrings
Expand All @@ -47,7 +47,7 @@ repos:

- repo: https://github.com/s0undt3ch/salt-rewrite
# Automatically rewrite code with known rules
rev: 2.2.0
rev: 2.5.2
hooks:
- id: salt-rewrite
alias: rewrite-tests
Expand All @@ -56,52 +56,52 @@ repos:
args: [--silent, -E, fix_docstrings]

- repo: https://github.com/asottile/pyupgrade
rev: v2.37.2
rev: v3.15.2
hooks:
- id: pyupgrade
name: Rewrite Code to be Py3.7+
name: Rewrite Code to be Py3.8+
args: [
--py37-plus
--py38-plus
]
exclude: src/saltext/pushover/version.py

- repo: https://github.com/asottile/reorder_python_imports
rev: v3.10.0
- repo: https://github.com/PyCQA/isort
rev: 5.13.2
hooks:
- id: reorder-python-imports
- id: isort
args: [
--py37-plus,
--py 38,
]
exclude: src/saltext/pushover/version.py
exclude: src/saltext/pushover/(__init__|version).py

- repo: https://github.com/psf/black
rev: 22.6.0
rev: 24.2.0
hooks:
- id: black
args: [-l 100]
exclude: src/saltext/pushover/version.py

- repo: https://github.com/adamchainz/blacken-docs
rev: v1.12.1
rev: 1.16.0
hooks:
- id: blacken-docs
args: [--skip-errors]
files: ^(docs/.*\.rst|src/saltext/pushover/.*\.py)$
additional_dependencies:
- black==22.6.0
- black==24.2.0
# <---- Formatting -----------------------------------------------------------------------------

# ----- Security ------------------------------------------------------------------------------>
- repo: https://github.com/PyCQA/bandit
rev: "1.7.4"
rev: 1.7.8
hooks:
- id: bandit
alias: bandit-salt
name: Run bandit against the code base
args: [--silent, -lll, --skip, B701]
exclude: src/saltext/pushover/version.py
- repo: https://github.com/PyCQA/bandit
rev: "1.7.4"
rev: 1.7.8
hooks:
- id: bandit
alias: bandit-tests
Expand All @@ -112,7 +112,7 @@ repos:

# ----- Code Analysis ------------------------------------------------------------------------->
- repo: https://github.com/saltstack/mirrors-nox
rev: v2021.6.12
rev: v2022.11.21
hooks:
- id: nox
alias: lint-src
Expand All @@ -125,7 +125,7 @@ repos:
- --

- repo: https://github.com/saltstack/mirrors-nox
rev: v2021.6.12
rev: v2022.11.21
hooks:
- id: nox
alias: lint-tests
Expand Down
1 change: 0 additions & 1 deletion .pre-commit-hooks/make-autodocs.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import subprocess
from pathlib import Path


repo_path = Path(subprocess.check_output(["git", "rev-parse", "--show-toplevel"]).decode().strip())
src_dir = repo_path / "src" / "saltext" / "pushover"
doc_dir = repo_path / "docs"
Expand Down
18 changes: 18 additions & 0 deletions docs/_ext/saltdomain.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
"""
Copied/distilled from Salt doc/_ext/saltdomain.py in order to be able
to use Salt's custom doc refs.
"""


def setup(app):
app.add_crossref_type(
directivename="conf_master",
rolename="conf_master",
indextemplate="pair: %s; conf/master",
)
app.add_crossref_type(
directivename="conf_minion",
rolename="conf_minion",
indextemplate="pair: %s; conf/minion",
)
return {"parallel_read_safe": True, "parallel_write_safe": True}
1 change: 1 addition & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@
"sphinx.ext.coverage",
"sphinx_copybutton",
"sphinxcontrib.spelling",
"saltdomain",
"sphinxcontrib.towncrier.ext",
"myst_parser",
"sphinx_inline_tabs",
Expand Down
8 changes: 4 additions & 4 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
nox.options.error_on_missing_interpreters = False

# Python versions to test against
PYTHON_VERSIONS = ("3", "3.7", "3.8", "3.9", "3.10")
PYTHON_VERSIONS = ("3", "3.8", "3.9", "3.10", "3.11", "3.12")
# Be verbose when running under a CI context
CI_RUN = (
os.environ.get("JENKINS_URL") or os.environ.get("CI") or os.environ.get("DRONE") is not None
Expand All @@ -29,7 +29,7 @@
EXTRA_REQUIREMENTS_INSTALL = os.environ.get("EXTRA_REQUIREMENTS_INSTALL")

COVERAGE_VERSION_REQUIREMENT = "coverage==5.2"
SALT_REQUIREMENT = os.environ.get("SALT_REQUIREMENT") or "salt>=3005"
SALT_REQUIREMENT = os.environ.get("SALT_REQUIREMENT") or "salt>=3006"
if SALT_REQUIREMENT == "salt==master":
SALT_REQUIREMENT = "git+https://github.com/saltstack/salt.git@master"

Expand Down Expand Up @@ -70,8 +70,8 @@ def _get_session_python_version_info(session):

def _get_pydir(session):
version_info = _get_session_python_version_info(session)
if version_info < (3, 7):
session.error("Only Python >= 3.7 is supported")
if version_info < (3, 8):
session.error("Only Python >= 3.8 is supported")
return f"py{version_info[0]}.{version_info[1]}"


Expand Down
91 changes: 48 additions & 43 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,19 @@ classifiers = [
"Programming Language :: Cython",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"License :: OSI Approved :: Apache Software License",
]
requires-python = ">= 3.7"
requires-python = ">= 3.8"
dynamic = ["version"]
dependencies = [
"salt>=3005",
"salt>=3006",
]

[project.readme]
Expand Down Expand Up @@ -67,8 +68,6 @@ docs = [
"myst_parser",
"furo",
"sphinx-inline-tabs",
"furo<=2023.03.27; python_version < '3.8'",
"importlib_metadata; python_version < '3.8'",
]
docsauto = ["sphinx-autobuild"]
lint = [
Expand Down Expand Up @@ -107,42 +106,48 @@ build_dir = "build/sphinx"
[tool.black]
line-length = 100

[tool.isort]
force_single_line = true
skip = ["src/saltext/pushover/__init__.py"]
profile = "black"
line_length = 100

[tool.towncrier]
package = "saltext.pushover"
filename = "CHANGELOG.md"
template = "changelog/.template.jinja"
directory = "changelog/"
start_string = "# Changelog\n"
underlines = ["", "", ""]
title_format = "## {version} ({project_date})"
issue_format = "[#{issue}](https://github.com/salt-extensions/saltext-pushover/issues/{issue})"

[[tool.towncrier.type]]
directory = "removed"
name = "Removed"
showcontent = true

[[tool.towncrier.type]]
directory = "deprecated"
name = "Deprecated"
showcontent = true

[[tool.towncrier.type]]
directory = "changed"
name = "Changed"
showcontent = true

[[tool.towncrier.type]]
directory = "fixed"
name = "Fixed"
showcontent = true

[[tool.towncrier.type]]
directory = "added"
name = "Added"
showcontent = true

[[tool.towncrier.type]]
directory = "security"
name = "Security"
showcontent = true
package = "saltext.pushover"
filename = "CHANGELOG.md"
template = "changelog/.template.jinja"
directory = "changelog/"
start_string = "# Changelog\n"
underlines = ["", "", ""]
title_format = "## {version} ({project_date})"
issue_format = "[#{issue}](https://github.com/salt-extensions/saltext-pushover/issues/{issue})"

[[tool.towncrier.type]]
directory = "removed"
name = "Removed"
showcontent = true

[[tool.towncrier.type]]
directory = "deprecated"
name = "Deprecated"
showcontent = true

[[tool.towncrier.type]]
directory = "changed"
name = "Changed"
showcontent = true

[[tool.towncrier.type]]
directory = "fixed"
name = "Fixed"
showcontent = true

[[tool.towncrier.type]]
directory = "added"
name = "Added"
showcontent = true

[[tool.towncrier.type]]
directory = "security"
name = "Security"
showcontent = true
4 changes: 3 additions & 1 deletion src/saltext/pushover/modules/pushover_notify.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,14 @@
pushover:
token: abAHuZyCLtdH8P4zhmFZmgUHUsv1ei8
"""

import logging
import urllib.parse

import saltext.pushover.utils.pushover
from salt.exceptions import SaltInvocationError

import saltext.pushover.utils.pushover

log = logging.getLogger(__name__)
__virtualname__ = "pushover"

Expand Down
4 changes: 3 additions & 1 deletion src/saltext/pushover/returners/pushover_returner.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,16 @@
salt '*' test.ping --return pushover --return_kwargs '{"title": "Salt is awesome!"}'

"""

import logging
import pprint
import urllib.parse

import salt.returners
import saltext.pushover.utils.pushover
from salt.exceptions import SaltInvocationError

import saltext.pushover.utils.pushover

log = logging.getLogger(__name__)

__virtualname__ = "pushover"
Expand Down
1 change: 1 addition & 0 deletions src/saltext/pushover/utils/pushover.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

.. versionadded:: 2016.3.0
"""

import http.client
import logging
from urllib.parse import urlencode
Expand Down
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
import os

import pytest
from saltext.pushover import PACKAGE_ROOT
from saltfactories.utils import random_string

from saltext.pushover import PACKAGE_ROOT

# Reset the root logger to its default level(because salt changed it)
logging.root.setLevel(logging.WARNING)
Expand Down
1 change: 1 addition & 0 deletions tests/unit/states/test_pushover.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from unittest.mock import patch

import pytest

import saltext.pushover.modules.pushover_notify as pushover_exemod
import saltext.pushover.states.pushover as po

Expand Down
Loading