Skip to content

Commit

Permalink
Upgrade to repo-config v0.5.2 (#153)
Browse files Browse the repository at this point in the history
All the changes are related to regenerating the files using the
cookiecutter templates in repo-config v0.5.2.

- Remove extensions from replay file
- Add empty `Introduction` variable
- Bump repo-config version to v0.5.2.
- Add common pylint options
- Add common source paths for isort
- Add editorconfig file
- Use repo-config for linting examples in docstrings
- ci: Checkout submodules
- Add a workflow to make sure release notes are updated
- Don't ship development files in the source distribution
- Add and sort mkdocs markdown extensions
- mkdocs: Add comment with more info about cross-linking
- Bump setuptools version
  • Loading branch information
llucax authored Sep 11, 2023
2 parents fbcbe76 + e1e8344 commit b48d51b
Show file tree
Hide file tree
Showing 9 changed files with 94 additions and 232 deletions.
12 changes: 1 addition & 11 deletions .cookiecutter-replay.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"cookiecutter": {
"Introduction": "",
"type": "lib",
"name": "channels",
"description": "Channel implementations for Python",
Expand All @@ -13,17 +14,6 @@
"pypi_package_name": "frequenz-channels",
"github_repo_name": "frequenz-channels-python",
"default_codeowners": "@frequenz-floss/python-sdk-team",
"_extensions": [
"jinja2_time.TimeExtension",
"local_extensions.default_codeowners",
"local_extensions.github_repo_name",
"local_extensions.keywords",
"local_extensions.pypi_package_name",
"local_extensions.python_package",
"local_extensions.src_path",
"local_extensions.title",
"local_extensions.as_identifier"
],
"_template": "gh:frequenz-floss/frequenz-repo-config-python"
}
}
26 changes: 26 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# EditorConfig is awesome: https://EditorConfig.org

# top-most EditorConfig file
root = true

# Unix-style newlines with a newline ending every file
[*]
end_of_line = lf
insert_final_newline = true

# Set default charset, indent style and trimming of whitespace
[{.editorconfig,CODEOWNERS,LICENSE,*.{in,json,md,proto,py,pyi,toml,yaml,yml}}]
charset = utf-8
indent_style = space
trim_trailing_whitespace = true

# 4 space indentation
[*.{py,pyi}]
indent_size = 4

# 2 space indentation
[{.editorconfig,CODEOWNERS,LICENSE,*.{in,json,proto,toml,yaml,yml}}]
indent_size = 2

# No indentation size specified for *.md because different blocks have
# different indentation rules
3 changes: 3 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,16 @@
- LICENSE

"part:tests":
- "**/conftest.py"
- "tests/**"

"part:tooling":
- "**/*.ini"
- "**/*.toml"
- "**/*.yaml"
- "**/*.yml"
- "**/conftest.py"
- ".editorconfig"
- ".git*"
- ".git*/**"
- "docs/*.py"
Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ jobs:
steps:
- name: Fetch sources
uses: actions/checkout@v4
with:
submodules: true

- name: Set up Python
uses: actions/setup-python@v4
Expand All @@ -61,6 +63,8 @@ jobs:
steps:
- name: Fetch sources
uses: actions/checkout@v4
with:
submodules: true

- name: Set up Python
uses: actions/setup-python@v4
Expand Down Expand Up @@ -90,6 +94,8 @@ jobs:
steps:
- name: Fetch sources
uses: actions/checkout@v4
with:
submodules: true

- name: Setup Git user and e-mail
uses: frequenz-floss/setup-git-user@v2
Expand Down Expand Up @@ -167,6 +173,8 @@ jobs:
- name: Fetch sources
if: steps.mike-metadata.outputs.version
uses: actions/checkout@v4
with:
submodules: true

- name: Setup Git user and e-mail
if: steps.mike-metadata.outputs.version
Expand Down
28 changes: 28 additions & 0 deletions .github/workflows/release-notes-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Release Notes Check

on:
merge_group:
pull_request:
types:
# On by default if you specify no types.
- "opened"
- "reopened"
- "synchronize"
# For `skip-label` only.
- "labeled"
- "unlabeled"


