[Git][debian-gis-team/python-geojson][master] 6 commits: New upstream version 3.2.0
Bas Couwenberg (@sebastic)
gitlab at salsa.debian.org
Sun Dec 22 03:38:11 GMT 2024
Bas Couwenberg pushed to branch master at Debian GIS Project / python-geojson
Commits:
f7b66c1c by Bas Couwenberg at 2024-12-22T04:29:15+01:00
New upstream version 3.2.0
- - - - -
74a645e6 by Bas Couwenberg at 2024-12-22T04:29:16+01:00
Update upstream source from tag 'upstream/3.2.0'
Update to upstream version '3.2.0'
with Debian dir 2e03b44e32bf1f651c8f30e9e4e94bff2c8f60fa
- - - - -
7a6ccf8d by Bas Couwenberg at 2024-12-22T04:29:37+01:00
New upstream release.
- - - - -
931aff4e by Bas Couwenberg at 2024-12-22T04:31:51+01:00
Drop python3.13.patch, applied upstream.
- - - - -
eef1ad42 by Bas Couwenberg at 2024-12-22T04:35:18+01:00
Add patch to not prematurely fail with newer Python versions.
- - - - -
022e5957 by Bas Couwenberg at 2024-12-22T04:35:30+01:00
Set distribution to unstable.
- - - - -
21 changed files:
- .github/workflows/test.yml
- .pre-commit-config.yaml
- + .readthedocs.yaml
- CHANGELOG.rst
- README.rst
- debian/changelog
- − debian/patches/python3.13.patch
- debian/patches/series
- + debian/patches/version-check.patch
- − docs/index.rst
- + docs/source/conf.py
- + docs/source/index.rst
- + docs/source/theme.toml
- geojson/_version.py
- geojson/base.py
- geojson/codec.py
- geojson/geometry.py
- geojson/utils.py
- setup.py
- tests/__init__.py
- tox.ini
Changes:
=====================================
.github/workflows/test.yml
=====================================
@@ -11,7 +11,7 @@ jobs:
strategy:
fail-fast: false
matrix:
- python-version: ['pypy3.9', '3.7', '3.8', '3.9', '3.10', '3.11', '3.12']
+ python-version: ['pypy3.9', '3.7', '3.8', '3.9', '3.10', '3.11', '3.12', '3.13']
steps:
- uses: actions/checkout at v3
=====================================
.pre-commit-config.yaml
=====================================
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
- rev: v4.4.0
+ rev: v5.0.0
hooks:
- id: check-case-conflict
- id: check-merge-conflict
@@ -9,12 +9,12 @@ repos:
- id: trailing-whitespace
- repo: https://github.com/tox-dev/tox-ini-fmt
- rev: 1.3.1
+ rev: 1.4.1
hooks:
- id: tox-ini-fmt
- repo: https://github.com/PyCQA/flake8
- rev: 6.1.0
+ rev: 7.1.1
hooks:
- id: flake8
=====================================
.readthedocs.yaml
=====================================
@@ -0,0 +1,18 @@
+# .readthedocs.yaml
+# Read the Docs configuration file
+# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
+
+version: 2
+
+build:
+ os: ubuntu-22.04
+ tools:
+ python: "3.10"
+
+sphinx:
+ configuration: docs/source/conf.py
+
+python:
+ install:
+ - method: pip
+ path: .
=====================================
CHANGELOG.rst
=====================================
@@ -1,6 +1,21 @@
Changes
=======
+3.2.0
+----------
+
+- Add support for Python 3.13
+
+ - https://github.com/jazzband/geojson/pull/228
+
+- Code modernization
+
+ - https://github.com/jazzband/geojson/pull/218
+ - https://github.com/jazzband/geojson/pull/229
+
+- RtD bugfix
+
+ - https://github.com/jazzband/geojson/pull/227
3.1.0
----------
=====================================
README.rst
=====================================
@@ -10,6 +10,9 @@ geojson
.. image:: https://jazzband.co/static/img/badge.svg
:target: https://jazzband.co/
:alt: Jazzband
+.. image:: https://img.shields.io/pypi/dm/geojson.svg
+ :target: https://pypi.org/project/geojson/
+ :alt: PyPI
This Python library contains:
@@ -26,7 +29,7 @@ This Python library contains:
Installation
------------
-geojson is compatible with Python 3.7 - 3.12. The recommended way to install is via pip_:
+geojson is compatible with Python 3.7 - 3.13. The recommended way to install is via pip_:
.. code::
=====================================
debian/changelog
=====================================
@@ -1,3 +1,12 @@
+python-geojson (3.2.0-1) unstable; urgency=medium
+
+ * Team upload.
+ * New upstream release.
+ * Drop python3.13.patch, applied upstream.
+ * Add patch to not prematurely fail with newer Python versions.
+
+ -- Bas Couwenberg <sebastic at debian.org> Sun, 22 Dec 2024 04:35:20 +0100
+
python-geojson (3.1.0-2) unstable; urgency=medium
* Team upload.
=====================================
debian/patches/python3.13.patch deleted
=====================================
@@ -1,62 +0,0 @@
-Description: Don't fail with Python 3.13.
-Author: Bas Couwenberg <sebastic at debian.org>
-Bug-Debian: https://bugs.debian.org/1082218
-Forwarded: https://github.com/jazzband/geojson/pull/228
-Applied-Upstream: https://github.com/jazzband/geojson/commit/c13afff339e6b78f442785cc95f0eb66ddab3e7b
-
---- a/setup.py
-+++ b/setup.py
-@@ -17,8 +17,8 @@ else:
-
-
- major_version, minor_version = sys.version_info[:2]
--if not (major_version == 3 and 7 <= minor_version <= 12):
-- sys.stderr.write("Sorry, only Python 3.7 - 3.12 are "
-+if not (major_version == 3 and 7 <= minor_version <= 13):
-+ sys.stderr.write("Sorry, only Python 3.7 - 3.13 are "
- "supported at this time.\n")
- exit(1)
-
-@@ -53,6 +53,7 @@ setup(
- "Programming Language :: Python :: 3.10",
- "Programming Language :: Python :: 3.11",
- "Programming Language :: Python :: 3.12",
-+ "Programming Language :: Python :: 3.13",
- "Topic :: Scientific/Engineering :: GIS",
- ]
- )
---- a/README.rst
-+++ b/README.rst
-@@ -26,7 +26,7 @@ This Python library contains:
- Installation
- ------------
-
--geojson is compatible with Python 3.7 - 3.12. The recommended way to install is via pip_:
-+geojson is compatible with Python 3.7 - 3.13. The recommended way to install is via pip_:
-
- .. code::
-
---- a/tox.ini
-+++ b/tox.ini
-@@ -2,7 +2,7 @@
- requires =
- tox>=4.2
- env_list =
-- py{py3, 312, 311, 310, 39, 38, 37}
-+ py{py3, 313, 312, 311, 310, 39, 38, 37}
-
- [testenv]
- deps =
-diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
-index e1601c0..05fe982 100644
---- a/.github/workflows/test.yml
-+++ b/.github/workflows/test.yml
-@@ -11,7 +11,7 @@ jobs:
- strategy:
- fail-fast: false
- matrix:
-- python-version: ['pypy3.9', '3.7', '3.8', '3.9', '3.10', '3.11', '3.12']
-+ python-version: ['pypy3.9', '3.7', '3.8', '3.9', '3.10', '3.11', '3.12', '3.13']
-
- steps:
- - uses: actions/checkout at v3
=====================================
debian/patches/series
=====================================
@@ -1 +1 @@
-python3.13.patch
+version-check.patch
=====================================
debian/patches/version-check.patch
=====================================
@@ -0,0 +1,18 @@
+Description: Don't fail prematurely with newer Python versions.
+Author: Bas Couwenberg <sebastic at debian.org>
+Forwarded: not-needed
+
+--- a/setup.py
++++ b/setup.py
+@@ -18,9 +18,9 @@ else:
+
+ major_version, minor_version = sys.version_info[:2]
+ if not (major_version == 3 and 7 <= minor_version <= 13):
+- sys.stderr.write("Sorry, only Python 3.7 - 3.13 are "
++ sys.stderr.write("Warning: only Python 3.7 - 3.13 are "
+ "supported at this time.\n")
+- exit(1)
++# exit(1)
+
+ setup(
+ name="geojson",
=====================================
docs/index.rst deleted
=====================================
@@ -1 +0,0 @@
-.. include:: ../README.rst
=====================================
docs/source/conf.py
=====================================
@@ -0,0 +1,29 @@
+# Configuration file for the Sphinx documentation builder.
+#
+# For the full list of built-in configuration values, see the documentation:
+# https://www.sphinx-doc.org/en/master/usage/configuration.html
+
+# -- Project information -----------------------------------------------------
+# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
+
+project = 'geojson'
+copyright = '2024, Sean Gillies, Matthew Russell, Corey Farwell, Blake Grotewold, \
+ Zsolt Ero, Sergey Romaov, Ray Riga'
+author = 'Sean Gillies, Matthew Russell, Corey Farwell, Blake Grotewold, Zsolt Ero, \
+ Sergey Romaov, Ray Riga'
+release = '3.1.0'
+
+# -- General configuration ---------------------------------------------------
+# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
+
+extensions = ['sphinxcontrib.jquery']
+
+templates_path = ['_templates']
+exclude_patterns = []
+
+# -- Options for HTML output -------------------------------------------------
+# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
+
+html_theme = 'sphinx_rtd_theme'
+html_theme_path = ['_theme']
+html_static_path = ['_static']
=====================================
docs/source/index.rst
=====================================
@@ -0,0 +1,10 @@
+.. geojson documentation master file, created by
+ sphinx-quickstart on Tue Aug 6 21:00:20 2024.
+ You can adapt this file completely to your liking, but it should at least
+ contain the root `toctree` directive.
+
+.. toctree::
+ :maxdepth: 2
+ :caption: Contents:
+
+.. include:: ../../README.rst
=====================================
docs/source/theme.toml
=====================================
@@ -0,0 +1,3 @@
+[theme]
+name = "sphinx_rtd_theme"
+base_url = "https://readthedocs.org/projects/sphinx-rtd-theme/"
=====================================
geojson/_version.py
=====================================
@@ -1,2 +1,2 @@
-__version__ = "3.1.0"
+__version__ = "3.2.0"
__version_info__ = tuple(map(int, __version__.split(".")))
=====================================
geojson/base.py
=====================================
@@ -107,15 +107,15 @@ class GeoJSON(dict):
except UnicodeEncodeError:
# If the type contains non-ascii characters, we can assume
# it's not a valid GeoJSON type
- raise AttributeError(
- "{0} is not a GeoJSON type").format(type_)
+ raise AttributeError(f"{type_} is not a GeoJSON type")
geojson_factory = getattr(geojson.factory, type_)
instance = geojson_factory(**d)
except (AttributeError, KeyError) as invalid:
if strict:
- msg = "Cannot coerce %r into a valid GeoJSON structure: %s"
- msg %= (ob, invalid)
- raise ValueError(msg)
+ raise ValueError(
+ f"Cannot coerce {ob!r} into "
+ f"a valid GeoJSON structure: {invalid}"
+ )
instance = ob
return instance
=====================================
geojson/codec.py
=====================================
@@ -19,7 +19,7 @@ class GeoJSONEncoder(json.JSONEncoder):
# Here the defaults are set to only permit valid JSON as per RFC 4267
def _enforce_strict_numbers(obj):
- raise ValueError("Number %r is not JSON compliant" % obj)
+ raise ValueError(f"Number {obj!r} is not JSON compliant")
def dump(obj, fp, cls=GeoJSONEncoder, allow_nan=False, **kwargs):
=====================================
geojson/geometry.py
=====================================
@@ -50,7 +50,7 @@ class Geometry(GeoJSON):
elif isinstance(coord, (Real, Decimal)):
new_coords.append(round(coord, precision))
else:
- raise ValueError("%r is not a JSON compliant number" % coord)
+ raise ValueError(f"{coord!r} is not a JSON compliant number")
return new_coords
=====================================
geojson/utils.py
=====================================
@@ -87,7 +87,7 @@ def map_tuples(func, obj):
elif obj['type'] in ['Feature', 'FeatureCollection', 'GeometryCollection']:
return map_geometries(lambda g: map_tuples(func, g), obj)
else:
- raise ValueError("Invalid geometry object %s" % repr(obj))
+ raise ValueError(f"Invalid geometry object {obj!r}")
return {'type': obj['type'], 'coordinates': coordinates}
@@ -125,7 +125,7 @@ def map_geometries(func, obj):
feats = [map_geometries(func, feat) for feat in obj['features']]
return {'type': obj['type'], 'features': feats}
else:
- raise ValueError("Invalid GeoJSON object %s" % repr(obj))
+ raise ValueError(f"Invalid GeoJSON object {obj!r}")
def generate_random(featureType, numberVertices=3,
@@ -152,79 +152,67 @@ def generate_random(featureType, numberVertices=3,
import random
import math
- lonMin = boundingBox[0]
- lonMax = boundingBox[2]
+ lon_min, lat_min, lon_max, lat_max = boundingBox
- def randomLon():
- return random.uniform(lonMin, lonMax)
+ def random_lon():
+ return random.uniform(lon_min, lon_max)
- latMin = boundingBox[1]
- latMax = boundingBox[3]
+ def random_lat():
+ return random.uniform(lat_min, lat_max)
- def randomLat():
- return random.uniform(latMin, latMax)
+ def create_point():
+ return Point((random_lon(), random_lat()))
- def createPoint():
- return Point((randomLon(), randomLat()))
+ def create_line():
+ return LineString([create_point() for _ in range(numberVertices)])
- def createLine():
- return LineString([createPoint() for unused in range(numberVertices)])
+ def create_poly():
+ ave_radius = 60
+ ctr_x = 0.1
+ ctr_y = 0.2
+ irregularity = clip(0.1, 0, 1) * math.tau / numberVertices
+ spikeyness = clip(0.5, 0, 1) * ave_radius
- def createPoly():
- aveRadius = 60
- ctrX = 0.1
- ctrY = 0.2
- irregularity = clip(0.1, 0, 1) * 2 * math.pi / numberVertices
- spikeyness = clip(0.5, 0, 1) * aveRadius
+ lower = (math.tau / numberVertices) - irregularity
+ upper = (math.tau / numberVertices) + irregularity
+ angle_steps = []
+ for _ in range(numberVertices):
+ angle_steps.append(random.uniform(lower, upper))
+ sum_angle = sum(angle_steps)
- angleSteps = []
- lower = (2 * math.pi / numberVertices) - irregularity
- upper = (2 * math.pi / numberVertices) + irregularity
- sum = 0
- for i in range(numberVertices):
- tmp = random.uniform(lower, upper)
- angleSteps.append(tmp)
- sum = sum + tmp
-
- k = sum / (2 * math.pi)
- for i in range(numberVertices):
- angleSteps[i] = angleSteps[i] / k
+ k = sum_angle / math.tau
+ angle_steps = [x / k for x in angle_steps]
points = []
- angle = random.uniform(0, 2 * math.pi)
-
- for i in range(numberVertices):
- r_i = clip(random.gauss(aveRadius, spikeyness), 0, 2 * aveRadius)
- x = ctrX + r_i * math.cos(angle)
- y = ctrY + r_i * math.sin(angle)
- x = (x + 180.0) * (abs(lonMin-lonMax) / 360.0) + lonMin
- y = (y + 90.0) * (abs(latMin-latMax) / 180.0) + latMin
- x = clip(x, lonMin, lonMax)
- y = clip(y, latMin, latMax)
+ angle = random.uniform(0, math.tau)
+
+ for angle_step in angle_steps:
+ r_i = clip(random.gauss(ave_radius, spikeyness), 0, 2 * ave_radius)
+ x = ctr_x + r_i * math.cos(angle)
+ y = ctr_y + r_i * math.sin(angle)
+ x = (x + 180.0) * (abs(lon_min - lon_max) / 360.0) + lon_min
+ y = (y + 90.0) * (abs(lat_min - lat_max) / 180.0) + lat_min
+ x = clip(x, lon_min, lon_max)
+ y = clip(y, lat_min, lat_max)
points.append((x, y))
- angle = angle + angleSteps[i]
+ angle += angle_step
- firstVal = points[0]
- points.append(firstVal)
+ points.append(points[0]) # append first point to the end
return Polygon([points])
- def clip(x, min, max):
- if min > max:
+ def clip(x, min_val, max_val):
+ if min_val > max_val:
return x
- elif x < min:
- return min
- elif x > max:
- return max
else:
- return x
+ return min(max(min_val, x), max_val)
if featureType == 'Point':
- return createPoint()
+ return create_point()
if featureType == 'LineString':
- return createLine()
+ return create_line()
if featureType == 'Polygon':
- return createPoly()
+ return create_poly()
raise ValueError(f"featureType: {featureType} is not supported.")
=====================================
setup.py
=====================================
@@ -17,8 +17,8 @@ else:
major_version, minor_version = sys.version_info[:2]
-if not (major_version == 3 and 7 <= minor_version <= 12):
- sys.stderr.write("Sorry, only Python 3.7 - 3.12 are "
+if not (major_version == 3 and 7 <= minor_version <= 13):
+ sys.stderr.write("Sorry, only Python 3.7 - 3.13 are "
"supported at this time.\n")
exit(1)
@@ -31,7 +31,7 @@ setup(
author="Sean Gillies",
author_email="sgillies at frii.com",
maintainer="Ray Riga",
- maintainer_email="ray at strongoutput.com",
+ maintainer_email="ray.maintainer at gmail.com",
url="https://github.com/jazzband/geojson",
long_description=readme_text,
packages=["geojson"],
@@ -53,6 +53,7 @@ setup(
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
+ "Programming Language :: Python :: 3.13",
"Topic :: Scientific/Engineering :: GIS",
]
)
=====================================
tests/__init__.py
=====================================
@@ -7,6 +7,6 @@ optionflags = (doctest.REPORT_ONLY_FIRST_FAILURE |
doctest.ELLIPSIS)
_basedir = os.path.dirname(__file__)
-paths = glob.glob("%s/*.txt" % _basedir)
+paths = glob.glob(f"{_basedir}/*.txt")
test_suite = doctest.DocFileSuite(*paths, **dict(module_relative=False,
optionflags=optionflags))
=====================================
tox.ini
=====================================
@@ -2,7 +2,7 @@
requires =
tox>=4.2
env_list =
- py{py3, 312, 311, 310, 39, 38, 37}
+ py{py3, 313, 312, 311, 310, 39, 38, 37}
[testenv]
deps =
View it on GitLab: https://salsa.debian.org/debian-gis-team/python-geojson/-/compare/0b0b8f677cd72e8981a8658ac0f8cf149b588a0e...022e595763bf77c9169bf773c2da5148ee6c3002
--
View it on GitLab: https://salsa.debian.org/debian-gis-team/python-geojson/-/compare/0b0b8f677cd72e8981a8658ac0f8cf149b588a0e...022e595763bf77c9169bf773c2da5148ee6c3002
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-grass-devel/attachments/20241222/b5e0ac40/attachment-0001.htm>
More information about the Pkg-grass-devel
mailing list