py2exe and matplotlib - Fonts: do I need them all?

Hello all,

I'm new to py2exe but I managed to create a binary executable of my
program. Now I'm experiencing on how to make the final size of the
binary smaller.

I already managed to cut about 15Mb by removing calls to pyQt (I use
Wxpython) and also to scipy.
One thing that is still bothering me is the mpl_data directory that
holds about 3.5 Mb of fonts.

Is it OK to remove the fonts I don't use? (I use only sans-serif) By
Ok I mean not only from the practical poin tof view (that is, will the
app run?) but also from the _legal_ point of view (am I obliged to
distribute all those fonts?)

And what about all thos .afm files? Are they needed? What are they really?

I hope to find some answers from your experience.

best

Carlos

···

--
Prof. Carlos Henrique Grohmann - Geologist D.Sc.
Institute of Geosciences - Univ. of São Paulo, Brazil
http://www.igc.usp.br/pessoais/guano
http://lattes.cnpq.br/5846052449613692
Linux User #89721
________________
Can’t stop the signal.

I think many would definitely benefit from knowing what can be left
out and how to do it, even beyond what you have mentioned. I look
forward to seeing whatever responses you might get.

···

On Thu, Sep 16, 2010 at 6:33 PM, Carlos Grohmann <carlos.grohmann@...287...> wrote:

Hello all,

I'm new to py2exe but I managed to create a binary executable of my
program. Now I'm experiencing on how to make the final size of the
binary smaller.

I already managed to cut about 15Mb by removing calls to pyQt (I use
Wxpython) and also to scipy.
One thing that is still bothering me is the mpl_data directory that
holds about 3.5 Mb of fonts.

Is it OK to remove the fonts I don't use? (I use only sans-serif) By
Ok I mean not only from the practical poin tof view (that is, will the
app run?) but also from the _legal_ point of view (am I obliged to
distribute all those fonts?)

And what about all thos .afm files? Are they needed? What are they really?

I hope to find some answers from your experience.

Carlos Grohmann wrote:

One thing that is still bothering me is the mpl_data directory that
holds about 3.5 Mb of fonts.

yup - that's a lot.

Is it OK to remove the fonts I don't use? (I use only sans-serif) By
Ok I mean not only from the practical poin tof view (that is, will the
app run?)

yes, it will, as long as no extra fonts get introduced at run time that you didn't test for.

but also from the _legal_ point of view (am I obliged to
distribute all those fonts?)

I can't see why. Strip away. That's what I've done.

-Chris

···

--
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception

Chris.Barker@...259...

Carlos,

Just to make it very clear, matplotlib is open sourced. You are free to modify the package to your heart’s content, however you see fit. Matplotlib only asks that you keep the copyright notice with the distributed software (in particular, the matplotlib/license/LICENSE file applies here, as well as others.)

With regards to fonts, refer to the matplotlib/license/LICENSE_STIX file. My understanding of that license (though, IANAL), is that you don’t have to worry about anything above and beyond just simply including the license file unless you are eliminating individual glyphs from a font (or adding glyphs). However, I don’t see any reason why you can’t constrain yourself to a particular font. Note that you are not allowed to sell any particular font in the package, though you are allowed to charge a distribution fee for the “font software”.

Generally speaking, my rule of thumb is that if you are distributing open-source software in the same spirit you have received it, you are satisfying the spirit of the licenses. The only thing remaining is whether the source code has to accompany the software or not. The core part of matplotlib is BSD licensed (or similar) and does not require that (although it is encouraged!).

Important! Note that the basemap package is GPL-licensed, and is required to have its source code accompany its software. However, unless your program depends on basemap for it to function, the source code to your program is not required to be GPL-ed.

And, as always, I am not a lawyer. I am merely conveying my understanding and experience with software licensing. Anyone else is free to add to and/or correct what I have said here.

I hope this helps!
Ben Root

···

On Thu, Sep 16, 2010 at 5:33 PM, Carlos Grohmann <carlos.grohmann@…287…> wrote:

Hello all,

Is it OK to remove the fonts I don’t use? (I use only sans-serif) By

Ok I mean not only from the practical poin tof view (that is, will the

app run?) but also from the legal point of view (am I obliged to

distribute all those fonts?)

Many thanks Ben!

I went and removed all fonts but regular helvetica and vera, also I
removed all but the .png files under images, and now my mpl-data is
about 250 kb.

cheers

Carlos

···

On Thu, Sep 16, 2010 at 21:39, Benjamin Root <ben.root@...1304...> wrote:

On Thu, Sep 16, 2010 at 5:33 PM, Carlos Grohmann <carlos.grohmann@...985.....> > wrote:

Hello all,

Is it OK to remove the fonts I don't use? (I use only sans-serif) By
Ok I mean not only from the practical poin tof view (that is, will the
app run?) but also from the _legal_ point of view (am I obliged to
distribute all those fonts?)

Carlos,

Just to make it very clear, matplotlib is open sourced. You are free to
modify the package to your heart's content, however you see fit. Matplotlib
only asks that you keep the copyright notice with the distributed software
(in particular, the matplotlib/license/LICENSE file applies here, as well as
others.)

With regards to fonts, refer to the matplotlib/license/LICENSE_STIX file.
My understanding of that license (though, IANAL), is that you don't have to
worry about anything above and beyond just simply including the license file
unless you are eliminating individual glyphs from a font (or adding
glyphs). However, I don't see any reason why you can't constrain yourself
to a particular font. Note that you are not allowed to sell any particular
font in the package, though you are allowed to charge a distribution fee for
the "font software".

Generally speaking, my rule of thumb is that if you are distributing
open-source software in the same spirit you have received it, you are
satisfying the spirit of the licenses. The only thing remaining is whether
the source code has to accompany the software or not. The core part of
matplotlib is BSD licensed (or similar) and does not require that (although
it is encouraged!).

Important! Note that the basemap package is GPL-licensed, and is required to
have its source code accompany its software. However, unless your program
*depends* on basemap for it to function, the source code to your program is
not required to be GPL-ed.

And, as always, I am not a lawyer. I am merely conveying my understanding
and experience with software licensing. Anyone else is free to add to
and/or correct what I have said here.

I hope this helps!
Ben Root

--
Prof. Carlos Henrique Grohmann - Geologist D.Sc.
Institute of Geosciences - Univ. of São Paulo, Brazil
http://www.igc.usp.br/pessoais/guano
http://lattes.cnpq.br/5846052449613692
Linux User #89721
________________
Can’t stop the signal.