[Git][debian-gis-team/python-cligj][master] 6 commits: New upstream version 0.6.0
Bas Couwenberg
gitlab at salsa.debian.org
Tue Oct 20 05:20:49 BST 2020
Bas Couwenberg pushed to branch master at Debian GIS Project / python-cligj
Commits:
f85bac66 by Bas Couwenberg at 2020-10-20T06:06:57+02:00
New upstream version 0.6.0
- - - - -
92b7d282 by Bas Couwenberg at 2020-10-20T06:06:58+02:00
Update upstream source from tag 'upstream/0.6.0'
Update to upstream version '0.6.0'
with Debian dir b6349f8e9cc43b197c13e0e47c4ef6f01fcfa274
- - - - -
31e62b06 by Bas Couwenberg at 2020-10-20T06:07:15+02:00
New upstream release.
- - - - -
7609d16e by Bas Couwenberg at 2020-10-20T06:08:16+02:00
Update lintian overrides.
- - - - -
233a733a by Bas Couwenberg at 2020-10-20T06:16:06+02:00
Use pytest for test target.
- - - - -
3f7c959e by Bas Couwenberg at 2020-10-20T06:16:06+02:00
Set distribution to unstable.
- - - - -
14 changed files:
- .travis.yml
- CHANGES.txt
- LICENSE
- + MANIFEST.in
- README.rst
- cligj/__init__.py
- cligj/features.py
- debian/changelog
- debian/control
- debian/rules
- − debian/source/lintian-overrides
- + setup.cfg
- setup.py
- tests/twopoints.geojson
Changes:
=====================================
.travis.yml
=====================================
@@ -2,9 +2,9 @@ sudo: false
language: python
python:
- "2.7"
- - "3.3"
- "3.4"
- "3.5"
+ - "3.6"
install:
- "pip install coveralls"
- "pip install -e .[test]"
=====================================
CHANGES.txt
=====================================
@@ -1,6 +1,24 @@
Changes
=======
+0.6.0 (2020-10-19)
+------------------
+
+No changes since 0.6b1.
+
+0.6b1 (2020-10-14)
+------------------
+
+Future changes:
+
+- Feature sequences, not collections, will be the default form of output in
+ version 1.0 (#20).
+
+Bug fixes:
+
+- Always use `encoding='utf-8'` when opening input GeoJSON (#27).
+- Improve docstrings (#22).
+
0.5.0 (2018-09-26)
------------------
@@ -20,7 +38,7 @@ Changes
0.3.0 (2015-08-12)
------------------
-- Deprecation of the cligj.plugins module (#6). Please switch to the
+- Deprecation of the cligj.plugins module (#6). Please switch to the
click-plugins module: https://github.com/click-contrib/click-plugins. The
cligj.plugins module will be removed from cligj at version 1.0.
=====================================
LICENSE
=====================================
=====================================
MANIFEST.in
=====================================
@@ -0,0 +1,4 @@
+include CHANGES.txt
+include LICENSE
+
+graft tests
=====================================
README.rst
=====================================
@@ -10,7 +10,7 @@ cligj
Common arguments and options for GeoJSON processing commands, using Click.
`cligj` is for Python developers who create command line interfaces for geospatial data.
-`cligj` allows you to quickly build consistent, well-tested and interoperable CLIs for handling GeoJSON.
+`cligj` allows you to quickly build consistent, well-tested and interoperable CLIs for handling GeoJSON.
Arguments
@@ -76,11 +76,15 @@ or, optionally, a sequence of individual features. Since most software that
reads and writes GeoJSON expects a text containing a single feature collection,
that's the default, and a LF-delimited sequence of texts containing one GeoJSON
feature each is a feature that is turned on using the ``--sequence`` option.
-To write sequences of feature texts that conform to the `JSON Text Sequences
-proposed standard
-<http://tools.ietf.org/html/draft-ietf-json-text-sequence-13>`__ (and might
-contain pretty-printed JSON) with the ASCII Record Separator (0x1e) as
-a delimiter, use the ``--rs`` option
+To write sequences of feature texts that conform to the `GeoJSON Text Sequences
+standard <https://tools.ietf.org/html/rfc8142>`__ (and might contain
+pretty-printed JSON) with the ASCII Record Separator (0x1e) as a delimiter, use
+the ``--rs`` option
+
+.. warning:: Future change warning
+ GeoJSON sequences (`--sequence`), not collections (`--no-sequence`), will be
+ the default in version 1.0.0.
+
.. code-block:: python
@@ -125,7 +129,6 @@ On the command line, the generated help text explains the usage
False).
--help Show this message and exit.
-
And can be used like this
.. code-block:: console
=====================================
cligj/__init__.py
=====================================
@@ -1,6 +1,8 @@
-# cligj
+"""cligj
-# Shared arguments and options.
+A package of arguments, options, and parsers for the Python GeoJSON
+ecosystem.
+"""
import click
@@ -109,8 +111,8 @@ use_rs_opt = click.option(
"(default is False).")
-# GeoJSON output mode option.
def geojson_type_collection_opt(default=False):
+ """GeoJSON FeatureCollection output mode"""
return click.option(
'--collection',
'geojson_type',
@@ -120,6 +122,7 @@ def geojson_type_collection_opt(default=False):
def geojson_type_feature_opt(default=False):
+ """GeoJSON Feature or Feature sequence output mode"""
return click.option(
'--feature',
'geojson_type',
@@ -129,6 +132,7 @@ def geojson_type_feature_opt(default=False):
def geojson_type_bbox_opt(default=False):
+ """GeoJSON bbox output mode"""
return click.option(
'--bbox',
'geojson_type',
=====================================
cligj/features.py
=====================================
@@ -1,3 +1,5 @@
+"""Feature parsing and normalization"""
+
from itertools import chain
import json
import re
@@ -23,10 +25,16 @@ def normalize_feature_inputs(ctx, param, value):
"[lng, lat]", or "lng, lat", or "lng lat".
If no value is provided, features will be read from stdin.
+
+ Yields
+ ------
+ Mapping
+ A GeoJSON Feature represented by a Python mapping
+
"""
for feature_like in value or ('-',):
try:
- with click.open_file(feature_like) as src:
+ with click.open_file(feature_like, encoding="utf-8") as src:
for feature in iter_features(iter(src)):
yield feature
except IOError:
@@ -55,6 +63,12 @@ def iter_features(geojsonfile, func=None):
A function that will be applied to each extracted feature. It
takes a feature object and may return a replacement feature or
None -- in which case iter_features does not yield.
+
+ Yields
+ ------
+ Mapping
+ A GeoJSON Feature represented by a Python mapping
+
"""
func = func or (lambda x: x)
first_line = next(geojsonfile)
@@ -136,9 +150,20 @@ def iter_features(geojsonfile, func=None):
def to_feature(obj):
- """Takes a feature or a geometry
- returns feature verbatim or
- wraps geom in a feature with empty properties
+ """Converts an object to a GeoJSON Feature
+
+ Returns feature verbatim or wraps geom in a feature with empty
+ properties.
+
+ Raises
+ ------
+ ValueError
+
+ Returns
+ -------
+ Mapping
+ A GeoJSON Feature represented by a Python mapping
+
"""
if obj['type'] == 'Feature':
return obj
@@ -177,13 +202,13 @@ def normalize_feature_objects(feature_objs):
an iterable of objects with a geo interface and
normalizes it to the former."""
for obj in feature_objs:
- if hasattr(obj, "__geo_interface__") and \
- 'type' in obj.__geo_interface__.keys() and \
- obj.__geo_interface__['type'] == 'Feature':
+ if (
+ hasattr(obj, "__geo_interface__")
+ and "type" in obj.__geo_interface__.keys()
+ and obj.__geo_interface__["type"] == "Feature"
+ ):
yield obj.__geo_interface__
- elif isinstance(obj, dict) and 'type' in obj and \
- obj['type'] == 'Feature':
+ elif isinstance(obj, dict) and "type" in obj and obj["type"] == "Feature":
yield obj
else:
- raise ValueError("Did not recognize object {0}"
- "as GeoJSON Feature".format(obj))
+ raise ValueError("Did not recognize object as GeoJSON Feature")
=====================================
debian/changelog
=====================================
@@ -1,10 +1,14 @@
-python-cligj (0.5.0-3) UNRELEASED; urgency=medium
+python-cligj (0.6.0-1) unstable; urgency=medium
+ * Team upload.
+ * New upstream release.
* Bump Standards-Version to 4.5.0, no changes.
* Drop Name field from upstream metadata.
* Bump debhelper compat to 10.
+ * Update lintian overrides.
+ * Use pytest for test target.
- -- Bas Couwenberg <sebastic at debian.org> Mon, 30 Sep 2019 19:50:44 +0200
+ -- Bas Couwenberg <sebastic at debian.org> Tue, 20 Oct 2020 06:08:17 +0200
python-cligj (0.5.0-2) unstable; urgency=medium
=====================================
debian/control
=====================================
@@ -5,9 +5,10 @@ Section: python
Priority: optional
Build-Depends: debhelper (>= 10~),
dh-python,
- python3-setuptools,
- python3-click,
python3-all,
+ python3-click,
+ python3-setuptools,
+ python3-pytest,
Standards-Version: 4.5.0
Vcs-Browser: https://salsa.debian.org/debian-gis-team/python-cligj
Vcs-Git: https://salsa.debian.org/debian-gis-team/python-cligj.git
=====================================
debian/rules
=====================================
@@ -2,10 +2,7 @@
# -*- makefile -*-
export PYBUILD_NAME=cligj
+export PYBUILD_TEST_PYTEST=1
%:
dh $@ --with python3 --buildsystem pybuild
-
-override_dh_auto_test:
- PYBUILD_SYSTEM=custom \
- PYBUILD_TEST_ARGS="cd {build_dir}; PYTHONPATH=. {interpreter} -m unittest discover -v" dh_auto_test || echo "Ignoring test failures"
=====================================
debian/source/lintian-overrides deleted
=====================================
@@ -1,3 +0,0 @@
-# Not worth the effort
-testsuite-autopkgtest-missing
-
=====================================
setup.cfg
=====================================
@@ -0,0 +1,2 @@
+[metadata]
+license_file = LICENSE
=====================================
setup.py
=====================================
@@ -1,28 +1,26 @@
from codecs import open as codecs_open
-from setuptools import setup, find_packages
+from setuptools import setup, find_packages
# Get the long description from the relevant file
with codecs_open('README.rst', encoding='utf-8') as f:
long_description = f.read()
-setup(name='cligj',
- version='0.5.0',
- description=u"Click params for commmand line interfaces to GeoJSON",
- long_description=long_description,
- classifiers=[],
- keywords='',
- author=u"Sean Gillies",
- author_email='sean at mapbox.com',
- url='https://github.com/mapbox/cligj',
- license='BSD',
- packages=find_packages(exclude=['ez_setup', 'examples', 'tests']),
- include_package_data=True,
- zip_safe=False,
- install_requires=[
- 'click >= 4.0, < 8'
- ],
- extras_require={
- 'test': ['pytest-cov'],
- })
+setup(
+ name="cligj",
+ version="0.6.0",
+ description=u"Click params for commmand line interfaces to GeoJSON",
+ long_description=long_description,
+ classifiers=[],
+ keywords="",
+ author=u"Sean Gillies",
+ author_email="sean at mapbox.com",
+ url="https://github.com/mapbox/cligj",
+ license="BSD",
+ packages=find_packages(exclude=["ez_setup", "examples", "tests"]),
+ include_package_data=True,
+ zip_safe=False,
+ install_requires=["click >= 4.0, < 8"],
+ extras_require={"test": ["pytest-cov"],},
+)
=====================================
tests/twopoints.geojson
=====================================
@@ -1 +1 @@
-{"features": [{"bbox": [-122.9292140099711, 45.37948199034149, -122.44106199104115, 45.858097009742835], "center": [-122.7282, 45.5801], "context": [{"id": "postcode.2503633822", "text": "97203"}, {"id": "region.3470299826", "text": "Oregon"}, {"id": "country.4150104525", "short_code": "us", "text": "United States"}], "geometry": {"coordinates": [-122.7282, 45.5801], "type": "Point"}, "id": "place.42767", "place_name": "Portland, Oregon, United States", "properties": {}, "relevance": 0.999, "text": "Portland", "type": "Feature"}, {"bbox": [-121.9779540096568, 43.74737999114854, -120.74788099000016, 44.32812500969035], "center": [-121.3153, 44.0582], "context": [{"id": "postcode.3332732485", "text": "97701"}, {"id": "region.3470299826", "text": "Oregon"}, {"id": "country.4150104525", "short_code": "us", "text": "United States"}], "geometry": {"coordinates": [-121.3153, 44.0582], "type": "Point"}, "id": "place.3965", "place_name": "Bend, Oregon, United States", "properties": {}, "relevance": 0.999, "text": "Bend", "type": "Feature"}], "type": "FeatureCollection"}
+{"features": [{"bbox": [-122.9292140099711, 45.37948199034149, -122.44106199104115, 45.858097009742835], "center": [-122.7282, 45.5801], "context": [{"id": "postcode.2503633822", "text": "97203"}, {"id": "region.3470299826", "text": "Oregon"}, {"id": "country.4150104525", "short_code": "us", "text": "United States"}], "geometry": {"coordinates": [-122.7282, 45.5801], "type": "Point"}, "id": "place.42767", "place_name": "Portland, Oregon, United States", "properties": {}, "relevance": 0.999, "text": "Portland", "type": "Feature"}, {"bbox": [-121.9779540096568, 43.74737999114854, -120.74788099000016, 44.32812500969035], "center": [-121.3153, 44.0582], "context": [{"id": "postcode.3332732485", "text": "97701"}, {"id": "region.3470299826", "text": "Oregon"}, {"id": "country.4150104525", "short_code": "us", "text": "United States"}], "geometry": {"coordinates": [-121.3153, 44.0582], "type": "Point"}, "id": "place.3965", "place_name": "Bend, 😀regon, United States", "properties": {}, "relevance": 0.999, "text": "Bend", "type": "Feature"}], "type": "FeatureCollection"}
View it on GitLab: https://salsa.debian.org/debian-gis-team/python-cligj/-/compare/418be0a833d165a68a7845b0d375fd477d589316...3f7c959ed13f13db47467fb2fe8d03230cf405eb
--
View it on GitLab: https://salsa.debian.org/debian-gis-team/python-cligj/-/compare/418be0a833d165a68a7845b0d375fd477d589316...3f7c959ed13f13db47467fb2fe8d03230cf405eb
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/20201020/930d2768/attachment-0001.html>
More information about the Pkg-grass-devel
mailing list