Skip to content

Conversation

@scanny
Copy link
Contributor

@scanny scanny commented Oct 2, 2023

  • Bulk updates to remove Python 2 support and modernize code for Black, PEP 257, and typing.
  • Add Run inner-content, in particular RenderedPageBreak. and Run.iter_inner_content() to allow document-order processing of Run content.
  • Add Paragraph inner-content, in particular Hyperlink. and Paragraph.iter_inner_content() to allow document-order processing of Paragraph content.
  • Multiple issue fixes including Paragraph.text includes hyperlink text.

scanny and others added 30 commits September 24, 2023 12:18
This improves packaging reliability because it prevents tests from
running against the current directory instead of the installed version
of the package.
This required a large number of adjustments. I took the opportunity to
make some further clean-up of top-matter.
Also any Python 2 clean-up that was handy.
* encoding header is no longer needed
* from __future__ imports no longer needed
* make module docstrings PEP 257 compliant.
Sphinx handling is actually better, not only using italic but also a
mono-width font.
Done by `docformatter`, it can't get the summary line right if it's too
long, but adjusts the description block width and gets the shorter
docstrings right, so a lot better than doing them all by hand. The rest
will have to wait for hand curation as we go.
Back in the day I thought it better to extract a test-specific fixture
for each test. That had the benefit of making parameterized tests fold
cleanly without the parameters in the decorator. The downside was you
had to look in two places to understand the test so I dropped that
practice. Fix some of these I need to change or add to later.
The old @lazyproperty implementation worked, but was much messier than
the modern version, adding a member to the object __dict__. This later
version that stores the value in the descriptor is much more tidy and
more performant too I expect.
Also for example `BaseStoryPart` -> `StoryPart` for the same reason.
This removes some import cycles.
Metaclasses are different and somewhat better in Python 3. Modernize the
`xmlchemy` custom element metaclass mechanism and remove Python 2
work-arounds that are no longer required.
Add additional run inner-content elements having a text equivalent, in
particular `w:noBreakHyphen` and `w:ptab`. Give each of them their own
custom element class having a `__str__()` method so they can each report
their text content (constant in some cases like "-" for no-break
hyphen).
Replace meta-programming with `enum.Enum` features built into Python 3
to support XML attribute mapping.

Also some random typing and docstring clean-up along the way.
* clean up section (more needs doing in feature/steps and tests)
* acceptance test
* unit test
@scanny scanny merged commit 6df147e into master Oct 10, 2023
@scanny scanny deleted the v1.0.0 branch November 4, 2023 00:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants