Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
629f942
rfctr: Blacken code base
scanny Sep 24, 2023
80740f2
build: move docx package under src/ directory
scanny Sep 25, 2023
6ac2c69
build: modernize packaging
scanny Sep 25, 2023
163cfc1
lint: add isort linting in ruff
scanny Sep 25, 2023
d509784
lint: fix C4xx comprehension errors
scanny Sep 26, 2023
878f758
lint: fix flake8-pytest-style diagnostics
scanny Sep 26, 2023
c8aad1c
lint: fix flake8-simplify diagnostics
scanny Sep 26, 2023
5cb952f
rfctr: remove Python 2 compatibility layer
scanny Sep 26, 2023
cbf940c
rfctr: bulk Python 2 formatting updates
scanny Sep 26, 2023
e88e1d5
rfctr: change param ref from asterisk to backticks
scanny Sep 28, 2023
1c5bb28
rfctr: bulk best-efforts PEP 257 docstrings
scanny Sep 28, 2023
5cd150e
rfctr: bulk test-layout updates
scanny Sep 27, 2023
ae6592b
rfctr: bulk remove __slots__
scanny Sep 30, 2023
99e9a0e
rfctr: modernize lazyproperty
scanny Sep 30, 2023
08ab7e6
rfctr: improve typing
scanny Sep 26, 2023
8280771
rfctr: add type-stubs for behave
scanny Sep 30, 2023
160e709
rfctr: rename private classes now used for typing
scanny Sep 30, 2023
5c1b2f0
rfctr: extract oxml.parser
scanny Sep 27, 2023
f07823c
spike: rejigger xmlchemy
scanny Sep 27, 2023
4935c30
docs: document hyperlink analysis
Mar 14, 2016
fd54be1
acpt: add Run inner-content scenarios
scanny Sep 30, 2023
45bf74b
rfctr: add types to Run and its tests
scanny Sep 30, 2023
ceb8cbe
rfctr: add types to Paragraph and its tests
scanny Oct 1, 2023
2e13d5c
run: Run.text includes no-break hyphen, etc.
scanny Sep 30, 2023
2364e90
run: add Run.contains_page_break
scanny Sep 30, 2023
08ee10a
run: add Run.iter_inner_content()
scanny Oct 1, 2023
1afedd0
acpt: add Paragraph inner-content scenarios
scanny Oct 1, 2023
b85b24f
para: add Paragraph.contains_page_break
scanny Oct 1, 2023
e654522
para: add Paragraph.hyperlinks
scanny Oct 1, 2023
57d93e1
para: add Paragraph.iter_inner_content()
scanny Oct 1, 2023
9dd2851
para: add Paragraph.rendered_page_breaks
scanny Oct 1, 2023
7868f3e
acpt: add Hyperlink properties scenarios
scanny Oct 1, 2023
16e3f10
hlink: add Hyperlink.address
scanny Oct 1, 2023
d0499b9
hlink: add Hyperlink.contains_page_break
scanny Oct 1, 2023
01061a8
hlink: add Hyperlink.runs
scanny Oct 1, 2023
a02c220
hlink: add Hyperlink.text
scanny Oct 1, 2023
9abd14a
para: Paragraph.text includes hyperlink text
scanny Oct 1, 2023
557fdee
acpt: add RenderedPageBreak split-para scenarios
scanny Oct 1, 2023
ac6c216
lrpb: add RenderedPageBreak.preceding_pa..fragment
scanny Oct 1, 2023
1e42c55
lrpb: add RenderedPageBreak.following_pa..fragment
scanny Oct 1, 2023
e47dfa2
docs: update docs with recent additions
scanny Oct 1, 2023
5b3ee80
release: prepare v1.0.0rc1 release
scanny Oct 2, 2023
8122909
rfctr: rework enums so they type-check
scanny Oct 7, 2023
58c2453
rfctr: Section type-checks clean
scanny Oct 8, 2023
b61b63b
rfctr: Paragraph type-checks clean
scanny Oct 8, 2023
ac26854
rfctr: Run type-checks clean
scanny Oct 9, 2023
44f9ede
rfctr: Font type-checks clean
scanny Oct 9, 2023
12a6bb8
rfctr: remove obsolete inherit-from-`object`
scanny Oct 9, 2023
9c9106f
section: Section.iter_inner_content()
scanny Oct 10, 2023
7ab9d31
docs: small docs fixes
scanny Oct 10, 2023
6df147e
release: prepare v1.0.0 release
scanny Oct 10, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
/build/
.coverage
/dist/
/docs/.build/
/*.egg-info
/src/*.egg-info
*.pyc
.pytest_cache/
_scratch/
Expand Down
20 changes: 20 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,26 @@
Release History
---------------

1.0.0 (2023-10-01)
+++++++++++++++++++

- Remove Python 2 support. Supported versions are 3.7+
* Fix #85: Paragraph.text includes hyperlink text
* Add #1113: Hyperlink.address
* Add Hyperlink.contains_page_break
* Add Hyperlink.runs
* Add Hyperlink.text
* Add Paragraph.contains_page_break
* Add Paragraph.hyperlinks
* Add Paragraph.iter_inner_content()
* Add Paragraph.rendered_page_breaks
* Add RenderedPageBreak.following_paragraph_fragment
* Add RenderedPageBreak.preceding_paragraph_fragment
* Add Run.contains_page_break
* Add Run.iter_inner_content()
* Add Section.iter_inner_content()


0.8.11 (2021-05-15)
+++++++++++++++++++

Expand Down
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
include HISTORY.rst LICENSE README.rst tox.ini
graft docx/templates
graft src/docx/templates
graft features
graft tests
graft docs
Expand Down
52 changes: 35 additions & 17 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,25 +1,34 @@
BEHAVE = behave
MAKE = make
PYTHON = python
SETUP = $(PYTHON) ./setup.py
BUILD = $(PYTHON) -m build
TWINE = $(PYTHON) -m twine

.PHONY: accept clean coverage docs readme register sdist test upload
.PHONY: accept build clean cleandocs coverage docs install opendocs sdist test
.PHONY: test-upload wheel

help:
@echo "Please use \`make <target>' where <target> is one or more of"
@echo " accept run acceptance tests using behave"
@echo " clean delete intermediate work product and start fresh"
@echo " cleandocs delete intermediate documentation files"
@echo " coverage run nosetests with coverage"
@echo " docs generate documentation"
@echo " opendocs open browser to local version of documentation"
@echo " register update metadata (README.rst) on PyPI"
@echo " sdist generate a source distribution into dist/"
@echo " upload upload distribution tarball to PyPI"
@echo " accept run acceptance tests using behave"
@echo " build generate both sdist and wheel suitable for upload to PyPI"
@echo " clean delete intermediate work product and start fresh"
@echo " cleandocs delete intermediate documentation files"
@echo " coverage run pytest with coverage"
@echo " docs generate documentation"
@echo " opendocs open browser to local version of documentation"
@echo " register update metadata (README.rst) on PyPI"
@echo " sdist generate a source distribution into dist/"
@echo " test run unit tests using pytest"
@echo " test-upload upload distribution to TestPyPI"
@echo " upload upload distribution tarball to PyPI"
@echo " wheel generate a binary distribution into dist/"

accept:
$(BEHAVE) --stop

build:
$(BUILD)

clean:
find . -type f -name \*.pyc -exec rm {} \;
rm -rf dist *.egg-info .coverage .DS_Store
Expand All @@ -33,14 +42,23 @@ coverage:
docs:
$(MAKE) -C docs html

install:
pip install -Ue .

opendocs:
open docs/.build/html/index.html

register:
$(SETUP) register

sdist:
$(SETUP) sdist
$(BUILD) --sdist .

test:
pytest -x

test-upload: sdist wheel
$(TWINE) upload --repository testpypi dist/*

upload: clean sdist wheel
$(TWINE) upload dist/*

upload:
$(SETUP) sdist upload
wheel:
$(BUILD) --wheel .
26 changes: 26 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# python-docx

*python-docx* is a Python library for reading, creating, and updating Microsoft Word 2007+ (.docx) files.

## Installation

```
pip install python-docx
```

## Example

```python
>>> from docx import Document

>>> document = Document()
>>> document.add_paragraph("It was a dark and stormy night.")
<docx.text.paragraph.Paragraph object at 0x10f19e760>
>>> document.save("dark-and-stormy.docx")

>>> document = Document("dark-and-stormy.docx")
>>> document.paragraphs[0].text
'It was a dark and stormy night.'
```

More information is available in the [python-docx documentation](https://python-docx.readthedocs.org/en/latest/)
10 changes: 0 additions & 10 deletions README.rst

This file was deleted.

30 changes: 15 additions & 15 deletions docs/api/document.rst
Original file line number Diff line number Diff line change
Expand Up @@ -50,68 +50,68 @@ if that behavior is desired.

.. attribute:: author

*string* -- An entity primarily responsible for making the content of the
`string` -- An entity primarily responsible for making the content of the
resource.

.. attribute:: category

*string* -- A categorization of the content of this package. Example
`string` -- A categorization of the content of this package. Example
values might include: Resume, Letter, Financial Forecast, Proposal,
or Technical Presentation.

.. attribute:: comments

*string* -- An account of the content of the resource.
`string` -- An account of the content of the resource.

.. attribute:: content_status

*string* -- completion status of the document, e.g. 'draft'
`string` -- completion status of the document, e.g. 'draft'

.. attribute:: created

*datetime* -- time of intial creation of the document
`datetime` -- time of intial creation of the document

.. attribute:: identifier

*string* -- An unambiguous reference to the resource within a given
`string` -- An unambiguous reference to the resource within a given
context, e.g. ISBN.

.. attribute:: keywords

*string* -- descriptive words or short phrases likely to be used as
`string` -- descriptive words or short phrases likely to be used as
search terms for this document

.. attribute:: language

*string* -- language the document is written in
`string` -- language the document is written in

.. attribute:: last_modified_by

*string* -- name or other identifier (such as email address) of person
`string` -- name or other identifier (such as email address) of person
who last modified the document

.. attribute:: last_printed

*datetime* -- time the document was last printed
`datetime` -- time the document was last printed

.. attribute:: modified

*datetime* -- time the document was last modified
`datetime` -- time the document was last modified

.. attribute:: revision

*int* -- number of this revision, incremented by Word each time the
`int` -- number of this revision, incremented by Word each time the
document is saved. Note however |docx| does not automatically increment
the revision number when it saves a document.

.. attribute:: subject

*string* -- The topic of the content of the resource.
`string` -- The topic of the content of the resource.

.. attribute:: title

*string* -- The name given to the resource.
`string` -- The name given to the resource.

.. attribute:: version

*string* -- free-form version string
`string` -- free-form version string
2 changes: 1 addition & 1 deletion docs/api/shared.rst
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ allowing values to be expressed in the units most appropriate to the context.
:members:
:undoc-members:

*r*, *g*, and *b* are each an integer in the range 0-255 inclusive. Using
`r`, `g`, and `b` are each an integer in the range 0-255 inclusive. Using
the hexidecimal integer notation, e.g. `0x42` may enhance readability
where hex RGB values are in use::

Expand Down
8 changes: 4 additions & 4 deletions docs/api/style.rst
Original file line number Diff line number Diff line change
Expand Up @@ -35,21 +35,21 @@ in the appropriate style.
part, style_id


|_CharacterStyle| objects
|CharacterStyle| objects
-------------------------

.. autoclass:: _CharacterStyle()
.. autoclass:: CharacterStyle()
:show-inheritance:
:members:
:inherited-members:
:exclude-members:
element, part, style_id, type


|_ParagraphStyle| objects
|ParagraphStyle| objects
-------------------------

.. autoclass:: _ParagraphStyle()
.. autoclass:: ParagraphStyle()
:show-inheritance:
:members:
:inherited-members:
Expand Down
14 changes: 14 additions & 0 deletions docs/api/text.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@ Text-related objects
:members:


|Hyperlink| objects
-------------------

.. autoclass:: docx.text.hyperlink.Hyperlink()
:members:


|Run| objects
-------------

Expand All @@ -33,6 +40,13 @@ Text-related objects
:members:


|RenderedPageBreak| objects
---------------------------

.. autoclass:: docx.text.pagebreak.RenderedPageBreak()
:members:


|TabStop| objects
-----------------

Expand Down
Loading