Skip to content

Commit

Permalink
feat: add centralized package dev tools config
Browse files Browse the repository at this point in the history
  • Loading branch information
AAriam committed Oct 23, 2023
1 parent a33cde3 commit 04d2914
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ namespaces = true
# ----------------------------------------- Project Metadata -------------------------------------
#
[project]
version = "0.0.0.dev131"
version = "0.0.0.dev132"
name = "RepoDynamics"
dependencies = [
"packaging >= 23.2, < 24",
Expand Down
23 changes: 23 additions & 0 deletions src/repodynamics/meta/_data/schema/package/dev_config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
$schema: https://json-schema.org/draft/2020-12/schema
title: meta_package_dev_config
description: Package development tools configuration

type: object
additionalProperties: false
properties:
package:
description: Package metadata
type: object
additionalProperties: false
properties:
dev_config:
type: object
default: {}
additionalProperties: false
properties:
max_line_length:
description: Maximum line length
type: integer
default: 100
minimum: 50
maximum: 500
8 changes: 6 additions & 2 deletions src/repodynamics/meta/files/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from pathlib import Path
from typing import Literal
import re
import textwrap

# Non-standard libraries
import tomlkit
Expand Down Expand Up @@ -136,8 +137,11 @@ def init_docstring(self) -> list[tuple[DynamicFile, str]]:
if "main_init" not in docs_config:
self._logger.skip("No docstring set in package.docs.main_init; skipping.")
return []
docstring_text = docs_config["main_init"].strip()
docstring = f'"""\n{docstring_text}\n"""\n'
docstring_text = textwrap.fill(
docs_config["main_init"].strip(),
width=self._meta["package"]["dev_config"]["max_line_length"]
)
docstring = f'"""{docstring_text}\n"""\n'

package_dir_info = self._package_dir_output[0][0]
current_dir_path = package_dir_info.alt_paths[0] if package_dir_info.alt_paths else package_dir_info.path
Expand Down
1 change: 1 addition & 0 deletions src/repodynamics/meta/reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ def _read_raw_metadata(self):
"dev/tags",
"dev/workflows",
"package/conda",
"package/dev_config",
"package/docs",
"package/entry_points",
"package/metadata",
Expand Down

0 comments on commit 04d2914

Please sign in to comment.