Skip to content
This repository has been archived by the owner on Jan 9, 2023. It is now read-only.

Commit

Permalink
Update CI files + black
Browse files Browse the repository at this point in the history
[noissue]
  • Loading branch information
fao89 authored and dralley committed Jul 25, 2022
1 parent aa98551 commit 5133af5
Show file tree
Hide file tree
Showing 105 changed files with 4,792 additions and 3,077 deletions.
10 changes: 8 additions & 2 deletions .ci/scripts/changelog.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,14 @@
from git import Repo

repo = Repo(os.getcwd())
heads = repo.git.ls_remote("--heads", "https://github.com/pulp/pulp-2to3-migration.git").split("\n")
branches = [h.split("/")[-1] for h in heads if re.search(r"^([0-9]+)\.([0-9]+)$", h.split("/")[-1])]
heads = repo.git.ls_remote(
"--heads", "https://github.com/pulp/pulp-2to3-migration.git"
).split("\n")
branches = [
h.split("/")[-1]
for h in heads
if re.search(r"^([0-9]+)\.([0-9]+)$", h.split("/")[-1])
]
branches.sort(key=lambda ver: Version(ver), reverse=True)


Expand Down
4 changes: 3 additions & 1 deletion .ci/scripts/redmine.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@
query_issues = REDMINE_QUERY_URL.split("=")[-1].split(",")
milestone_name = redmine.version.get(MILESTONE_URL.split("/")[-1].split(".")[0]).name
if milestone_name != RELEASE:
raise RuntimeError(f"Milestone name, '{milestone_name}', does not match version, '{RELEASE}'.")
raise RuntimeError(
f"Milestone name, '{milestone_name}', does not match version, '{RELEASE}'."
)

to_update = []
for issue in query_issues:
Expand Down
10 changes: 8 additions & 2 deletions .ci/scripts/update_ci_branches.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,14 @@
initial_branch = None

repo = Repo(os.getcwd())
heads = repo.git.ls_remote("--heads", "https://github.com/pulp/pulp-2to3-migration.git").split("\n")
branches = [h.split("/")[-1] for h in heads if re.search(r"^([0-9]+)\.([0-9]+)$", h.split("/")[-1])]
heads = repo.git.ls_remote(
"--heads", "https://github.com/pulp/pulp-2to3-migration.git"
).split("\n")
branches = [
h.split("/")[-1]
for h in heads
if re.search(r"^([0-9]+)\.([0-9]+)$", h.split("/")[-1])
]
branches.sort(key=lambda ver: Version(ver))

