Skip to content

Commit

Permalink
set minimum python version to 3.8
Browse files Browse the repository at this point in the history
a bit of formatting cleanup
  • Loading branch information
ChrisBarker-NOAA committed Dec 4, 2021
1 parent 7046874 commit 4a1245a
Show file tree
Hide file tree
Showing 7 changed files with 142 additions and 80 deletions.
2 changes: 1 addition & 1 deletion conda_requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
python>=3.6
python>=3.8
cython
numpy
libgd
Expand Down
2 changes: 1 addition & 1 deletion py_gd/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import sys
import os

__version__ = "2.0.0"
__version__ = "2.0.1"

if sys.platform.startswith('win'):
# This only works for Anaconda / miniconda
Expand Down
47 changes: 39 additions & 8 deletions py_gd/_cm_listed.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,52 @@
"""
Colormap data borrowed from matplotlib
1. This LICENSE AGREEMENT is between the Matplotlib Development Team ("MDT"), and the Individual or Organization ("Licensee") accessing and otherwise using matplotlib software in source or binary form and its associated documentation.
1. This LICENSE AGREEMENT is between the Matplotlib Development Team
("MDT"), and the Individual or Organization ("Licensee") accessing and
otherwise using matplotlib software in source or binary form and its
associated documentation.
2. Subject to the terms and conditions of this License Agreement, MDT hereby grants Licensee a nonexclusive, royalty-free, world-wide license to reproduce, analyze, test, perform and/or display publicly, prepare derivative works, distribute, and otherwise use matplotlib 3.2.2 alone or in any derivative version, provided, however, that MDT's License Agreement and MDT's notice of copyright, i.e., "Copyright (c) 2012-2013 Matplotlib Development Team; All Rights Reserved" are retained in matplotlib 3.2.2 alone or in any derivative version prepared by Licensee.
2. Subject to the terms and conditions of this License Agreement, MDT
hereby grants Licensee a nonexclusive, royalty-free, world-wide license
to reproduce, analyze, test, perform and/or display publicly, prepare
derivative works, distribute, and otherwise use matplotlib 3.2.2 alone
or in any derivative version, provided, however, that MDT's License
Agreement and MDT's notice of copyright, i.e., "Copyright (c) 2012-2013
Matplotlib Development Team; All Rights Reserved" are retained in
matplotlib 3.2.2 alone or in any derivative version prepared by
Licensee.
3. In the event Licensee prepares a derivative work that is based on or incorporates matplotlib 3.2.2 or any part thereof, and wants to make the derivative work available to others as provided herein, then Licensee hereby agrees to include in any such work a brief summary of the changes made to matplotlib 3.2.2.
3. In the event Licensee prepares a derivative work that is based on or
incorporates matplotlib 3.2.2 or any part thereof, and wants to make
the derivative work available to others as provided herein, then
Licensee hereby agrees to include in any such work a brief summary of
the changes made to matplotlib 3.2.2.
4. MDT is making matplotlib 3.2.2 available to Licensee on an "AS IS" basis. MDT MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, MDT MAKES NO AND DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF MATPLOTLIB 3.2.2 WILL NOT INFRINGE ANY THIRD PARTY RIGHTS.
4. MDT is making matplotlib 3.2.2 available to Licensee on an "AS IS"
basis. MDT MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED.
BY WAY OF EXAMPLE, BUT NOT LIMITATION, MDT MAKES NO AND DISCLAIMS ANY
REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS FOR ANY
PARTICULAR PURPOSE OR THAT THE USE OF MATPLOTLIB 3.2.2 WILL NOT
INFRINGE ANY THIRD PARTY RIGHTS.
5. MDT SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF MATPLOTLIB 3.2.2 FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING MATPLOTLIB 3.2.2, OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF.
5. MDT SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF MATPLOTLIB
3.2.2 FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS
A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING MATPLOTLIB
3.2.2, OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY
THEREOF.
6. This License Agreement will automatically terminate upon a material breach of its terms and conditions.
6. This License Agreement will automatically terminate upon a material
breach of its terms and conditions.
7. Nothing in this License Agreement shall be deemed to create any relationship of agency, partnership, or joint venture between MDT and Licensee. This License Agreement does not grant permission to use MDT trademarks or trade name in a trademark sense to endorse or promote products or services of Licensee, or any third party.
7. Nothing in this License Agreement shall be deemed to create any
relationship of agency, partnership, or joint venture between MDT and
Licensee. This License Agreement does not grant permission to use MDT
trademarks or trade name in a trademark sense to endorse or promote
products or services of Licensee, or any third party.
8. By copying, installing or otherwise using matplotlib 3.2.2, Licensee agrees to be bound by the terms and conditions of this License Agreement.
8. By copying, installing or otherwise using matplotlib 3.2.2, Licensee
agrees to be bound by the terms and conditions of this License
Agreement.
"""


