scanny / python-pptx

Create Open XML PowerPoint documents in Python

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Make xlsxwriter an optional dependency

BLKSerene opened this issue · comments

Hi, following #760, while it is challenging to remove dependency on lxml, I'm wondering whether it is possible to at least make xlsxwriter an optional dependency (extras_require) in setup.py?

When users try to use charting functionalities without xlsxwriter installed, an exception could be raised with a message saying something like "charting functionalities require xlsxwriter, please install it via pip install xlsxwriter".

Why do you want to avoid the xlsxwriter dependency?

Indeed. lxml is the one (I think) that stops Pythonista on iOS from using python-pptx.

@scanny Just trying to minimize the dependencies. There are a large number of dependencies to handle when packaging the program, and I only need the reading functionalities for pptx files (xlsx writing is also needed in my project, but I use openpyxl instead of xlsxwriter).

@MartinPacker python-docx just won't run and cannot be made to run without lxml. Maybe someone could rewrite it to use the built-in XML support but it would be much slower and would really be a different project. It would involve switching out the entire oxml layer.

Regarding XlsxWriter @BLKSerene I'm not sure what kind of package you're making, maybe you can say more. It doesn't look to me like XlsxWriter itself entails any dependencies and it seems modest in size itself to me.

Have you tried pip install --no-deps python-pptx? That would allow you to install python-pptx by itself and install only the dependencies you need separately. This can also be specified in a requirements.txt file.

Short answer though is that python-pptx is not going to add extras. That would overly complicate what is currently a simple install process. Charts are a 75% use case for PPTX and the savings would benefit only a very narrow set of users as far as I can tell.

I'm going to close this issue since it's not actionable, but I'm happy to continue the conversation here if there's more to say about it.