headers = {
Expand Down
10 changes: 8 additions & 2 deletions .ci/scripts/validate_commit_message.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@
KEYWORDS = ["fixes", "closes"]

sha = sys.argv[1]
message = subprocess.check_output(["git", "log", "--format=%B", "-n 1", sha]).decode("utf-8")
message = subprocess.check_output(["git", "log", "--format=%B", "-n 1", sha]).decode(
"utf-8"
)
g = Github(os.environ.get("GITHUB_TOKEN"))
repo = g.get_repo("pulp/pulp-2to3-migration")

Expand Down Expand Up @@ -66,7 +68,11 @@ def __check_changelog(issue):
__check_changelog(issue)
else:
if NO_ISSUE in message:
print("Commit {sha} has no issues but is tagged {tag}.".format(sha=sha[0:7], tag=NO_ISSUE))
print(
"Commit {sha} has no issues but is tagged {tag}.".format(
sha=sha[0:7], tag=NO_ISSUE
)
)
elif "Merge" in message and "cherry picked from commit" in message:
pass
else:
Expand Down
10 changes: 9 additions & 1 deletion flake8.cfg → .flake8
Original file line number Diff line number Diff line change
@@ -1,17 +1,25 @@
[flake8]
exclude = ./docs/*,*/migrations/*, ./pulp_2to3_migration/app/json_schema.py
ignore = W503,Q000,Q003,D100,D104,D105,D106,D200,D202,D204,D205,D400,D401,D402
ignore = E203,W503,Q000,Q003,D100,D104,D106,D200,D205,D400,D401,D402
max-line-length = 100

# Flake8 builtin codes
# --------------------
# E203: no whitespace around ':'. disabled until https://github.com/PyCQA/pycodestyle/issues/373 is fixed
# W503: This enforces operators before line breaks which is not pep8 or black compatible.

# Flake8-quotes extension codes
# -----------------------------
# Q000: double or single quotes only, default is double (don't want to enforce this)
# Q003: Change outer quotes to avoid escaping inner quotes

# Flake8-docstring extension codes
# --------------------------------
# D100: missing docstring in public module
# D104: missing docstring in public package
# D106: missing docstring in public nested class (complains about "class Meta:" and documenting those is silly)
# D200: one-line docstring should fit on one line with quotes
# D205: 1 blank line required between summary line and description
# D400: First line should end with a period
# D401: first line should be imperative (nitpicky)
# D402: first line should not be the function’s “signature” (false positives)
2 changes: 1 addition & 1 deletion .github/template_gitref
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2021.08.26-150-gc95d3f2
2021.08.26-152-g5ab12e7
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ jobs:
with:
python-version: "3.8"

# dev_requirements contains tools needed for flake8, etc.
# lint_requirements contains tools needed for flake8, etc.
- name: Install requirements
run: pip3 install -r dev_requirements.txt
run: pip3 install -r lint_requirements.txt

- name: Check commit message
if: github.event_name == 'pull_request'
Expand All @@ -63,7 +63,7 @@ jobs:

# Lint code.
- name: Run flake8
run: flake8 --config flake8.cfg
run: flake8

- name: Run extra lint checks
run: "[ ! -x .ci/scripts/extra_linting.sh ] || .ci/scripts/extra_linting.sh"
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/scripts/docs-publisher.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,9 @@ def main():
if exit_code != 0:
raise RuntimeError("An error occurred while pushing docs.")
elif build_type == "tag":
if (not re.search("[a-zA-Z]", branch) or "post" in branch) and len(branch.split(".")) > 2:
if (not re.search("[a-zA-Z]", branch) or "post" in branch) and len(
branch.split(".")
) > 2:
# Only publish docs at the root if this is the latest version
r = requests.get("https://pypi.org/pypi/pulp-2to3-migration/json")
latest_version = version.parse(json.loads(r.text)["info"]["version"])
Expand All @@ -131,7 +133,9 @@ def main():
# publish to the root of docs.pulpproject.org
if publish_at_root:
version_components = branch.split(".")
x_y_version = "{}.{}".format(version_components[0], version_components[1])
x_y_version = "{}.{}".format(
version_components[0], version_components[1]
)
remote_path_arg = "%s@%s:%s" % (USERNAME, HOSTNAME, SITE_ROOT)
rsync_command = [
"rsync",
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/scripts/release.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,9 @@ def create_tag_and_build_package(repo, desired_tag, commit_sha, plugin_path):
"""
)
parser = argparse.ArgumentParser(formatter_class=argparse.RawTextHelpFormatter, description=helper)
parser = argparse.ArgumentParser(
formatter_class=argparse.RawTextHelpFormatter, description=helper
)

parser.add_argument(
"release_version",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@
"""
)

parser = argparse.ArgumentParser(formatter_class=argparse.RawTextHelpFormatter, description=helper)
parser = argparse.ArgumentParser(
formatter_class=argparse.RawTextHelpFormatter, description=helper
)

parser.add_argument(
"release_version",
Expand Down
72 changes: 43 additions & 29 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
#
import os
import sys
sys.path.insert(0, os.path.abspath('..')) # noqa

sys.path.insert(0, os.path.abspath("..")) # noqa

import pulp_2to3_migration

Expand All @@ -26,9 +27,9 @@

# -- Project information -----------------------------------------------------

project = 'pulp-2to3-migration'
copyright = '2021, Pulp Team'
author = 'Pulp Team'
project = "pulp-2to3-migration"
copyright = "2021, Pulp Team"
author = "Pulp Team"


# The short X.Y version
Expand All @@ -47,23 +48,23 @@
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.doctest',
'sphinx.ext.intersphinx',
'sphinx.ext.todo',
"sphinx.ext.autodoc",
"sphinx.ext.doctest",
"sphinx.ext.intersphinx",
"sphinx.ext.todo",
]

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
templates_path = ["_templates"]

# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
#
# source_suffix = ['.rst', '.md']
source_suffix = '.rst'
source_suffix = ".rst"

# The master toctree document.
master_doc = 'index'
master_doc = "index"

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand All @@ -75,18 +76,18 @@
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path .
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]

# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
pygments_style = "sphinx"


# -- Options for HTML output -------------------------------------------------

# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = 'alabaster'
html_theme = "alabaster"

# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
Expand All @@ -95,15 +96,15 @@
# html_theme_options = {}

# Add in the restapi.html page for the API docs
html_additional_pages = {'restapi': 'restapi.html'}
html_additional_pages = {"restapi": "restapi.html"}

# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
html_static_path = ["_static"]

# Add in a banner
html_js_files = ['eol_banner.js']
html_js_files = ["eol_banner.js"]

# Custom sidebar templates, must be a dictionary that maps document names
# to template names.
Expand All @@ -119,7 +120,7 @@
# -- Options for HTMLHelp output ---------------------------------------------

# Output file base name for HTML help builder.
htmlhelp_basename = 'pulp-2to3-migrationdoc'
htmlhelp_basename = "pulp-2to3-migrationdoc"


# -- Options for LaTeX output ------------------------------------------------
Expand All @@ -128,15 +129,12 @@
# The paper size ('letterpaper' or 'a4paper').
#
# 'papersize': 'letterpaper',

# The font size ('10pt', '11pt' or '12pt').
#
# 'pointsize': '10pt',

# Additional stuff for the LaTeX preamble.
#
# 'preamble': '',

# Latex figure (float) alignment
#
# 'figure_align': 'htbp',
Expand All @@ -146,8 +144,13 @@
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
(master_doc, 'pulp-2to3-migration.tex', 'pulp-2to3-migration Documentation',
'Pulp Team', 'manual'),
(
master_doc,
"pulp-2to3-migration.tex",
"pulp-2to3-migration Documentation",
"Pulp Team",
"manual",
),
]


Expand All @@ -156,8 +159,13 @@
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
(master_doc, 'pulp-2to3-migration', 'pulp-2to3-migration Documentation',
[author], 1)
(
master_doc,
"pulp-2to3-migration",
"pulp-2to3-migration Documentation",
[author],
1,
)
]


Expand All @@ -167,9 +175,15 @@
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
(master_doc, 'pulp-2to3-migration', 'pulp-2to3-migration Documentation',
author, 'pulp-2to3-migration', 'One line description of project.',
'Miscellaneous'),
(
master_doc,
"pulp-2to3-migration",
"pulp-2to3-migration Documentation",
author,
"pulp-2to3-migration",
"One line description of project.",
"Miscellaneous",
),
]


Expand All @@ -178,4 +192,4 @@
# -- Options for intersphinx extension ---------------------------------------

# Example configuration for intersphinx: refer to the Python standard library.
intersphinx_mapping = {'https://docs.python.org/': None}
intersphinx_mapping = {"https://docs.python.org/": None}
8 changes: 1 addition & 7 deletions func_test_settings.py
Original file line number Diff line number Diff line change
@@ -1,7 +1 @@
DATABASES = {
"default": {
"NAME": "pulp",
"USER": "pulp",
"PASSWORD": "pulp"
}
}
DATABASES = {"default": {"NAME": "pulp", "USER": "pulp", "PASSWORD": "pulp"}}
5 changes: 5 additions & 0 deletions lint_requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# python packages handy for developers, but not required by pulp
black
check-manifest
flake8
flake8-black
2 changes: 1 addition & 1 deletion pulp_2to3_migration/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
default_app_config = 'pulp_2to3_migration.app.Pulp2To3MigrationPluginAppConfig'
default_app_config = "pulp_2to3_migration.app.Pulp2To3MigrationPluginAppConfig"
8 changes: 4 additions & 4 deletions pulp_2to3_migration/app/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
class Pulp2To3MigrationPluginAppConfig(PulpPluginAppConfig):
"""Entry point for the pulp_2to3_migration plugin."""

name = 'pulp_2to3_migration.app'
label = 'pulp_2to3_migration'
version = '0.17.0.dev'
python_package_name = 'pulp-2to3-migration'
name = "pulp_2to3_migration.app"
label = "pulp_2to3_migration"
version = "0.17.0.dev"
python_package_name = "pulp-2to3-migration"
10 changes: 5 additions & 5 deletions pulp_2to3_migration/app/constants.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# for tasking system to ensure only one migration is run at a time
PULP_2TO3_MIGRATION_RESOURCE = 'pulp_2to3_migration'
PULP_2TO3_MIGRATION_RESOURCE = "pulp_2to3_migration"

PULP_2TO3_POLICIES = {
'immediate': 'immediate',
'on_demand': 'on_demand',
'background': 'on_demand',
"immediate": "immediate",
"on_demand": "on_demand",
"background": "on_demand",
}

NOT_USED = 'Not Used'
NOT_USED = "Not Used"

DEFAULT_BATCH_SIZE = 1000
Loading

0 comments on commit 5133af5

Please sign in to comment.