Expand Down
47 changes: 39 additions & 8 deletions py_gd/_color_data.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,52 @@
"""
named color data borrowed from matplotlib
1. This LICENSE AGREEMENT is between the Matplotlib Development Team ("MDT"), and the Individual or Organization ("Licensee") accessing and otherwise using matplotlib software in source or binary form and its associated documentation.
1. This LICENSE AGREEMENT is between the Matplotlib Development Team
("MDT"), and the Individual or Organization ("Licensee") accessing and
otherwise using matplotlib software in source or binary form and its
associated documentation.
2. Subject to the terms and conditions of this License Agreement, MDT hereby grants Licensee a nonexclusive, royalty-free, world-wide license to reproduce, analyze, test, perform and/or display publicly, prepare derivative works, distribute, and otherwise use matplotlib 3.2.2 alone or in any derivative version, provided, however, that MDT's License Agreement and MDT's notice of copyright, i.e., "Copyright (c) 2012-2013 Matplotlib Development Team; All Rights Reserved" are retained in matplotlib 3.2.2 alone or in any derivative version prepared by Licensee.
2. Subject to the terms and conditions of this License Agreement, MDT
hereby grants Licensee a nonexclusive, royalty-free, world-wide license
to reproduce, analyze, test, perform and/or display publicly, prepare
derivative works, distribute, and otherwise use matplotlib 3.2.2 alone
or in any derivative version, provided, however, that MDT's License
Agreement and MDT's notice of copyright, i.e., "Copyright (c) 2012-2013
Matplotlib Development Team; All Rights Reserved" are retained in
matplotlib 3.2.2 alone or in any derivative version prepared by
Licensee.
3. In the event Licensee prepares a derivative work that is based on or incorporates matplotlib 3.2.2 or any part thereof, and wants to make the derivative work available to others as provided herein, then Licensee hereby agrees to include in any such work a brief summary of the changes made to matplotlib 3.2.2.
3. In the event Licensee prepares a derivative work that is based on or
incorporates matplotlib 3.2.2 or any part thereof, and wants to make
the derivative work available to others as provided herein, then
Licensee hereby agrees to include in any such work a brief summary of
the changes made to matplotlib 3.2.2.
4. MDT is making matplotlib 3.2.2 available to Licensee on an "AS IS" basis. MDT MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, MDT MAKES NO AND DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF MATPLOTLIB 3.2.2 WILL NOT INFRINGE ANY THIRD PARTY RIGHTS.
4. MDT is making matplotlib 3.2.2 available to Licensee on an "AS IS"
basis. MDT MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED.
BY WAY OF EXAMPLE, BUT NOT LIMITATION, MDT MAKES NO AND DISCLAIMS ANY
REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS FOR ANY
PARTICULAR PURPOSE OR THAT THE USE OF MATPLOTLIB 3.2.2 WILL NOT
INFRINGE ANY THIRD PARTY RIGHTS.
5. MDT SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF MATPLOTLIB 3.2.2 FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING MATPLOTLIB 3.2.2, OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF.
5. MDT SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF MATPLOTLIB
3.2.2 FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS
A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING MATPLOTLIB
3.2.2, OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY
THEREOF.
6. This License Agreement will automatically terminate upon a material breach of its terms and conditions.
6. This License Agreement will automatically terminate upon a material
breach of its terms and conditions.
7. Nothing in this License Agreement shall be deemed to create any relationship of agency, partnership, or joint venture between MDT and Licensee. This License Agreement does not grant permission to use MDT trademarks or trade name in a trademark sense to endorse or promote products or services of Licensee, or any third party.
7. Nothing in this License Agreement shall be deemed to create any
relationship of agency, partnership, or joint venture between MDT and
Licensee. This License Agreement does not grant permission to use MDT
trademarks or trade name in a trademark sense to endorse or promote
products or services of Licensee, or any third party.
8. By copying, installing or otherwise using matplotlib 3.2.2, Licensee agrees to be bound by the terms and conditions of this License Agreement.
8. By copying, installing or otherwise using matplotlib 3.2.2, Licensee
agrees to be bound by the terms and conditions of this License
Agreement.
"""