jobs:
check-release-notes:
name: Check release notes are updated
runs-on: ubuntu-latest
steps:
- name: Check for a release notes update
if: github.event_name == 'pull_request'
uses: brettcannon/check-for-changed-files@4170644959a21843b31f1181f2a1761d65ef4791 # v1.2.0
with:
file-pattern: "RELEASE_NOTES.md"
prereq-pattern: "src/**"
skip-label: "cmd:skip-release-notes"
failure-message: "Missing a release notes update. Please add one or apply the ${skip-label} label to the pull request"
13 changes: 10 additions & 3 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
exclude .gitignore
exclude .cookiecutter-replay.json
exclude .darglint
exclude noxfile.py
exclude .editorconfig
exclude .gitignore
exclude CODEOWNERS
exclude CONTRIBUTING.md
exclude mkdocs.yml
exclude noxfile.py
exclude src/conftest.py
recursive-exclude .github *
recursive-exclude tests *
recursive-exclude benchmarks *
recursive-exclude docs *
recursive-exclude tests *
recursive-include py *.pyi
6 changes: 3 additions & 3 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,6 @@ markdown_extensions:
anchor_linenums: true
line_spans: __span
pygments_lang_class: true
- pymdownx.superfences
- pymdownx.tasklist
- pymdownx.tabbed
- pymdownx.keys
- pymdownx.snippets:
check_paths: true
Expand All @@ -79,6 +76,8 @@ markdown_extensions:
- name: mermaid
class: mermaid
format: "!!python/name:pymdownx.superfences.fence_code_format"
- pymdownx.tabbed
- pymdownx.tasklist
- toc:
permalink: "¤"

Expand All @@ -104,6 +103,7 @@ plugins:
show_root_members_full_path: true
show_source: true
import:
# See https://mkdocstrings.github.io/python/usage/#import for details
- https://docs.python.org/3/objects.inv
- https://typing-extensions.readthedocs.io/en/stable/objects.inv
- search
Expand Down
19 changes: 10 additions & 9 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@

[build-system]
requires = [
"setuptools == 67.7.2",
"setuptools == 68.1.0",
"setuptools_scm[toml] == 7.1.0",
"frequenz-repo-config[lib] == 0.4.0",
"frequenz-repo-config[lib] == 0.5.2",
]
build-backend = "setuptools.build_meta"

Expand Down Expand Up @@ -49,14 +49,14 @@ dev-mkdocs = [
"mkdocs-material == 9.2.8",
"mkdocs-section-index == 0.3.6",
"mkdocstrings[python] == 0.23.0",
"frequenz-repo-config[lib] == 0.4.0",
"frequenz-repo-config[lib] == 0.5.2",
]
dev-mypy = [
"mypy == 1.5.1",
# For checking the noxfile, docs/ script, and tests
"frequenz-channels[dev-mkdocs,dev-noxfile,dev-pytest]",
]
dev-noxfile = ["nox == 2023.4.22", "frequenz-repo-config[lib] == 0.4.0"]
dev-noxfile = ["nox == 2023.4.22", "frequenz-repo-config[lib] == 0.5.2"]
dev-pylint = [
"pylint == 2.17.5",
# For checking the noxfile, docs/ script, and tests
Expand All @@ -67,10 +67,8 @@ dev-pytest = [
"async-solipsism == 0.5",
"hypothesis == 6.84.2",
"pytest-asyncio == 0.21.1",
"frequenz-repo-config[extra-lint-examples] == 0.5.2",
"pytest-mock == 3.11.1",
# For checking docs examples
"sybil == 5.0.3",
"pylint == 2.17.5",
]
dev = [
"frequenz-channels[dev-mkdocs,dev-docstrings,dev-formatting,dev-mkdocs,dev-mypy,dev-noxfile,dev-pylint,dev-pytest]",
Expand All @@ -90,7 +88,7 @@ include = '\.pyi?$'
[tool.isort]
profile = "black"
line_length = 88
src_paths = ["src", "examples", "tests"]
src_paths = ["benchmarks", "examples", "src", "tests"]

[tool.pylint.similarities]
ignore-comments = ['yes']
Expand All @@ -104,10 +102,13 @@ disable = [
# disabled because it conflicts with isort
"wrong-import-order",
"ungrouped-imports",
# pylint's unsubscriptable check is buggy and is not needed because
# it is a type-check, for which we already have mypy.
"unsubscriptable-object",
]

[tool.pytest.ini_options]
testpaths = ["tests", "src"] # src for docs examples
testpaths = ["tests", "src"]
asyncio_mode = "auto"
required_plugins = ["pytest-asyncio", "pytest-mock"]
markers = [
Expand Down
Loading

0 comments on commit b48d51b

Please sign in to comment.