Python diff wrapper
Project description
moreorless
This is a thin wrapper around difflib.unified_diff that Does The Right Thing
for "No newline at eof". The args are also simplified compared to difflib:
moreorless.unified_diff(
astr: str,
bstr: str,
filename: str,
n: int = 3,
) -> str:
...
# raises moreorless.patch.PatchException
moreorless.patch.apply_single_file(
contents: str,
patch: str,
allow_offsets: bool = True,
) -> str:
...
# uses click to write to stdout with colors
moreorless.click.echo_color_unified_diff(
astr: str,
bstr: str,
filename: str,
n: int = 3
) -> None:
...
# if you want to use unified_diff yourself first (e.g. in another process)
moreorless.click.echo_color_precomputed_diff(
diff: str,
) -> None:
...
# if you want to produce a combined (merge) diff:
moreorless.combined.combined_diff(
[astr, bstr], [cstr]
) -> str:
...
Version Compat
This library is compatible with Python 3.9+, but should be linted under the newest stable version.
Versioning
This library follows meanver, which basically means semver along with a promise to rename when the major version changes.
Install the optional cli extra if you want the colored diff helpers:
pip install moreorless[cli]
License
moreorless is copyright Tim Hatch, and licensed under
the MIT license. I am providing code in this repository to you under an open
source license. This is my personal repository; the license you receive to
my code is from me and not from my employer. See the LICENSE file for details.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file moreorless-0.6.0.tar.gz.
File metadata
- Download URL: moreorless-0.6.0.tar.gz
- Upload date:
- Size: 15.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
175e8afa824006c4356353d97b1cc9699a6ef68a851e0859257cde8d00e88a64
|
|
| MD5 |
f2dc39e8b1c9d54461dcbba25506becf
|
|
| BLAKE2b-256 |
66cd388ad4893c29cc8d54bc35ef6d699f747c7602132361f289dd28ae614448
|
Provenance
The following attestation bundles were made for moreorless-0.6.0.tar.gz:
Publisher:
build.yml on thatch/moreorless
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
moreorless-0.6.0.tar.gz -
Subject digest:
175e8afa824006c4356353d97b1cc9699a6ef68a851e0859257cde8d00e88a64 - Sigstore transparency entry: 1516549813
- Sigstore integration time:
-
Permalink:
thatch/moreorless@d53d536fe07a60c2cf1d5ad9185442680c9d3999 -
Branch / Tag:
refs/tags/v0.6.0 - Owner: https://github.com/thatch
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
build.yml@d53d536fe07a60c2cf1d5ad9185442680c9d3999 -
Trigger Event:
push
-
Statement type:
File details
Details for the file moreorless-0.6.0-py3-none-any.whl.
File metadata
- Download URL: moreorless-0.6.0-py3-none-any.whl
- Upload date:
- Size: 10.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b00997fee924ab86f2e135ba08e4d70d3295a7226d3d083a5c69ec4e2a9e9e83
|
|
| MD5 |
9367c958205b72ba0f0f7d7bae6fa8f0
|
|
| BLAKE2b-256 |
0341503e35f695f45e2f07c623d9540377761beebf5a3ecb2322769b98f284d2
|
Provenance
The following attestation bundles were made for moreorless-0.6.0-py3-none-any.whl:
Publisher:
build.yml on thatch/moreorless
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
moreorless-0.6.0-py3-none-any.whl -
Subject digest:
b00997fee924ab86f2e135ba08e4d70d3295a7226d3d083a5c69ec4e2a9e9e83 - Sigstore transparency entry: 1516550126
- Sigstore integration time:
-
Permalink:
thatch/moreorless@d53d536fe07a60c2cf1d5ad9185442680c9d3999 -
Branch / Tag:
refs/tags/v0.6.0 - Owner: https://github.com/thatch
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
build.yml@d53d536fe07a60c2cf1d5ad9185442680c9d3999 -
Trigger Event:
push
-
Statement type: