Skip to content

Commit

Permalink
Release 1.0.3 (#50)
Browse files Browse the repository at this point in the history
  • Loading branch information
cscorley authored Nov 13, 2022
1 parent fc3a254 commit ef6894b
Show file tree
Hide file tree
Showing 14 changed files with 66 additions and 61 deletions.
10 changes: 7 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,23 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build
pip install flake8
pip install pytest
- name: Build package
run: |
python -m build
- name: Lint
run: |
pip install flake8
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test
run: |
pip install -e .
pip install pytest
pytest --doctest-modules --doctest-glob='*.rst' --junitxml=junit/test-results-${{ matrix.python-version }}.xml
- name: Upload pytest test results
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ coverage.xml
.hypothesis/
.pytest_cache/
cover/
junit/

# Translations
*.mo
Expand Down
7 changes: 7 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

Nothing yet :)

# 1.0.3

- PR #46 Code optimization for unified diff parsing (Thanks, @babenek)
- Package using build module and pyproject.toml
- Support up to 3.11
- Drop support up to 3.6

# 1.0.2

- Support up to 3.9
Expand Down
35 changes: 35 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
[project]
name = "whatthepatch"
version = "1.0.3"
maintainers = [{ name = "Christopher S. Corley", email = "[email protected]" }]
requires-python = ">=3.7"
readme = "README.rst"
description = "A patch parsing and application library."
keywords = ["patch", "diff", "parser"]
classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: Implementation :: CPython",
"Topic :: Software Development :: Libraries :: Python Modules",
"Topic :: Software Development :: Version Control",
"Topic :: Software Development",
"Topic :: Text Processing",
]

[project.urls]
"Homepage" = "https://github.com/cscorley/whatthepatch"
"Bug Tracker" = "https://github.com/cscorley/whatthepatch/issues"

[build-system]
requires = ["setuptools>=65.0.0", "wheel"]
build-backend = "setuptools.build_meta"
2 changes: 0 additions & 2 deletions setup.cfg

This file was deleted.

40 changes: 0 additions & 40 deletions setup.py

This file was deleted.

File renamed without changes.
6 changes: 3 additions & 3 deletions whatthepatch/apply.py → src/whatthepatch/apply.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# -*- coding: utf-8 -*-

import os.path
import subprocess
import tempfile
import os.path

from . import patch
from .exceptions import SubprocessException, HunkApplyException
from .snippets import which, remove
from .exceptions import HunkApplyException, SubprocessException
from .snippets import remove, which


def apply_patch(diffs):
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion whatthepatch/patch.py → src/whatthepatch/patch.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import re
from collections import namedtuple

from .snippets import split_by_regex, findall_regex
from . import exceptions
from .snippets import findall_regex, split_by_regex

header = namedtuple(
"header",
Expand Down
File renamed without changes.
Empty file added tests/__init__.py
Empty file.
14 changes: 7 additions & 7 deletions tests/test_apply.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
# -*- coding: utf-8 -*-

import whatthepatch as wtp
from whatthepatch import exceptions
from whatthepatch.snippets import which

import pytest
import unittest
from unittest.case import SkipTest

import pytest

from src.whatthepatch import apply_diff, exceptions, parse_patch
from src.whatthepatch.snippets import which


def _apply(src, diff_text, reverse=False, use_patch=False):
diff = next(wtp.parse_patch(diff_text))
return wtp.apply.apply_diff(diff, src, reverse, use_patch)
diff = next(parse_patch(diff_text))
return apply_diff(diff, src, reverse, use_patch)


def _apply_r(src, diff_text, reverse=True, use_patch=False):
Expand Down
10 changes: 5 additions & 5 deletions tests/test_patch.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# -*- coding: utf-8 -*-

import whatthepatch as wtp
from whatthepatch.patch import Change, diffobj, header as headerobj


import os
import time
import unittest
import os

from src import whatthepatch as wtp
from src.whatthepatch.patch import Change, diffobj
from src.whatthepatch.patch import header as headerobj

module_path = os.path.dirname(__file__)

Expand Down

0 comments on commit ef6894b

Please sign in to comment.