Skip to content
This repository has been archived by the owner on Jun 12, 2024. It is now read-only.

Commit

Permalink
Make docs deps observable by dependabot locally
Browse files Browse the repository at this point in the history
  • Loading branch information
bswck committed Apr 1, 2024
1 parent 30db642 commit c16e6f4
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 22 deletions.
22 changes: 21 additions & 1 deletion extensions/scsgha.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from __future__ import annotations

from itertools import chain
import re
from subprocess import check_output
from typing import Any
Expand Down Expand Up @@ -50,9 +51,28 @@ def use_actions(ctx: Context, action_string: str) -> str:

@pass_context
def use_dev_dependencies(ctx: Context, deps_string: str) -> str:
metadata_chunk = tomli.loads(deps_string)
declared_dev_dependencies = metadata_chunk.get("dev-dependencies") or {}
if not declared_dev_dependencies:
try:
dependency_groups = metadata_chunk["tool"]["poetry"]["group"]
except KeyError:
pass
else:
declared_dev_dependencies.update(
{ # fmt: off
dep: version
for dep, version in chain.from_iterable(
map(
lambda group: (group.get("dependencies") or {}).items(),
dependency_groups.values(),
)
)
}
) # fmt: on
dev_dependencies = ctx.vars["dev_dependencies"] = {
**(ctx.vars.get("dev_dependencies") or {}),
**tomli.loads(deps_string),
**declared_dev_dependencies,
}
ctx.exported_vars.add("dev_dependencies")
return str(dev_dependencies)
Expand Down
21 changes: 2 additions & 19 deletions project/pyproject.toml.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -30,28 +30,11 @@ python = ">={{python}},<{{python_until}}"

[tool.poetry.group.dev.dependencies]

[tool.poetry.group.dev-skeleton.dependencies]
#%- with included=True %#
#%- if False %# (Dependencies managed by skeleton) #% endif %#
#% with included=True %#
#%- include "pyproject.toml" %#
#%- endwith %#

#%- if tests %#

[tool.pytest.ini_options]
addopts = "--doctest-modules"
#%- endif %#

#%- if docs %#

[tool.poetry.group.docs]
optional = true

[tool.poetry.group.docs.dependencies]
markdown-exec = ">=1.3.0"
mkdocs-material = ">=8.2,<10.0.0"
mkdocstrings = { version = ">=0.19.0", extras = ["python"] }
#%- endif %#

[tool.poe.tasks]
#%- if tests %#
test = "pytest -v"
Expand Down
21 changes: 19 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,9 @@ poethepoet = "^0.25.0"
copier = "^9.1.1"
copier-template-tester = "^2.1.1"
copier-templates-extensions = "^0.3.0"
pre-commit = "<3.6.0"

[tool.poetry.group.dev-skeleton.dependencies]
#%- endif %#
[tool.poetry.group.dev-skeleton.dependencies]
# {{_origin|skeleton_notice(snref=snref, srev=srev, scope="dependency group")|indent("# ")}}
mypy = "^1.9.0"
ruff = "^0.3.4"
Expand All @@ -36,6 +35,24 @@ smokeshow = "^0.4.0"
#%- endif %#
keyring = "^25.0.0"

#%- if tests %#

[tool.pytest.ini_options]
addopts = "--doctest-modules"
#%- endif %#

#%- if docs %#

[tool.poetry.group.docs]
optional = true

[tool.poetry.group.docs.dependencies]
markdown-exec = ">=1.3.0"
mkdocs-material = ">=8.2,<10.0.0"
mkdocstrings = { version = ">=0.19.0", extras = ["python"] }

#%- endif %#

#%- if not included %#
[build-system]
requires = ["poetry-core"]
Expand Down

0 comments on commit c16e6f4

Please sign in to comment.