Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
6 changes: 3 additions & 3 deletions .github/workflows/continuous-integration-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
fail-fast: false
matrix:
os: ['ubuntu-latest', 'macos-latest', 'windows-latest']
python-version: ['3.6', '3.7', '3.8', '3.9']
python-version: ['3.7', '3.8', '3.9', '3.10']

steps:
- uses: actions/checkout@v2
Expand Down Expand Up @@ -50,7 +50,7 @@ jobs:
run: tox -e pytest -- src tests -m "unit or (not integration and not end_to_end)" --cov=./ --cov-report=xml -n auto

- name: Upload coverage report for unit tests and doctests.
if: runner.os == 'Linux' && matrix.python-version == '3.8'
if: runner.os == 'Linux' && matrix.python-version == '3.9'
shell: bash -l {0}
run: bash <(curl -s https://codecov.io/bash) -F unit -c

Expand All @@ -59,6 +59,6 @@ jobs:
run: tox -e pytest -- src tests -m end_to_end --cov=./ --cov-report=xml -n auto

- name: Upload coverage reports of end-to-end tests.
if: runner.os == 'Linux' && matrix.python-version == '3.8'
if: runner.os == 'Linux' && matrix.python-version == '3.9'
shell: bash -l {0}
run: bash <(curl -s https://codecov.io/bash) -F end_to_end -c
15 changes: 8 additions & 7 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.0.1
rev: v4.1.0
hooks:
- id: check-added-large-files
args: ['--maxkb=25']
Expand All @@ -22,24 +22,25 @@ repos:
- id: rst-inline-touching-normal
- id: text-unicode-replacement-char
- repo: https://github.com/asottile/pyupgrade
rev: v2.29.0
rev: v2.31.0
hooks:
- id: pyupgrade
args: [--py36-plus]
args: [--py37-plus]
- repo: https://github.com/asottile/reorder_python_imports
rev: v2.6.0
rev: v2.7.1
hooks:
- id: reorder-python-imports
args: [--py37-plus, --add-import, 'from __future__ import annotations']
- repo: https://github.com/asottile/setup-cfg-fmt
rev: v1.19.0
rev: v1.20.0
hooks:
- id: setup-cfg-fmt
- repo: https://github.com/psf/black
rev: 21.10b0
rev: 22.1.0
hooks:
- id: black
- repo: https://github.com/asottile/blacken-docs
rev: v1.11.0
rev: v1.12.1
hooks:
- id: blacken-docs
additional_dependencies: [black]
Expand Down
2 changes: 2 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

from setuptools import setup


Expand Down
2 changes: 2 additions & 0 deletions src/latex_dependency_scanner/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
"""The name space for the package."""
from __future__ import annotations

from latex_dependency_scanner.compile import compile_pdf
from latex_dependency_scanner.scanner import scan

Expand Down
12 changes: 6 additions & 6 deletions src/latex_dependency_scanner/compile.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,21 @@
be used by users to compile their documents.

"""
from __future__ import annotations

import os
import shutil
import subprocess
from pathlib import Path
from typing import List
from typing import Optional


DEFAULT_OPTIONS = ["--pdf", "--interaction=nonstopmode", "--synctex=1", "--cd"]


def compile_pdf(
latex_document: Path,
compiled_document: Optional[Path] = None,
args: Optional[List[str]] = None,
compiled_document: Path | None = None,
args: list[str] | None = None,
):
"""Generate a PDF from LaTeX document."""
if shutil.which("latexmk") is None:
Expand All @@ -30,8 +30,8 @@ def compile_pdf(

def _prepare_cmd_options(
latex_document: Path,
compiled_document: Optional[Path] = None,
args: Optional[List[str]] = None,
compiled_document: Path | None = None,
args: list[str] | None = None,
):
"""Prepare the command line arguments to compile the LaTeX document.

Expand Down
12 changes: 6 additions & 6 deletions src/latex_dependency_scanner/scanner.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
"""Includes the ability to scan a LaTeX document."""
from __future__ import annotations

import re
from os.path import splitext
from pathlib import Path
from typing import List
from typing import Optional
from typing import Union


COMMON_TEX_EXTENSIONS = [".ltx", ".tex"]
"""List[str]: List of typical file extensions that contain latex"""
Expand Down Expand Up @@ -47,7 +47,7 @@
document."""


def scan(paths: Union[Path, List[Path]]):
def scan(paths: Path | list[Path]):
"""Scan the documents provided as paths for included files.

Parameters
Expand All @@ -70,8 +70,8 @@ def scan(paths: Union[Path, List[Path]]):

def yield_nodes_from_node(
node: Path,
nodes: List[Path],
relative_to: Optional[Path] = None,
nodes: list[Path],
relative_to: Path | None = None,
):
r"""Yield nodes from node.

Expand Down
2 changes: 2 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
"""Configuration file for pytest."""
from __future__ import annotations

import shutil
from pathlib import Path

Expand Down
2 changes: 2 additions & 0 deletions tests/test_regex.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
"""Test regular expressions."""
from __future__ import annotations

import pytest
from latex_dependency_scanner.scanner import REGEX_TEX

Expand Down
2 changes: 2 additions & 0 deletions tests/test_scan.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

import shutil
import textwrap

Expand Down