Skip to content

Commit b6667a3

Browse files
committed
PB-1968: Drop Python 2 support
1 parent 58d6e57 commit b6667a3

File tree

8 files changed

+33
-155
lines changed

8 files changed

+33
-155
lines changed

README.md

Lines changed: 16 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,14 @@
1-
gatilegrid
2-
===========
1+
# gatilegrid
32

4-
![Build Status](https://codebuild.eu-central-1.amazonaws.com/badges?uuid=eyJlbmNyeXB0ZWREYXRhIjoiY1JweHpoMGV5cndNTjFRT1JXc0tNK0tyK0NSL3NoVWhXK3BFNU9DZFBEc3M5clN4RzdZMDc1czk5VUJiV1RFSk5YR0lFR1g4dVBES0FTMmpyVTNCcU0wPSIsIml2UGFyYW1ldGVyU3BlYyI6Im5qQWZtZ0lTWDFIelk0cG0iLCJtYXRlcmlhbFNldFNlcmlhbCI6MX0%3D&branch=master)
5-
6-
## Geoadmin custom tile grid for web mapping applications
7-
8-
gatilegrid is compatible with python 2.7, 3.5, 3.6, 3.7 and 3.8
3+
Geoadmin custom tile grid for web mapping applications.
94

105
## Installation
116

127
```bash
138
$ pip install gatilegrid
149
```
1510

16-
### Usage
11+
## Usage
1712

1813
Several tile grids are supported, namely 21781, 2056, 3857 and 4326. Here is an exemple using 21781.
1914
For 4326, an additional parameter is available (`tmsCompatible=True`).
@@ -155,65 +150,25 @@ print(maxRow)
155150
>>> 1959
156151
```
157152

158-
### Tests
159-
160-
```
161-
source .venv/bin/activate
162-
python setup.py test
163-
164-
```
165-
166-
### Publish a new version of the module
167-
168-
Edit `$HOME/.pypirc` and add (username and password in keepass):
169-
170-
```
171-
[distutils]
172-
index-servers =
173-
pypi
174-
pypitest
175-
176-
[pypi]
177-
repository=https://upload.pypi.org/legacy/
178-
username=iwi***
179-
password=
180-
181-
[pypitest]
182-
repository=https://test.pypi.org/legacy/
183-
username=iwi***
184-
password=
185-
```
186-
187-
Bump version in `setup.py`.
153+
## Local Development
188154

189-
Build, check and upload the new module to the test repository:
155+
### Setup
190156

191-
```
192-
pip install --upgrade twine wheel setuptools
193-
python setup.py sdist bdist_wheel
194-
twine upload --repository testpypi dist/*
157+
```bash
158+
python -m venv .venv
159+
source .venv/bin/activate
160+
pip install .
161+
pip install nose2 flake8
195162
```
196163

197-
Test local install from test repository.
164+
### Tests
198165

199-
```
200-
pip install -i https://test.pypi.org/simple/ gatilegrid
166+
```bash
167+
nose2 tests
201168
```
202169

203-
If everything is ok, push the new version to the default repository.
170+
### Linting
204171

172+
```bash
173+
flake8 --ignore=F401 gatilegrid tests
205174
```
206-
twine upload --repository pypi dist/*
207-
```
208-
209-
Test the newly created module.
210-
211-
Create a RELEASE in github.
212-
213-
#### CONTRIBUTORS:
214-
215-
- [Loic Gasser](https://github.com/loicgasser)
216-
- [Marc Monnerat](https://github.com/procrastinatio)
217-
- [Nadine Piveteau](https://github.com/nadine-piveteau)
218-
- [Marcel Clausen](https://github.com/ltclm)
219-
- [Gilbert Jeinziner](https://github.com/gjn)

buildspec.yml

Lines changed: 0 additions & 58 deletions
This file was deleted.

gatilegrid/grid.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
# -*- coding: utf-8 -*-
2-
31
import math
4-
from past.builtins import xrange
52

63

74
class Grid:
@@ -34,8 +31,8 @@ def __init__(self, extent, resolutionX, resolutionY):
3431
self._setExtentAddress()
3532

3633
def __iter__(self):
37-
for col in xrange(0, self.nbCellsX):
38-
for row in xrange(0, self.nbCellsY):
34+
for col in range(0, self.nbCellsX):
35+
for row in range(0, self.nbCellsY):
3936
cellExtent = self.cellExtent(col, row)
4037
yield (cellExtent, col, row)
4138

gatilegrid/tilegrids.py

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
# -*- coding: utf-8 -*-
2-
31
import math
4-
from past.builtins import xrange
52

63

74
EPSG4326_METERS_PER_UNIT = math.pi * 6378137 / 180
@@ -257,10 +254,10 @@ def iterGrid(self, minZoom, maxZoom):
257254
assert maxZoom in range(0, len(self.RESOLUTIONS))
258255
assert minZoom <= maxZoom
259256

260-
for zoom in xrange(minZoom, maxZoom + 1):
257+
for zoom in range(minZoom, maxZoom + 1):
261258
[minRow, minCol, maxRow, maxCol] = self.getExtentAddress(zoom)
262-
for row in xrange(minRow, maxRow + 1):
263-
for col in xrange(minCol, maxCol + 1):
259+
for row in range(minRow, maxRow + 1):
260+
for col in range(minCol, maxCol + 1):
264261
tileBounds = self.tileBounds(zoom, col, row)
265262
yield (tileBounds, zoom, col, row)
266263

@@ -287,7 +284,7 @@ def totalNumberOfTiles(self, minZoom=None, maxZoom=None):
287284
maxZoom = maxZoom + 1
288285
else:
289286
maxZoom = len(self.RESOLUTIONS)
290-
for zoom in xrange(minZoom, maxZoom):
287+
for zoom in range(minZoom, maxZoom):
291288
nbTiles += self.numberOfTilesAtZoom(zoom)
292289
return nbTiles
293290

@@ -443,7 +440,7 @@ def __init__(self,
443440
originCorner='top-left',
444441
useSwissExtent=True):
445442

446-
super(GeoadminTileGridLV03, self).__init__(
443+
super().__init__(
447444
extent=extent,
448445
tileSizePx=tileSizePx,
449446
originCorner=originCorner,
@@ -459,7 +456,7 @@ def __init__(self,
459456
originCorner='top-left',
460457
useSwissExtent=True):
461458

462-
super(GeoadminTileGridLV95, self).__init__(
459+
super().__init__(
463460
extent=extent,
464461
tileSizePx=tileSizePx,
465462
originCorner=originCorner,
@@ -475,7 +472,7 @@ def __init__(self,
475472
originCorner='top-left',
476473
useSwissExtent=True):
477474

478-
super(GlobalMercatorTileGrid, self).__init__(
475+
super().__init__(
479476
extent=extent,
480477
tileSizePx=tileSizePx,
481478
originCorner=originCorner,
@@ -492,7 +489,7 @@ def __init__(self,
492489
tmsCompatible=True,
493490
useSwissExtent=True):
494491

495-
super(GlobalGeodeticTileGrid, self).__init__(
492+
super().__init__(
496493
extent=extent,
497494
tileSizePx=tileSizePx,
498495
originCorner=originCorner,

setup.py

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
1-
# -*- coding: utf-8 -*-
2-
3-
# HACK for `nose.collector` to work on python 2.7.3 and earlier
4-
import multiprocessing
5-
import os
61
from setuptools import setup
72

83

@@ -11,7 +6,7 @@
116

127

138
setup(name='gatilegrid',
14-
version='0.2.0',
9+
version='1.0.0',
1510
description='Popular tile grids and grids API for web mapping applications',
1611
keywords='gis wmts grid map',
1712
author='Loic Gasser',
@@ -27,20 +22,17 @@
2722
'License :: OSI Approved :: MIT License',
2823
'Operating System :: OS Independent',
2924
'Programming Language :: Python',
30-
'Programming Language :: Python :: 2',
31-
'Programming Language :: Python :: 2.7',
3225
'Programming Language :: Python :: 3',
33-
'Programming Language :: Python :: 3.5',
34-
'Programming Language :: Python :: 3.6',
35-
'Programming Language :: Python :: 3.7',
36-
'Programming Language :: Python :: 3.8',
26+
'Programming Language :: Python :: 3.10',
27+
'Programming Language :: Python :: 3.11',
28+
'Programming Language :: Python :: 3.12',
29+
'Programming Language :: Python :: 3.13',
3730
'Topic :: Scientific/Engineering :: GIS',
3831
'Topic :: Software Development :: Libraries :: Python Modules'
3932
],
4033
zip_safe=False,
4134
long_description=long_description,
4235
long_description_content_type='text/markdown',
43-
test_suite='nose.collector',
44-
install_requires=['future'],
45-
python_requires='>2.6, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, <4',
36+
install_requires=[],
37+
python_requires='>=3.10',
4638
)

tests/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +0,0 @@
1-
# -*- coding: utf-8 -*-

tests/test_grid.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
# -*- coding: utf-8 -*-
2-
31
import unittest
42
from gatilegrid.grid import Grid
53

tests/test_tilegrids.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
# -*- coding: utf-8 -*-
2-
31
import math
42
import unittest
53
from gatilegrid import getTileGrid, GeoadminTileGridLV03, \

0 commit comments

Comments
 (0)