Expand Down
66 changes: 49 additions & 17 deletions py_gd/colors.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,55 @@
Assorted colormaps you can use with py_gd
These have (so far) been borrowed from the Matplotlib project, so are licensed as MPL is:
1. This LICENSE AGREEMENT is between the Matplotlib Development Team ("MDT"), and the Individual or Organization ("Licensee") accessing and otherwise using matplotlib software in source or binary form and its associated documentation.
2. Subject to the terms and conditions of this License Agreement, MDT hereby grants Licensee a nonexclusive, royalty-free, world-wide license to reproduce, analyze, test, perform and/or display publicly, prepare derivative works, distribute, and otherwise use matplotlib 3.2.2 alone or in any derivative version, provided, however, that MDT's License Agreement and MDT's notice of copyright, i.e., "Copyright (c) 2012-2013 Matplotlib Development Team; All Rights Reserved" are retained in matplotlib 3.2.2 alone or in any derivative version prepared by Licensee.
3. In the event Licensee prepares a derivative work that is based on or incorporates matplotlib 3.2.2 or any part thereof, and wants to make the derivative work available to others as provided herein, then Licensee hereby agrees to include in any such work a brief summary of the changes made to matplotlib 3.2.2.
4. MDT is making matplotlib 3.2.2 available to Licensee on an "AS IS" basis. MDT MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, MDT MAKES NO AND DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF MATPLOTLIB 3.2.2 WILL NOT INFRINGE ANY THIRD PARTY RIGHTS.
5. MDT SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF MATPLOTLIB 3.2.2 FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING MATPLOTLIB 3.2.2, OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF.
6. This License Agreement will automatically terminate upon a material breach of its terms and conditions.
7. Nothing in this License Agreement shall be deemed to create any relationship of agency, partnership, or joint venture between MDT and Licensee. This License Agreement does not grant permission to use MDT trademarks or trade name in a trademark sense to endorse or promote products or services of Licensee, or any third party.
8. By copying, installing or otherwise using matplotlib 3.2.2, Licensee agrees to be bound by the terms and conditions of this License Agreement.
These have (so far) been borrowed from the Matplotlib project, so are
licensed as MPL is:
1. This LICENSE AGREEMENT is between the Matplotlib Development Team
("MDT"), and the Individual or Organization ("Licensee") accessing and
otherwise using matplotlib software in source or binary form and its
associated documentation.
2. Subject to the terms and conditions of this License Agreement, MDT
hereby grants Licensee a nonexclusive, royalty-free, world-wide license
to reproduce, analyze, test, perform and/or display publicly, prepare
derivative works, distribute, and otherwise use matplotlib 3.2.2 alone
or in any derivative version, provided, however, that MDT's License
Agreement and MDT's notice of copyright, i.e., "Copyright (c) 2012-2013
Matplotlib Development Team; All Rights Reserved" are retained in
matplotlib 3.2.2 alone or in any derivative version prepared by
Licensee.
3. In the event Licensee prepares a derivative work that is based on or
incorporates matplotlib 3.2.2 or any part thereof, and wants to make
the derivative work available to others as provided herein, then
Licensee hereby agrees to include in any such work a brief summary of
the changes made to matplotlib 3.2.2.
4. MDT is making matplotlib 3.2.2 available to Licensee on an "AS IS"
basis. MDT MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED.
BY WAY OF EXAMPLE, BUT NOT LIMITATION, MDT MAKES NO AND DISCLAIMS ANY
REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS FOR ANY
PARTICULAR PURPOSE OR THAT THE USE OF MATPLOTLIB 3.2.2 WILL NOT
INFRINGE ANY THIRD PARTY RIGHTS.
5. MDT SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF MATPLOTLIB
3.2.2 FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS
A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING MATPLOTLIB
3.2.2, OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY
THEREOF.
6. This License Agreement will automatically terminate upon a material
breach of its terms and conditions.
7. Nothing in this License Agreement shall be deemed to create any
relationship of agency, partnership, or joint venture between MDT and
Licensee. This License Agreement does not grant permission to use MDT
trademarks or trade name in a trademark sense to endorse or promote
products or services of Licensee, or any third party.
8. By copying, installing or otherwise using matplotlib 3.2.2, Licensee
agrees to be bound by the terms and conditions of this License
Agreement.
"""

from itertools import islice
Expand Down
32 changes: 5 additions & 27 deletions py_gd/py_gd.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,10 @@ Cython wrapper around the gd drawing lib
Provides an OO interface -- at least to the limited functionality wrapped
NOTE: pixel coordinates are defined as c ints -- if you pass in values
larger than a c int can take (usually +- 2**31 - 1), it will overflow,
larger than a c int can take (usually ~ 2**31 - 1), it will overflow,
and who knows what you'll get.
"""

