Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Closed
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
36 changes: 36 additions & 0 deletions 36 .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: ci

on:
pull_request:
branches: [ master ]
push:
branches:
- master
- develop

permissions:
contents: write

jobs:

build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Display Python version
run: python -c "import sys; print(sys.version)"
- name: Install test dependencies
run: |
pip install .
pip install -r requirements-test.txt
- name: Test with pytest
run: pytest --cov=pptx --cov-report term-missing tests
- name: Acceptance tests with behave
run: behave --stop
2 changes: 1 addition & 1 deletion 2 .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
.cache
.coverage
/.tox/
*.egg-info
/src/*.egg-info
*.pyc
/dist/
/docs/.build
Expand Down
19 changes: 19 additions & 0 deletions 19 .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
version: 2

# -- set the OS, Python version and other tools you might need --
build:
os: ubuntu-22.04
tools:
python: "3.9"

# -- build documentation in the "docs/" directory with Sphinx --
sphinx:
configuration: docs/conf.py
# -- fail on all warnings to avoid broken references --
# fail_on_warning: true

# -- package versions required to build your documentation --
# -- see https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html --
python:
install:
- requirements: requirements-docs.txt
11 changes: 0 additions & 11 deletions 11 .ruff.toml

This file was deleted.

21 changes: 21 additions & 0 deletions 21 HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,27 @@
Release History
---------------

1.0.2 (2024-08-07)
++++++++++++++++++

- fix: #1003 restore read-only enum members

1.0.1 (2024-08-05)
++++++++++++++++++

- fix: #1000 add py.typed


1.0.0 (2024-08-03)
++++++++++++++++++

- fix: #929 raises on JPEG with image/jpg MIME-type
- fix: #943 remove mention of a Px Length subtype
- fix: #972 next-slide-id fails in rare cases
- fix: #990 do not require strict timestamps for Zip
- Add type annotations


0.6.23 (2023-11-02)
+++++++++++++++++++

Expand Down
2 changes: 1 addition & 1 deletion 2 MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
include HISTORY.rst LICENSE README.rst tox.ini
recursive-include features *
recursive-include pptx/templates *
recursive-include src/pptx/templates *
recursive-include tests *.py
recursive-include tests/test_files *
42 changes: 24 additions & 18 deletions 42 Makefile
Original file line number Diff line number Diff line change
@@ -1,49 +1,55 @@
BEHAVE = behave
MAKE = make
PYTHON = python
SETUP = $(PYTHON) ./setup.py
TWINE = $(PYTHON) -m twine

.PHONY: accept build clean cleandocs coverage docs opendocs

.PHONY: help
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 cached HTML documentation and start fresh"
@echo " coverage run nosetests with coverage"
@echo " docs build HTML documentation using Sphinx (incremental)"
@echo " opendocs open local HTML documentation in browser"
@echo " readme update README.html from README.rst"
@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 cached HTML documentation and start fresh"
@echo " coverage run nosetests with coverage"
@echo " docs build HTML documentation using Sphinx (incremental)"
@echo " opendocs open local HTML documentation in browser"
@echo " test-upload upload distribution to TestPyPI"
@echo " upload upload distribution tarball to PyPI"

.PHONY: accept
accept:
$(BEHAVE) --stop

.PHONY: build
build:
rm -rf dist
$(SETUP) bdist_wheel sdist
python -m build
twine check dist/*

.PHONY: clean
clean:
find . -type f -name \*.pyc -exec rm {} \;
find . -type f -name .DS_Store -exec rm {} \;
rm -rf dist .coverage

.PHONY: cleandocs
cleandocs:
$(MAKE) -C docs clean

.PHONY: coverage
coverage:
py.test --cov-report term-missing --cov=pptx --cov=tests

.PHONY: docs
docs:
$(MAKE) -C docs html

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

.PHONY: test-upload
test-upload: build
$(TWINE) upload --repository testpypi dist/*
twine upload --repository testpypi dist/*

.PHONY: upload
upload: clean build
$(TWINE) upload dist/*
twine upload dist/*
2 changes: 1 addition & 1 deletion 2 docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Philosophy
----------

|pp| aims to broadly support the PowerPoint format (PPTX, PowerPoint 2007 and later),
but its primary commitment is to be _industrial-grade_, that is, suitable for use in a
but its primary commitment is to be *industrial-grade*, that is, suitable for use in a
commercial setting. Maintaining this robustness requires a high engineering standard
which includes a comprehensive two-level (e2e + unit) testing regimen. This discipline
comes at a cost in development effort/time, but we consider reliability to be an
Expand Down
4 changes: 4 additions & 0 deletions 4 features/prs-open-save.feature
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,7 @@ Feature: Round-trip a presentation
When I save and reload the presentation
Then the external relationships are still there
And the package has the expected number of .rels parts

Scenario: Load presentation with invalid image/jpg MIME-type
Given a presentation with an image/jpg MIME-type
Then I can access the JPEG image
8 changes: 3 additions & 5 deletions 8 features/steps/action.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
# encoding: utf-8

"""Gherkin step implementations for click action-related features."""

from __future__ import annotations

from behave import given, then, when
from helpers import test_file

from pptx import Presentation
from pptx.action import Hyperlink
from pptx.enum.action import PP_ACTION

from helpers import test_file


# given ===================================================


Expand Down
28 changes: 7 additions & 21 deletions 28 features/steps/axis.py
Original file line number Diff line number Diff line change
@@ -1,27 +1,21 @@
# encoding: utf-8

"""Gherkin step implementations for chart axis features."""

from __future__ import absolute_import, division, print_function, unicode_literals
from __future__ import annotations

from behave import given, then, when
from helpers import test_pptx

from pptx import Presentation
from pptx.enum.chart import XL_AXIS_CROSSES, XL_CATEGORY_TYPE

from helpers import test_pptx


# given ===================================================


@given("a {axis_type} axis")
def given_a_axis_type_axis(context, axis_type):
prs = Presentation(test_pptx("cht-axis-props"))
chart = prs.slides[0].shapes[0].chart
context.axis = {"category": chart.category_axis, "value": chart.value_axis}[
axis_type
]
context.axis = {"category": chart.category_axis, "value": chart.value_axis}[axis_type]


@given("a major gridlines")
Expand All @@ -33,9 +27,7 @@ def given_a_major_gridlines(context):

@given("a value axis having category axis crossing of {crossing}")
def given_a_value_axis_having_cat_ax_crossing_of(context, crossing):
slide_idx = {"automatic": 0, "maximum": 2, "minimum": 3, "2.75": 4, "-1.5": 5}[
crossing
]
slide_idx = {"automatic": 0, "maximum": 2, "minimum": 3, "2.75": 4, "-1.5": 5}[crossing]
prs = Presentation(test_pptx("cht-axis-props"))
context.value_axis = prs.slides[slide_idx].shapes[0].chart.value_axis

Expand Down Expand Up @@ -122,9 +114,7 @@ def when_I_assign_value_to_axis_has_title(context, value):


@when("I assign {value} to axis.has_{major_or_minor}_gridlines")
def when_I_assign_value_to_axis_has_major_or_minor_gridlines(
context, value, major_or_minor
):
def when_I_assign_value_to_axis_has_major_or_minor_gridlines(context, value, major_or_minor):
axis = context.axis
propname = "has_%s_gridlines" % major_or_minor
new_value = {"True": True, "False": False}[value]
Expand Down Expand Up @@ -210,9 +200,7 @@ def then_axis_has_title_is_value(context, value):


@then("axis.has_{major_or_minor}_gridlines is {value}")
def then_axis_has_major_or_minor_gridlines_is_expected_value(
context, major_or_minor, value
):
def then_axis_has_major_or_minor_gridlines_is_expected_value(context, major_or_minor, value):
axis = context.axis
actual_value = {
"major": axis.has_major_gridlines,
Expand All @@ -233,9 +221,7 @@ def then_axis_major_or_minor_unit_is_value(context, major_or_minor, value):
axis = context.axis
propname = "%s_unit" % major_or_minor
actual_value = getattr(axis, propname)
expected_value = {"20.0": 20.0, "8.4": 8.4, "5.0": 5.0, "4.2": 4.2, "None": None}[
value
]
expected_value = {"20.0": 20.0, "8.4": 8.4, "5.0": 5.0, "4.2": 4.2, "None": None}[value]
assert actual_value == expected_value, "got %s" % actual_value


Expand Down
8 changes: 2 additions & 6 deletions 8 features/steps/background.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
# encoding: utf-8

"""Gherkin step implementations for slide background-related features."""

from __future__ import absolute_import, division, print_function, unicode_literals
from __future__ import annotations

from behave import given, then

from pptx import Presentation

from helpers import test_pptx

from pptx import Presentation

# given ===================================================

Expand Down
8 changes: 2 additions & 6 deletions 8 features/steps/category.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
# encoding: utf-8

"""Gherkin step implementations for chart category features."""

from __future__ import absolute_import, division, print_function, unicode_literals
from __future__ import annotations

from behave import given, then

from pptx import Presentation

from helpers import test_pptx

from pptx import Presentation

# given ===================================================

Expand Down
13 changes: 3 additions & 10 deletions 13 features/steps/chart.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
# encoding: utf-8
"""Gherkin step implementations for chart features."""

"""
Gherkin step implementations for chart features.
"""

from __future__ import absolute_import, print_function
from __future__ import annotations

import hashlib

from itertools import islice

from behave import given, then, when
from helpers import count, test_pptx

from pptx import Presentation
from pptx.chart.chart import Legend
Expand All @@ -19,9 +15,6 @@
from pptx.parts.embeddedpackage import EmbeddedXlsxPart
from pptx.util import Inches

from helpers import count, test_pptx


# given ===================================================


Expand Down
5 changes: 1 addition & 4 deletions 5 features/steps/chartdata.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
# encoding: utf-8

"""Gherkin step implementations for chart data features."""

from __future__ import absolute_import, division, print_function, unicode_literals
from __future__ import annotations

import datetime

Expand All @@ -12,7 +10,6 @@
from pptx.enum.chart import XL_CHART_TYPE
from pptx.util import Inches


# given ===================================================


Expand Down
Loading
Morty Proxy This is a proxified and sanitized view of the page, visit original site.