Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
46 changes: 0 additions & 46 deletions .github/actions/setup-poetry/action.yml

This file was deleted.

28 changes: 15 additions & 13 deletions .github/workflows/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ name: Pipeline
on:
push:
branches:
- master
tags:
pull_request:
branches:
Expand All @@ -16,19 +17,19 @@ jobs:
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Set up python
id: setup-python
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
version: "0.7.13"
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Setup Poetry
uses: ./.github/actions/setup-poetry
- name: Behave
id: behave
run: |
source .venv/bin/activate
echo "Running tox with python version $PYTHON_VERSION"
behave
uv run behave

pytest:
runs-on: ubuntu-latest
Expand All @@ -38,15 +39,16 @@ jobs:
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Set up python
id: setup-python
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
version: "0.7.13"
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Setup Poetry
uses: ./.github/actions/setup-poetry
- name: Run Pytest
id: pytest
run: |
source .venv/bin/activate
pytest tests/
uv run pytest tests/
26 changes: 26 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
on:
push:
tags:
- 'v*'

jobs:
pypi-publish:
name: upload release to PyPI
runs-on: ubuntu-latest
environment: pypi
permissions:
id-token: write
steps:
- uses: actions/checkout@v4

- name: Install uv and setup the python version
uses: astral-sh/setup-uv@v5

- name: Install the project
run: uv sync --all-groups

- name: Build wheel
run: uv build

- name: Publish package
run: uv publish
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ _scratch/
Session.vim
/.tox/
.idea
poetry.lock
uv.lock
.python-version

!src/docx/templates/default.docx
test.py
Expand Down
6 changes: 6 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
Release History
---------------

2.2.1 (2025-06-15)
++++++++++++++++++

- Moves project from Poetry to uv
- Re-add's relevant pypi homepage links

2.2.0 (2025-06-15)
++++++++++++++++++

Expand Down
100 changes: 64 additions & 36 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,42 +1,71 @@
[tool.poetry]
[project]
name = "skelmis-docx"
version = "2.2.0"
version = "2.2.1"
description = "Create, read, and update Microsoft Word .docx files."
authors = ["Skelmis <skelmis.craft@gmail.com>"]
license = "MIT"
authors = [{ name = "Skelmis", email = "skelmis.craft@gmail.com" }]
requires-python = ">=3.10"
readme = "README.md"
packages = [{include = "skelmis/docx", from="src"}]

#[project.urls]
#Homepage = "https://github.com/skelmis/python-docx"
#Documentation = "https://skelmis-docx.readthedocs.io/en/latest/"

[tool.poetry.dependencies]
python = "^3.10"
lxml = ">=3.1.0,"
typing-extensions = "^4.12.2"
pywin32 = {version = "^307", platform = "windows"}

[tool.poetry.group.dev.dependencies]
build = "^1.2.1"
ruff = "^0.5.7"
setuptools = "^72.2.0"
tox = "^4.18.0"
twine = "^5.1.1"
types-lxml = "^2024.8.7"
behave = "^1.2.6"
pyparsing = "^3.1.2"
pytest = "^8.3.2"
pytest-coverage = "^0.0"
pytest-xdist = "^3.6.1"
black = "^24.10.0"

[tool.poetry.group.docs.dependencies]
sphinx = "^8.0.2"
license = "MIT"
keywords = ["Docx"]
dependencies = [
"lxml>=3.1.0",
"typing-extensions>=4.12.2,<5",
"pywin32==307 ; sys_platform == 'windows'",
]
classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",

# Specify the Python versions you support here.
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
]

[project.urls]
Homepage = "https://github.com/skelmis/python-docx"
Documentation = "https://skelmis-docx.readthedocs.io/en/latest/"
"Issue tracker" = "https://github.com/Skelmis/python-docx/issues"
Changelog = "https://github.com/Skelmis/python-docx/blob/master/HISTORY.rst"


[dependency-groups]
dev = [
"build>=1.2.1,<2",
"ruff>=0.11.13",
"setuptools>=80.9.0",
"tox>=4.18.0,<5",
"twine>=6.1.0",
"types-lxml>=2024.8.7",
"behave>=1.2.6,<2",
"pyparsing>=3.1.2,<4",
"pytest>=8.3.2,<9",
"pytest-coverage>=0.0,<0.1",
"pytest-xdist>=3.6.1,<4",
"black>=25.1.0",
]
docs = ["sphinx>=8.0.2,<9"]

[tool.uv]
default-groups = [
"dev",
"docs",
]

[tool.hatch.build.targets.sdist]
include = ["src/skelmis/docx"]

[tool.hatch.build.targets.wheel]
include = ["src/skelmis/docx"]

[tool.hatch.build.targets.wheel.sources]
"src/skelmis/docx" = "skelmis/docx"

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
requires = ["hatchling"]
build-backend = "hatchling.build"

[tool.black]
line-length = 100
Expand Down Expand Up @@ -88,7 +117,6 @@ target-version = "py310"
ignore = [
"COM812", # -- over-aggressively insists on trailing commas where not desired --
"PT001", # -- wants @pytest.fixture() instead of @pytest.fixture --
"PT005", # -- wants @pytest.fixture() instead of @pytest.fixture --
]
select = [
"C4", # -- flake8-comprehensions --
Expand All @@ -107,4 +135,4 @@ select = [

[tool.ruff.lint.isort]
known-first-party = ["docx"]
known-local-folder = ["helpers"]
known-local-folder = ["helpers"]
2 changes: 1 addition & 1 deletion src/skelmis/docx/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
if TYPE_CHECKING:
from skelmis.docx.opc.part import Part

__version__ = "2.2.0"
__version__ = "2.2.1"


__all__ = ["Document"]
Expand Down
2 changes: 1 addition & 1 deletion src/skelmis/docx/document.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def configure_styles_for_numbered_lists(self):
STYP = skelmis.docx.enum.style.WD_STYLE_TYPE
num_xml = self.part.numbering_part.element
next_abstract_id = max([J.abstractNumId for J in num_xml.abstractNum_lst]) + 1
l = num_xml._new_abstractNum()
l = num_xml._new_abstractNum() # noqa: E741
l.abstractNumId = next_abstract_id
l.add_multiLevelType().val = "multilevel"

Expand Down
2 changes: 1 addition & 1 deletion src/skelmis/docx/image/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

SIGNATURES = (
# class, offset, signature_bytes
(Png, 0, b"\x89PNG\x0D\x0A\x1A\x0A"),
(Png, 0, b"\x89PNG\x0d\x0a\x1a\x0a"),
(Jfif, 6, b"JFIF"),
(Exif, 6, b"Exif"),
(Gif, 0, b"GIF87a"),
Expand Down
Loading