#cython: language_level=3

import cython
from cython cimport view

Expand All @@ -30,30 +28,10 @@ from py_gd.colors import colorschemes
__gd_version__ = gdVersionString().decode('ascii')


# transparent_colors = [('transparent', (0, 0, 0, 127))]

# BW_colors = transparent_colors + [('black', (0, 0, 0)),
# ('white', (255, 255, 255))]

# web_colors = BW_colors + [('silver', (191, 191, 191)),
# ('gray', (127, 127, 127)),
# ('red', (255, 0, 0)),
# ('maroon', (127, 0, 0)),
# ('yellow', (255, 255, 0)),
# ('olive', (127, 127, 0)),
# ('lime', (0, 255, 0)),
# ('green', (0, 127, 0)),
# ('aqua', (0, 255, 255)),
# ('teal', (0, 127, 127)),
# ('blue', (0, 0, 255)),
# ('navy', (0, 0, 127)),
# ('fuchsia', (255, 0, 255)),
# ('purple', (127, 0, 127))]

# note that the 1GB max is arbitrary -- you can change it after import,
# before initializing an Image. On my system going bigger than this brings
# the system to an almost halt before raising a memory error, so I set
# a limit here.
# Note that the default 1GB max is arbitrary -- you can change it after
# import, before initializing an Image. On my system (as of 2012 or
# so)going bigger than this brings the system to an almost halt before
# raising a memory error, so I set a limit here.

MAX_IMAGE_SIZE = 2 ** 30 # 1 GB limit

Expand Down
26 changes: 8 additions & 18 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,16 @@
setup.py script for the py_gd package
Tested with:
Anaconda on OS_X
Anaconda on Win64
conda (with conda-forge libgd) on OS_X
Python 2.7.5 on CentOS 7
Python 2.7.10
On Windows, MacOS and Linux (CentoOS 7)
libgd is assumed to be installed (and its dependencies) already.
The Anaconda package at:
http://anaconda.org/noaa-orr-erd/libgd
is a good way to get it
The conda package on conda-forge is a good way to get it:
"""
https://anaconda.org/conda-forge/libgd
# it seems some build systems may run this wtih py3, even for a py2 build
from __future__ import print_function
"""

import sys
import os
Expand Down Expand Up @@ -102,7 +97,7 @@ def run(self):

# This setup requires libgd and its dependent libs
# It expects to find them in the "usual" locations
# or where Anaconda put it...
# or where conda puts it...

ext_modules = [Extension("py_gd.py_gd",
["py_gd/py_gd.pyx"],
Expand All @@ -113,16 +108,10 @@ def run(self):
extra_link_args=link_args,
)]

# py_ver = sys.version_info[0]
# ext_modules = cythonize(
# ext_modules,
# compiler_directives={'language_level': py_ver})

ext_modules = cythonize(
ext_modules,
compiler_directives={'language_level': 3})


def get_version():
"""
get version from __init__.py
Expand All @@ -148,13 +137,14 @@ def get_version():
ext_modules=cythonize(ext_modules),
zip_safe=False, # dont want a compiled extension in a zipfile...
packages=['py_gd', 'py_gd.test'],
python_requires='>=3.8',
classifiers=["Development Status :: 2 - Pre-Alpha",
"Topic :: Utilities",
"License :: Public Domain",
"Intended Audience :: Developers",
"Operating System :: OS Independent",
"Programming Language :: Cython",
"Programming Language :: Python :: 2 :: Only",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: Implementation :: CPython",
"Topic :: Multimedia :: Graphics",
],
Expand Down

0 comments on commit 4a1245a

Please sign in to comment.