forked from christian-oudard/htmltreediff
-
Notifications
You must be signed in to change notification settings - Fork 2
modernize, drop old python, upgrade lxml #24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
39 commits
Select commit
Hold shift + click to select a range
c27b34a
Refs #24. No longer used
kylegibson-rldatix 0439d2e
Refs #24. Initial flake8 config
kylegibson-rldatix 45972c0
Refs #24. Initial GHA workflow for tests
kylegibson-rldatix befe7b8
Refs #24. Upgrade and use sha refs
kylegibson-rldatix b330bc1
Refs #24. Initial attempt at modernizing
kylegibson-rldatix d87f604
Refs #24. Upgrade and use sha refs
kylegibson-rldatix c9522f9
Refs #24. Drop to 92 since we don''t have full coverage right now
kylegibson-rldatix 2fa8753
Refs #24. Update for pytest
kylegibson-rldatix acd16d0
Refs #24. Use raw string
kylegibson-rldatix 9f310f8
Refs #24. Stop installing flake8 for the test env
kylegibson-rldatix 3fc3732
Refs #24. Stop running lint for each python version
kylegibson-rldatix b45ae97
Refs #24. Fix some flake8 issues
kylegibson-rldatix 60810ac
Refs #24. Rename so pytest can find it
kylegibson-rldatix d526c3a
Refs #24. Better formatting
kylegibson-rldatix 2872792
Refs #24. Refactor, update for pytest
kylegibson-rldatix cbcc594
Refs #24. Updated coverage minimum to 99
kylegibson-rldatix 2e9ee12
Refs #24. Move to pyproject
kylegibson-rldatix 6b6453b
Refs #24. Pin requirements
kylegibson-rldatix 613edf0
Refs #24. Improve case generation
kylegibson-rldatix 4fec3dd
Refs #24. Fix a 16 year old bad test
kylegibson-rldatix d313a2f
Refs #24. Moved to tests folder
kylegibson-rldatix 5bfe7bb
Refs #24. Fix import paths, move assert_* helpers to util
kylegibson-rldatix df9e9fb
Refs #24. Set coverage min to 98 and add a comment
kylegibson-rldatix 44a7e93
Refs #24. Fix import
kylegibson-rldatix ccd8516
Refs #24. Create an issue for increasing coverage back to 100 and ref…
kylegibson-rldatix e7e89fc
Refs #24. Pull out test_util tests into a test test_util
kylegibson-rldatix 45e7cfa
Refs #24. Coverage back at 99
kylegibson-rldatix c2973a7
Refs #24. Refactor
kylegibson-rldatix 00ecc35
Refs #24. Removed duplicate test case and cleaned up a few noqa's
kylegibson-rldatix 2e09e00
Refs #24. Cleaned up GHA triggers, added workflow_dispatch
kylegibson-rldatix b3cba3f
Refs #24. html5lib isn't actually used anymore
kylegibson-rldatix e7229c4
Refs #24. Drop push, pull_request is enough
kylegibson-rldatix 0be29d1
Refs #24. Set lxml lower bound version
kylegibson-rldatix 1cecf65
Refs #24. Test each major version of lxml across python 3.8, 3.10, 3.…
kylegibson-rldatix 72c8e0e
Refs #24. Fixed spec def
kylegibson-rldatix d96e7f7
Refs #24. Stop hiding wheels
kylegibson-rldatix 123480f
Refs #24. 4.2.5 support is still required but building from source on…
kylegibson-rldatix 99e0edd
Refs #24. Converted to markdown and removed/updated stale references
kylegibson-rldatix 6547505
Refs #24. Updated readme path
kylegibson-rldatix File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| [flake8] | ||
| select = E,W,F | ||
| max-line-length = 95 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,70 @@ | ||
| name: CI | ||
|
|
||
| on: | ||
| pull_request: | ||
| workflow_dispatch: | ||
|
|
||
| jobs: | ||
| test: | ||
| runs-on: ubuntu-latest | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| include: | ||
| - python-version: "3.8" | ||
| # 4.2.5 support is still required but building from source is slow | ||
| # and has missing dependencies, so we use a prebuilt wheel | ||
| lxml-spec: "vendor/lxml-4.2.5-cp38-cp38-linux_x86_64.whl" | ||
| # lxml v4 | ||
| - python-version: "3.8" | ||
| lxml-spec: "lxml>=4,<5" | ||
| - python-version: "3.10" | ||
| lxml-spec: "lxml>=4,<5" | ||
| - python-version: "3.11" | ||
| lxml-spec: "lxml>=4,<5" | ||
| - python-version: "3.12" | ||
| lxml-spec: "lxml>=4,<5" | ||
| # lxml v5 | ||
| - python-version: "3.8" | ||
| lxml-spec: "lxml>=5,<6" | ||
| - python-version: "3.10" | ||
| lxml-spec: "lxml>=5,<6" | ||
| - python-version: "3.11" | ||
| lxml-spec: "lxml>=5,<6" | ||
| - python-version: "3.12" | ||
| lxml-spec: "lxml>=5,<6" | ||
| # lxml v6 | ||
| - python-version: "3.8" | ||
| lxml-spec: "lxml>=6,<7" | ||
| - python-version: "3.10" | ||
| lxml-spec: "lxml>=6,<7" | ||
| - python-version: "3.11" | ||
| lxml-spec: "lxml>=6,<7" | ||
| - python-version: "3.12" | ||
| lxml-spec: "lxml>=6,<7" | ||
| # lxml latest | ||
| - python-version: "3.12" | ||
| lxml-spec: "lxml" | ||
| steps: | ||
| - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | ||
| - uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0 | ||
|
kylegibson-rldatix marked this conversation as resolved.
|
||
| with: | ||
| python-version: ${{ matrix.python-version }} | ||
| - name: Install dependencies | ||
| run: | | ||
| pip install --upgrade pip | ||
| pip install "${{ matrix.lxml-spec }}" | ||
| pip install -r requirements/default.txt -r requirements/testing.txt | ||
| pip install -e . | ||
| - name: Run tests | ||
| run: pytest | ||
|
|
||
| lint: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | ||
| - uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0 | ||
|
kylegibson-rldatix marked this conversation as resolved.
|
||
| with: | ||
| python-version: "3.12" | ||
| - run: pip install flake8 | ||
| - run: flake8 htmltreediff | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,7 +9,6 @@ __pycache__/ | |
|
|
||
| build | ||
| dist | ||
| *.whl | ||
| *.egg-info | ||
| .tox | ||
| .workflow | ||
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,73 @@ | ||
| # HTML Tree Diff | ||
|
|
||
| Structure aware diff of XML and HTML documents. | ||
|
|
||
| The intended use is to concisely show the edits that have been made in a | ||
| document, so that authors of html content can review their work. | ||
|
|
||
|
|
||
| ## What do we mean by "HTML Tree Diff"? | ||
|
|
||
| * **HTML:** The inputs to the diff function are HTML documents | ||
| * **Tree:** It considers the full XML tree structure of the inputs, not just text based changes. | ||
| * **Diff:** The output is human-readable HTML, using `<ins>` and `<del>` tags to show the changes. | ||
|
|
||
|
|
||
| ## Command line interface | ||
|
|
||
| You can execute `htmltreediff.cli` directly as a python module, passing it html files to diff: | ||
|
|
||
| ``` | ||
| $ python -m htmltreediff.cli one.html two.html | ||
| <h1> | ||
| <del> | ||
| one | ||
| </del> | ||
| <ins> | ||
| two | ||
| </ins> | ||
| </h1> | ||
| ``` | ||
|
|
||
|
|
||
| ## Python API | ||
|
|
||
| You can also use htmltreediff from within a python program as a library. | ||
|
|
||
| For HTML Changes: | ||
|
|
||
| ```python | ||
| >>> from htmltreediff import diff | ||
| >>> print(diff('<h1>...one...</h1>', '<h1>...two...</h1>', pretty=True)) | ||
| <h1> | ||
| ... | ||
| <del> | ||
| one | ||
| </del> | ||
| <ins> | ||
| two | ||
| </ins> | ||
| ... | ||
| </h1> | ||
| ``` | ||
|
|
||
| And also for text-only changes: | ||
|
|
||
| ```python | ||
| >>> print(diff( | ||
| ... 'The quick brown fox jumps over the lazy dog.', | ||
| ... 'The very quick brown foxes jump over the dog.', | ||
| ... plaintext=False, | ||
| ... )) | ||
| The <ins>very </ins>quick brown <del>fox jumps</del><ins>foxes jump</ins> over the<del> lazy</del> dog. | ||
| ``` | ||
|
|
||
|
|
||
| ## Running the unit tests | ||
|
|
||
| Use `pytest` to run the tests with coverage: | ||
|
|
||
| ```shell | ||
| $ pip install -r requirements/testing.txt | ||
| $ pytest -v | ||
| ``` |
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
im curious if you consideered going to
pyproject.toml?i know it adds an extra dependency for flake8 to have it read
pyproject.toml...Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that's why, because it can't read pyproject natively