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

Fixed stray reno and added script to check the same #691

Merged
merged 5 commits into from
Oct 4, 2022
Merged
Show file tree
Hide file tree
Changes from 3 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
2 changes: 2 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ jobs:
run: black --check --diff retworkx rustworkx retworkx tests
- name: Python Lint
run: flake8 --per-file-ignores='retworkx/__init__.py:F405,F403' setup.py retworkx tests rustworkx
- name: Check stray release notes
run: python3 tools/find_stray_release_notes.py
IvanIsCoding marked this conversation as resolved.
Show resolved Hide resolved
- name: rustworkx-core Rust Tests
run: pushd rustworkx-core && cargo test && popd
- name: rustworkx-core Docs
Expand Down
11 changes: 11 additions & 0 deletions releasenotes/notes/0.11/prepare-0.11-af688e532712c830.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,14 @@ features:

[{'color': 'turquoise', 'size': 'extra large', '__networkx_node__': 'A'}, {'color': 'fuschia', 'size': 'tiny', '__networkx_node__': 'B'}]
WeightedEdgeList[(0, 1, {})]

fixes:
- |
Fixed an issue with the :func:`~retworkx.generators.heavy_hex_graph`,
:func:`~retworkx.generators.directed_heavy_hex_graph`,
:func:`~retworkx.generators.heavy_square_graph`,
and :func:`~retworkx.generators.directed_heavy_square_graph` generator
functions. When the input parameter ``d`` was set to 1 these functions
would previously raise a ``pyo3_runtime.PanicException`` instead of
returning the expected graph (a single node).
Fixed `#452 <https://github.com/Qiskit/retworkx/issues/452>`__

This file was deleted.

53 changes: 53 additions & 0 deletions tools/find_stray_release_notes.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or derivative works of this code must retain this
# copyright notice, and modified files need to carry a notice indicating
# that they have been altered from the originals.

"""Utility script to find any stray release notes."""

import argparse
import multiprocessing
import subprocess
import sys
import re

# release notes regex
reno = re.compile(r"releasenotes\/notes")
# exact release note regex
exact_reno = re.compile(r"^releasenotes\/notes")


def discover_files():
"""Find all .py, .pyx, .pxd files in a list of trees"""
cmd = ["git", "ls-tree", "-r", "--name-only", "HEAD"]
res = subprocess.run(cmd, capture_output=True, check=True, encoding="UTF8")
files = res.stdout.split("\n")
return files


def validate_path(file_path):
"""Validate a path in the git tree."""
if reno.search(file_path) and not exact_reno.search(file_path):
return file_path
return None


def _main():
parser = argparse.ArgumentParser(description="Find any stray release notes.")
_args = parser.parse_args()
files = discover_files()
with multiprocessing.Pool() as pool:
res = pool.map(validate_path, files)
failed_files = [x for x in res if x is not None]
if len(failed_files) > 0:
for failed_file in failed_files:
sys.stderr.write("%s is not in the correct location.\n" % failed_file)
sys.exit(1)
sys.exit(0)


if __name__ == "__main__":
_main()
1 change: 1 addition & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ commands =
black --check --diff {posargs} '../rustworkx' '../tests' '../retworkx'
flake8 --per-file-ignores='../rustworkx/__init__.py:F405,F403' ../setup.py ../rustworkx ../retworkx .
cargo fmt --all -- --check
python3 {toxinidir}/tools/find_stray_release_notes.py
IvanIsCoding marked this conversation as resolved.
Show resolved Hide resolved

[testenv:docs]
basepython = python3
Expand Down