Skip to content

Commit

Permalink
MAINT: Move PyPDF2 to pypdf (#1513)
Browse files Browse the repository at this point in the history
All lowercase, no number.

See #1488
  • Loading branch information
MartinThoma authored Dec 23, 2022
1 parent 3214dde commit 3825c7b
Show file tree
Hide file tree
Showing 105 changed files with 515 additions and 503 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug-report.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Which environment were you using when you encountered the problem?
$ python -m platform
# TODO: Your output goes here

$ python -c "import PyPDF2;print(PyPDF2.__version__)"
$ python -c "import pypdf;print(pypdf.__version__)"
# TODO: Your output goes here
```

Expand Down
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/feature-request.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
name: Request a Feature
about: What do you think is missing in PyPDF2?
about: What do you think is missing in pypdf?
title: ''
labels: Feature Request
assignees: MartinThoma
Expand All @@ -16,7 +16,7 @@ Explain briefly what you want to achive.
How would your feature be used? (Remove this if it is not applicable.)

```python
from PyPDF2 import PdfReader, PdfWriter
from pypdf import PdfReader, PdfWriter

... # your new feature in action!
```
2 changes: 1 addition & 1 deletion .github/SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ If you find a potential security issue, please report it to info@martin-thoma.de

We will try to find a fix in a timely manner and will then issue a security
advisory together with the update via GitHub
([example](https://github.com/py-pdf/PyPDF2/security/advisories/GHSA-xcjx-m2pj-8g79)).
([example](https://github.com/py-pdf/pypdf/security/advisories/GHSA-xcjx-m2pj-8g79)).

If you don't get a reaction within 30 days, please open a public issue on
GitHub.
4 changes: 2 additions & 2 deletions .github/workflows/benchmark.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Benchmarking PyPDF2
name: Benchmarking pypdf
on:
push:
branches:
Expand Down Expand Up @@ -27,7 +27,7 @@ jobs:
- name: Install requirements (Python 3)
run: |
pip install -r requirements/ci.txt
- name: Install PyPDF2
- name: Install pypdf
run: |
pip install .
- name: Run benchmark
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/github-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ jobs:
run: |
pip uninstall pycryptodome -y
if: matrix.use-cryptodome == 'false'
- name: Install PyPDF2
- name: Install pypdf
run: |
pip install .
- name: Test with flake8
Expand All @@ -77,7 +77,7 @@ jobs:
python -m coverage run --parallel-mode -m pytest tests -vv
- name: Test with mypy
run : |
mypy PyPDF2 --show-error-codes --disallow-untyped-defs --disallow-incomplete-defs
mypy pypdf --show-error-codes --disallow-untyped-defs --disallow-incomplete-defs
- name: Upload coverage data
uses: actions/upload-artifact@v3
with:
Expand Down Expand Up @@ -105,7 +105,7 @@ jobs:

- name: Test running installed package
working-directory: /tmp
run: python -c "import PyPDF2;print(PyPDF2.__version__)"
run: python -c "import pypdf;print(pypdf.__version__)"

# - name: Release to pypi if tagged.
# if: startsWith(github.ref, 'refs/tags')
Expand Down
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ docs/_build/

# Files generated by some of the scripts
dont_commit_*.pdf
PyPDF2-output.pdf
pypdf-output.pdf
annotated-pdf-link.pdf
Image9.png
PyPDF2_pdfLocation.txt
pypdf_pdfLocation.txt

.python-version
tests/pdf_cache/
Expand Down
14 changes: 7 additions & 7 deletions CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# Contributors

PyPDF2 had a lot of contributors since it started with pyPdf in 2005. We are
pypdf had a lot of contributors since it started with pyPdf in 2005. We are
a free software project without any company affiliation. We cannot pay
contributors, but we do value their contributions. A lot of time, effort, and
expertise went into this project. With this list, we recognize those awesome
people 🤗

The list is definitely not complete. You can find more contributors via the git
history and [GitHubs 'Contributors' feature](https://github.com/py-pdf/PyPDF2/graphs/contributors).
history and [GitHubs 'Contributors' feature](https://github.com/py-pdf/pypdf/graphs/contributors).

## Contributors to the pyPdf / PyPDF2 project
## Contributors to the pypdf (formerly pyPdf / PyPDF2) project

* [DL6ER](https://github.com/DL6ER)
* [ediamondscience](https://github.com/ediamondscience)
Expand All @@ -27,7 +27,7 @@ history and [GitHubs 'Contributors' feature](https://github.com/py-pdf/PyPDF2/gr
* [Rogmann, Sascha](https://github.com/srogmann)
* [sietzeberends](https://github.com/sietzeberends)
* [Stüber, Timo](https://github.com/omit66)
* [Thoma, Martin](https://github.com/MartinThoma): Maintainer of PyPDF2 since April 2022. I hope to build a great community with many awesome contributors. [LinkedIn](https://www.linkedin.com/in/martin-thoma/) | [StackOverflow](https://stackoverflow.com/users/562769/martin-thoma) | [Blog](https://martin-thoma.com/)
* [Thoma, Martin](https://github.com/MartinThoma): Maintainer of pypdf since April 2022. I hope to build a great community with many awesome contributors. [LinkedIn](https://www.linkedin.com/in/martin-thoma/) | [StackOverflow](https://stackoverflow.com/users/562769/martin-thoma) | [Blog](https://martin-thoma.com/)
* [WevertonGomes](https://github.com/WevertonGomesCosta)
* ztravis

Expand All @@ -40,10 +40,10 @@ Contributors are:
(1) Bugs: with complete MCVE
(2) Well-described feature requests
(3) Potentially some more.
The maintainers of PyPDF2 have the last call on that one.
* Community work: This is exceptional. If the maintainers of PyPDF2 see people
The maintainers of pypdf have the last call on that one.
* Community work: This is exceptional. If the maintainers of pypdf see people
being super helpful in answering issues / discussions or being very active on
Stackoverflow, we also consider them being contributors to PyPDF2.
Stackoverflow, we also consider them being contributors to pypdf.

Contributors can add themselves or ask via an Github Issue to be added.

Expand Down
10 changes: 5 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ upload:

clean:
pyclean .
rm -rf tests/__pycache__ PyPDF2/__pycache__ Image9.png htmlcov docs/_build dist dont_commit_merged.pdf dont_commit_writer.pdf PyPDF2.egg-info PyPDF2_pdfLocation.txt .pytest_cache .mypy_cache .benchmarks
rm -rf tests/__pycache__ pypdf/__pycache__ Image9.png htmlcov docs/_build dist dont_commit_merged.pdf dont_commit_writer.pdf pypdf.egg-info pypdf_pdfLocation.txt .pytest_cache .mypy_cache .benchmarks

test:
pytest tests --cov --cov-report term-missing -vv --cov-report html --durations=3 --timeout=60 PyPDF2
pytest tests --cov --cov-report term-missing -vv --cov-report html --durations=3 --timeout=60 pypdf

testtype:
pytest tests --cov --cov-report term-missing -vv --cov-report html --durations=3 --timeout=30 --typeguard-packages=PyPDF2
pytest tests --cov --cov-report term-missing -vv --cov-report html --durations=3 --timeout=30 --typeguard-packages=pypdf

mutation-test:
mutmut run
Expand All @@ -35,7 +35,7 @@ benchmark:
pytest tests/bench.py

mypy:
mypy PyPDF2 --ignore-missing-imports --check-untyped --strict
mypy pypdf --ignore-missing-imports --check-untyped --strict

pylint:
pylint PyPDF2
pylint pypdf
65 changes: 31 additions & 34 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,99 +1,96 @@
[![PyPI version](https://badge.fury.io/py/PyPDF2.svg)](https://badge.fury.io/py/PyPDF2)
[![Python Support](https://img.shields.io/pypi/pyversions/PyPDF2.svg)](https://pypi.org/project/PyPDF2/)
[![](https://img.shields.io/badge/-documentation-green)](https://pypdf2.readthedocs.io/en/stable/)
[![GitHub last commit](https://img.shields.io/github/last-commit/py-pdf/PyPDF2)](https://github.com/py-pdf/PyPDF2)
[![codecov](https://codecov.io/gh/py-pdf/PyPDF2/branch/main/graph/badge.svg?token=id42cGNZ5Z)](https://codecov.io/gh/py-pdf/PyPDF2)
[![PyPI version](https://badge.fury.io/py/pypdf.svg)](https://badge.fury.io/py/pypdf)
[![Python Support](https://img.shields.io/pypi/pyversions/pypdf.svg)](https://pypi.org/project/pypdf/)
[![](https://img.shields.io/badge/-documentation-green)](https://pypdf.readthedocs.io/en/stable/)
[![GitHub last commit](https://img.shields.io/github/last-commit/py-pdf/pypdf)](https://github.com/py-pdf/pypdf)
[![codecov](https://codecov.io/gh/py-pdf/pypdf/branch/main/graph/badge.svg?token=id42cGNZ5Z)](https://codecov.io/gh/py-pdf/pypdf)

# PyPDF2
# pypdf

> **NOTE**: The PyPDF2 project is going back to its roots. PyPDF2==3.0.X will be
> the last version of PyPDF2. Patches for this version will still be applied, but
> development will continue with [`pypdf==3.0.0`](https://pypi.org/project/pyPdf/).
PyPDF2 is a free and open-source pure-python PDF library capable of splitting,
[merging](https://pypdf2.readthedocs.io/en/stable/user/merging-pdfs.html),
[cropping, and transforming](https://pypdf2.readthedocs.io/en/stable/user/cropping-and-transforming.html)
pypdf is a free and open-source pure-python PDF library capable of splitting,
[merging](https://pypdf.readthedocs.io/en/stable/user/merging-pdfs.html),
[cropping, and transforming](https://pypdf.readthedocs.io/en/stable/user/cropping-and-transforming.html)
the pages of PDF files. It can also add
custom data, viewing options, and
[passwords](https://pypdf2.readthedocs.io/en/stable/user/encryption-decryption.html)
to PDF files. PyPDF2 can
[retrieve text](https://pypdf2.readthedocs.io/en/stable/user/extract-text.html)
[passwords](https://pypdf.readthedocs.io/en/stable/user/encryption-decryption.html)
to PDF files. pypdf can
[retrieve text](https://pypdf.readthedocs.io/en/stable/user/extract-text.html)
and
[metadata](https://pypdf2.readthedocs.io/en/stable/user/metadata.html)
[metadata](https://pypdf.readthedocs.io/en/stable/user/metadata.html)
from PDFs as well.


## Installation

You can install PyPDF2 via pip:
You can install pypdf via pip:

```
pip install PyPDF2
pip install pypdf
```

If you plan to use PyPDF2 for encrypting or decrypting PDFs that use AES, you
If you plan to use pypdf for encrypting or decrypting PDFs that use AES, you
will need to install some extra dependencies. Encryption using RC4 is supported
using the regular installation.

```
pip install PyPDF2[crypto]
pip install pypdf[crypto]
```

## Usage

```python
from PyPDF2 import PdfReader
from pypdf import PdfReader

reader = PdfReader("example.pdf")
number_of_pages = len(reader.pages)
page = reader.pages[0]
text = page.extract_text()
```

PyPDF2 can do a lot more, e.g. splitting, merging, reading and creating
pypdf can do a lot more, e.g. splitting, merging, reading and creating
annotations, decrypting and encrypting, and more.

Please see [the documentation](https://pypdf2.readthedocs.io/en/stable/)
Please see [the documentation](https://pypdf.readthedocs.io/en/stable/)
for more usage examples!

A lot of questions are asked and answered
[on StackOverflow](https://stackoverflow.com/questions/tagged/pypdf2).
[on StackOverflow](https://stackoverflow.com/questions/tagged/pypdf)
(formerly tagged with [PyPDF2](https://stackoverflow.com/questions/tagged/pypdf2)).

## Contributions

Maintaining PyPDF2 is a collaborative effort. You can support PyPDF2 by writing
Maintaining pypdf is a collaborative effort. You can support pypdf by writing
documentation, helping to narrow down issues, and adding code.

### Q&A

The experience PyPDF2 users have covers the whole range from beginners who
The experience pypdf users have covers the whole range from beginners who
want to make their live easier to experts who developed software before PDF
existed. You can contribute to the PyPDF2 community by answering questions
on [StackOverflow](https://stackoverflow.com/questions/tagged/pypdf2),
helping in [discussions](https://github.com/py-pdf/PyPDF2/discussions),
existed. You can contribute to the pypdf community by answering questions
on [StackOverflow](https://stackoverflow.com/questions/tagged/pypdf),
helping in [discussions](https://github.com/py-pdf/pypdf/discussions),
and asking users who report issues for [MCVE](https://stackoverflow.com/help/minimal-reproducible-example)'s (Code + example PDF!).


### Issues

A good bug ticket includes a MCVE - a minimal complete verifiable example.
For PyPDF2, this means that you must upload a PDF that causes the bug to occur
For pypdf, this means that you must upload a PDF that causes the bug to occur
as well as the code you're executing with all of the output. Use
`print(PyPDF2.__version__)` to tell us which version you're using.
`print(pypdf.__version__)` to tell us which version you're using.

### Code

All code contributions are welcome, but smaller ones have a better chance to
get included in a timely manner. Adding unit tests for new features or test
cases for bugs you've fixed help us to ensure that the Pull Request (PR) is fine.

PyPDF2 includes a test suite which can be executed with `pytest`:
pypdf includes a test suite which can be executed with `pytest`:

```bash
$ pytest
===================== test session starts =====================
platform linux -- Python 3.6.15, pytest-7.0.1, pluggy-1.0.0
rootdir: /home/moose/GitHub/Martin/PyPDF2
rootdir: /home/moose/GitHub/Martin/pypdf
plugins: cov-3.0.0
collected 233 items

Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

# -- Project information -----------------------------------------------------

project = "PyPDF2"
project = "pypdf"
copyright = "2006 - 2008, Mathieu Fenniak"
author = "Mathieu Fenniak"

Expand Down
8 changes: 4 additions & 4 deletions docs/dev/deprecations.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# The Deprecation Process

PyPDF2 strives to be an excellent library for its current users and for new
pypdf strives to be an excellent library for its current users and for new
ones. We are careful with introducing potentially breaking changes, but we
will do them if they provide value for the community on the long run.

Expand All @@ -9,7 +9,7 @@ users can rely on the following procedure.

## Semantic Versioning

PyPDF2 uses [semantic versioning](https://semver.org/). If you want to avoid
pypdf uses [semantic versioning](https://semver.org/). If you want to avoid
breaking changes, please use dependency pinning (also known as version pinning).
In Python, this is done by specifying the exact version you want to use in a
`requirements.txt` file. A tool that can support you is `pip-compile` from
Expand All @@ -18,9 +18,9 @@ In Python, this is done by specifying the exact version you want to use in a
If you are using [Poetry](https://pypi.org/project/poetry/) it is done with the
`poetry.lock` file.

## How PyPDF2 deprecates features
## How pypdf deprecates features

Assume the current version of PyPDF2 is `x.y.z`. After a discussion (e.g. via
Assume the current version of pypdf is `x.y.z`. After a discussion (e.g. via
GitHub issues) we decided to remove a class / function / method. This is how
we do it:

Expand Down
20 changes: 10 additions & 10 deletions docs/dev/intro.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Developer Intro

PyPDF2 is a library and hence its users are developers. This document is not for
the users, but for people who want to work on PyPDF2 itself.
pypdf is a library and hence its users are developers. This document is not for
the users, but for people who want to work on pypdf itself.

## Installing Requirements

Expand All @@ -11,11 +11,11 @@ pip install -r requirements/dev.txt

## Running Tests

See [testing PyPDF2 with pytest](testing.md)
See [testing pypdf with pytest](testing.md)

## The sample-files git submodule
The reason for having the submodule `sample-files` is that we want to keep
the size of the PyPDF2 repository small while we also want to have an extensive
the size of the pypdf repository small while we also want to have an extensive
test suite. Those two goals contradict each other.

The `resources` folder should contain a select set of core examples that cover
Expand All @@ -34,21 +34,21 @@ git submodule update --init
Git is a command line application for version control. If you don't know it,
you can [play ohmygit](https://ohmygit.org/) to learn it.

GitHub is the service where the PyPDF2 project is hosted. While git is free and
GitHub is the service where the pypdf project is hosted. While git is free and
open source, GitHub is a paid service by Microsoft - but for free in lot of
cases.

[pre-commit](https://pypi.org/project/pre-commit/) is a command line application
that uses git hooks to automatically execute code. This allows you to avoid
style issues and other code quality issues. After you entered `pre-commit install`
once in your local copy of PyPDF2, it will automatically be executed when
once in your local copy of pypdf, it will automatically be executed when
you `git commit`.

## Commit Messages

Having a clean commit message helps people to quickly understand what the commit
was about, without actually looking at the changes. The first line of the
commit message is used to [auto-generate the CHANGELOG](https://github.com/py-pdf/PyPDF2/blob/main/make_changelog.py). For this reason, the format should be:
commit message is used to [auto-generate the CHANGELOG](https://github.com/py-pdf/pypdf/blob/main/make_changelog.py). For this reason, the format should be:

```
PREFIX: DESCRIPTION
Expand All @@ -66,18 +66,18 @@ The `PREFIX` can be:
* `DEP`: A deprecation - either marking something as "this is going to be removed"
or actually removing it.
* `PI`: A performance improvement. This could also be a reduction in the
file size of PDF files generated by PyPDF2.
file size of PDF files generated by pypdf.
* `ROB`: A robustness change. Dealing better with broken PDF files.
* `DOC`: A documentation change.
* `TST`: Adding / adjusting tests.
* `DEV`: Developer experience improvements - e.g. pre-commit or setting up CI
* `MAINT`: Quite a lot of different stuff. Performance improvements are for sure
the most interesting changes in here. Refactorings as well.
* `STY`: A style change. Something that makes PyPDF2 code more consistent.
* `STY`: A style change. Something that makes pypdf code more consistent.
Typically a small change.

## Benchmarks

We need to keep an eye on performance and thus we have a few benchmarks.

See [py-pdf.github.io/PyPDF2/dev/bench](https://py-pdf.github.io/PyPDF2/dev/bench/)
See [py-pdf.github.io/pypdf/dev/bench](https://py-pdf.github.io/PyPDF2/dev/bench/)
Loading

0 comments on commit 3825c7b

Please sign in to comment.