Skip to content

Commit

Permalink
Merge pull request #38 from sbillinge/ci
Browse files Browse the repository at this point in the history
ci
  • Loading branch information
sbillinge authored Jun 19, 2024
2 parents cafe504 + 595a05a commit 4506868
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 23 deletions.
6 changes: 3 additions & 3 deletions .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ exclude =
__pycache__,
build,
dist,
versioneer.py,
labpdfproc/_version.py,
doc/manual/source/conf.py
doc/source/conf.py,
*/doc/source/conf.py
builtins = cookiecutter
max-line-length = 115
# Ignore some style 'errors' produced while formatting by 'black' (see link below)
# https://black.readthedocs.io/en/stable/guides/using_black_with_other_tools.html#labels-why-pycodestyle-warnings
Expand Down
1 change: 1 addition & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ repos:
rev: 24.4.2
hooks:
- id: black
exclude: ./doc/source/conf\.py
- repo: https://github.com/pycqa/flake8
rev: 7.0.0
hooks:
Expand Down
3 changes: 2 additions & 1 deletion doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
import os
import sys

import sphinx_rtd_theme

sys.path.insert(0, os.path.abspath("vendor"))


Expand Down Expand Up @@ -107,7 +109,6 @@
# a list of builtin themes.
#
html_theme = "sphinx_rtd_theme"
import sphinx_rtd_theme

html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]

Expand Down
11 changes: 4 additions & 7 deletions doc/source/vendor/youtube.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
def get_size(d, key):
if key not in d:
return None
m = re.match("(\d+)(|%|px)$", d[key])
m = re.match(r"(\d+)(|%|px)$", d[key])
if not m:
raise ValueError("invalid size %r" % d[key])
return int(m.group(1)), m.group(2) or "px"
Expand Down Expand Up @@ -88,8 +88,7 @@ def depart_youtube_node(self, node):

def visit_youtube_node_latex(self, node):
self.body.append(
r"\begin{quote}\begin{center}\fbox{\url{https://www.youtu.be/%s}}\end{center}\end{quote}"
% node["id"]
r"\begin{quote}\begin{center}\fbox{\url{https://www.youtu.be/%s}}\end{center}\end{quote}" % node["id"]
)


Expand All @@ -107,17 +106,15 @@ class YouTube(Directive):
def run(self):
if "aspect" in self.options:
aspect = self.options.get("aspect")
m = re.match("(\d+):(\d+)", aspect)
m = re.match(r"(\d+):(\d+)", aspect)
if m is None:
raise ValueError("invalid aspect ratio %r" % aspect)
aspect = tuple(int(x) for x in m.groups())
else:
aspect = None
width = get_size(self.options, "width")
height = get_size(self.options, "height")
return [
youtube(id=self.arguments[0], aspect=aspect, width=width, height=height)
]
return [youtube(id=self.arguments[0], aspect=aspect, width=width, height=height)]


def unsupported_visit_youtube(self, node):
Expand Down
20 changes: 20 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
[tool.black]
line-length = 115
include = '\.pyi?$'
exclude = '''
/(
\.git
| \.hg
| \.mypy_cache
| \.tox
| \.venv
| _build/
| buck-out
| build
| dist
| ./doc/source/conf\.py
| blib2to3
| tests/data/
| .*conf\.py$
)/
'''
6 changes: 1 addition & 5 deletions {{ cookiecutter.repo_name }}/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,7 @@

with open(path.join(here, "requirements.txt")) as requirements_file:
# Parse requirements.txt, ignoring any commented-out lines.
requirements = [
line
for line in requirements_file.read().splitlines()
if not line.startswith("#")
]
requirements = [line for line in requirements_file.read().splitlines() if not line.startswith("#")]


setup(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,7 @@ def versions_from_parentdir(parentdir_prefix, root, verbose):
root = os.path.dirname(root) # up a level

if verbose:
print(
"Tried directories %s but none started with prefix %s"
% (str(rootdirs), parentdir_prefix)
)
print("Tried directories %s but none started with prefix %s" % (str(rootdirs), parentdir_prefix))
raise NotThisMethod("rootdir doesn't start with parentdir_prefix")


Expand Down Expand Up @@ -322,9 +319,7 @@ def git_pieces_from_vcs(tag_prefix, root, verbose, run_command=run_command):
pieces["distance"] = int(count_out) # total number of commits

# commit date: see ISO-8601 comment in git_versions_from_keywords()
date = run_command(GITS, ["show", "-s", "--format=%ci", "HEAD"], cwd=root)[
0
].strip()
date = run_command(GITS, ["show", "-s", "--format=%ci", "HEAD"], cwd=root)[0].strip()
pieces["date"] = date.strip().replace(" ", "T", 1).replace(" ", "", 1)

return pieces
Expand Down

0 comments on commit 4506868

Please sign in to comment.