Explanation
Instantiating a PdfReader or PdfWriter currently allows for passing everything as positional arguments. This is not optimal, especially given that PdfWriter currently has some rather complex logic and associated attributes to determine how to handle the input parameter, leading to issues and the docstring that fileobj and clone_from are identical for compatibility.
The goal is to evaluate migrating most of the parameters to be keyword-only with a proper deprecation period and associated tests.
Main aspects:
PdfReader
stream is a required parameter, but can be positional.
- All remaining parameters should be keyword-only.
PdfWriter
- Empty instances can still be created.
fileobj can be positional or keyword. It should always be used for writing as well.
clone_from should be keyword-only. It will never be used for writing.
- All remaining parameters should be keyword-only.
- Internal attributes like
temp_fileobj and fileobj should not be exposed.
Explanation
Instantiating a PdfReader or PdfWriter currently allows for passing everything as positional arguments. This is not optimal, especially given that PdfWriter currently has some rather complex logic and associated attributes to determine how to handle the input parameter, leading to issues and the docstring that
fileobjandclone_fromare identical for compatibility.The goal is to evaluate migrating most of the parameters to be keyword-only with a proper deprecation period and associated tests.
Main aspects:
PdfReaderstreamis a required parameter, but can be positional.PdfWriterfileobjcan be positional or keyword. It should always be used for writing as well.clone_fromshould be keyword-only. It will never be used for writing.temp_fileobjandfileobjshould not be exposed.