Skip to content

feat: add comments support #1495

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 26 commits into from
Jun 16, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
a8448d3
xfail: acceptance test for Document.comments
scanny Jun 10, 2025
0918eae
comments: add Document.comments
scanny Jun 10, 2025
ba99fd1
comments: add DocumentPart.comments
scanny Jun 10, 2025
c845531
comments: add DocumentPart._comments_part
scanny Jun 10, 2025
dbc7527
comments: add CommentsPart.comments
scanny Jun 10, 2025
4bc6f65
comments: package-loader loads CommentsPart
scanny Jun 10, 2025
c3fa43f
comments: add Comments.__len__()
scanny Jun 10, 2025
4a611e7
comments: add Comments.__iter__()
scanny Jun 10, 2025
0cdfa49
comments: add Comments.get()
scanny Jun 10, 2025
168ae80
comments: add Comment.comment_id
scanny Jun 10, 2025
5ff4fae
xfail: acceptance test for Comment properties
scanny Jun 10, 2025
8cbd08c
comments: add Comment.author
scanny Jun 10, 2025
07133dd
comments: add Comment.initials
scanny Jun 10, 2025
870302b
comments: add Comment.timestamp
scanny Jun 10, 2025
e21a27d
comments: add Comment.paragraphs
scanny Jun 10, 2025
4ff09c1
drawing: add image extraction from Drawing
scanny Jun 10, 2025
1c1351e
xfail: acceptance test for Comment mutations
scanny Jun 10, 2025
9fc77af
comments: add Comments.add_comment()
scanny Jun 10, 2025
fdf9f4e
comments: add Comment.author, .initials setters
scanny Jun 10, 2025
4677ad1
xfail: acceptance test for Document.add_comment()
scanny Jun 10, 2025
ff57c6d
comments: add Document.add_comment()
scanny Jun 9, 2025
a34b339
comments: add Run.mark_comment_range()
scanny Jun 10, 2025
e056454
comments: add Comment.text
scanny Jun 10, 2025
545b739
docs: add Comments docs
scanny Jun 12, 2025
7114e98
build: small adjustments for tox
scanny Jun 13, 2025
b136d15
release: prepare v1.2.0 release
scanny Jun 16, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,21 @@
Release History
---------------

1.2.0 (2025-06-16)
++++++++++++++++++

- Add support for comments
- Drop support for Python 3.8, add testing for Python 3.13


1.1.2 (2024-05-01)
++++++++++++++++++

- Fix #1383 Revert lxml<=4.9.2 pin that breaks Python 3.12 install
- Fix #1385 Support use of Part._rels by python-docx-template
- Add support and testing for Python 3.12


1.1.1 (2024-04-29)
++++++++++++++++++

Expand Down
17 changes: 8 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
BEHAVE = behave
MAKE = make
PYTHON = python
BUILD = $(PYTHON) -m build
TWINE = $(PYTHON) -m twine

.PHONY: accept build clean cleandocs coverage docs install opendocs sdist test
Expand All @@ -24,10 +23,10 @@ help:
@echo " wheel generate a binary distribution into dist/"

accept:
$(BEHAVE) --stop
uv run $(BEHAVE) --stop

build:
$(BUILD)
uv build

clean:
# find . -type f -name \*.pyc -exec rm {} \;
Expand All @@ -38,7 +37,7 @@ cleandocs:
$(MAKE) -C docs clean

coverage:
py.test --cov-report term-missing --cov=docx tests/
uv run pytest --cov-report term-missing --cov=docx tests/

docs:
$(MAKE) -C docs html
Expand All @@ -50,16 +49,16 @@ opendocs:
open docs/.build/html/index.html

sdist:
$(BUILD) --sdist .
uv build --sdist

test:
pytest -x
uv run pytest -x

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

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

wheel:
$(BUILD) --wheel .
uv build --wheel
Binary file added docs/_static/img/comment-parts.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
27 changes: 27 additions & 0 deletions docs/api/comments.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@

.. _comments_api:

Comment-related objects
=======================

.. currentmodule:: docx.comments


|Comments| objects
------------------

.. autoclass:: Comments()
:members:
:inherited-members:
:exclude-members:
part


|Comment| objects
------------------

.. autoclass:: Comment()
:members:
:inherited-members:
:exclude-members:
part
4 changes: 4 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,10 @@

.. |_Columns| replace:: :class:`._Columns`

.. |Comment| replace:: :class:`.Comment`

.. |Comments| replace:: :class:`.Comments`

.. |CoreProperties| replace:: :class:`.CoreProperties`

.. |datetime| replace:: :class:`.datetime.datetime`
Expand Down
Loading