polyline 2.0.2__tar.gz → 2.0.4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: polyline
3
- Version: 2.0.2
3
+ Version: 2.0.4
4
4
  Summary: A Python implementation of Google's Encoded Polyline Algorithm Format.
5
5
  Author: Frederick Jansen, Bruno M. Custódio
6
6
  License: Copyright (c) 2023 Frederick Jansen
@@ -26,7 +26,7 @@ License: Copyright (c) 2023 Frederick Jansen
26
26
 
27
27
  Project-URL: homepage, https://github.com/frederickjansen/polyline
28
28
  Project-URL: repository, https://github.com/frederickjansen/polyline
29
- Requires-Python: >=3.7
29
+ Requires-Python: >=3.8
30
30
  Description-Content-Type: text/x-rst
31
31
  License-File: LICENSE
32
32
  Provides-Extra: dev
@@ -35,10 +35,12 @@ Requires-Dist: pytest-cov~=4.0; extra == "dev"
35
35
  Requires-Dist: pylint~=3.0.3; extra == "dev"
36
36
  Requires-Dist: sphinx~=5.3.0; extra == "dev"
37
37
  Requires-Dist: sphinx-rtd-theme~=1.2.0; extra == "dev"
38
- Requires-Dist: toml~=0.10.2; extra == "dev"
38
+ Requires-Dist: standard-imghdr; python_version > "3.12" and extra == "dev"
39
+ Requires-Dist: tomli; python_version < "3.11" and extra == "dev"
39
40
  Provides-Extra: publish
40
41
  Requires-Dist: build~=0.8; extra == "publish"
41
- Requires-Dist: twine~=4.0; extra == "publish"
42
+ Requires-Dist: twine~=6.0; extra == "publish"
43
+ Dynamic: license-file
42
44
 
43
45
  polyline
44
46
  ========
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "polyline"
3
- version = "2.0.2"
3
+ version = "2.0.4"
4
4
  description = "A Python implementation of Google's Encoded Polyline Algorithm Format."
5
5
  license = {file = "LICENSE"}
6
6
  authors = [
@@ -8,7 +8,7 @@ authors = [
8
8
  {name = "Bruno M. Custódio"},
9
9
  ]
10
10
  readme = "README.rst"
11
- requires-python = ">=3.7"
11
+ requires-python = ">=3.8"
12
12
 
13
13
  dependencies = [
14
14
  ]
@@ -24,16 +24,17 @@ dev = [
24
24
  "pylint~=3.0.3",
25
25
  "sphinx~=5.3.0",
26
26
  "sphinx-rtd-theme~=1.2.0",
27
- "toml~=0.10.2",
27
+ "standard-imghdr;python_version > '3.12'",
28
+ "tomli;python_version < '3.11'",
28
29
  ]
29
30
  publish = [
30
31
  "build~=0.8",
31
- "twine~=4.0"
32
+ "twine~=6.0"
32
33
  ]
33
34
 
34
35
  [build-system]
35
36
  requires = [
36
- "setuptools>=65.0"
37
+ "setuptools>=69.0"
37
38
  ]
38
39
  build-backend = "setuptools.build_meta"
39
40
 
File without changes
@@ -0,0 +1,59 @@
1
+ from PIL import Image
2
+ import numpy as np
3
+
4
+ # --- CONFIG ---
5
+ INPUT = "/Users/fjansen/Downloads/Table&Tulip/T&T_Logos_Final/T&T_Monogram.png"
6
+ OUTPUT_PNG = "/Users/fjansen/Downloads/Table&Tulip/T&T_Logos_Final/favicon-tight-512.png"
7
+ OUTPUT_ICO = "/Users/fjansen/Downloads/Table&Tulip/T&T_Logos_Final/favicon-tight.ico"
8
+ TARGET_SIZE = 480 # favicon base size
9
+ PADDING = 0.08 # % of edge padding after cropping
10
+
11
+
12
+ # --- LOAD IMAGE ---
13
+ img = Image.open(INPUT).convert("RGBA")
14
+ arr = np.asarray(img)
15
+
16
+ # --- DETECT NON-WHITE / NON-EMPTY PIXELS ---
17
+ # Treat nearly-white or transparent as background
18
+ mask = ~(
19
+ ((arr[...,0] > 245) & (arr[...,1] > 245) & (arr[...,2] > 245)) |
20
+ (arr[...,3] < 10)
21
+ )
22
+
23
+ coords = np.argwhere(mask)
24
+
25
+ # If nothing detected, fallback
26
+ if coords.size == 0:
27
+ cropped = img
28
+ else:
29
+ y0, x0 = coords.min(axis=0)[:2]
30
+ y1, x1 = coords.max(axis=0)[:2] + 1
31
+ cropped = img.crop((x0, y0, x1, y1))
32
+
33
+
34
+ # --- ADD MINIMAL PADDING ---
35
+ cw, ch = cropped.size
36
+ pad = int(max(cw, ch) * PADDING)
37
+
38
+ square_size = max(cw, ch) + pad * 2
39
+
40
+ #canvas = Image.new("RGBA", (square_size, square_size), (0,0,0,0))
41
+ #canvas.paste(cropped, ((square_size - cw)//2, (square_size - ch)//2))
42
+ # *** White background version ***
43
+ canvas = Image.new("RGBA", (square_size, square_size), (255, 255, 255, 255))
44
+ canvas.paste(cropped, ((square_size - cw)//2, (square_size - ch)//2), cropped)
45
+
46
+ # --- RESIZE FOR FAVORICON ---
47
+ favicon = canvas.resize((TARGET_SIZE, TARGET_SIZE), Image.LANCZOS)
48
+
49
+ # Save PNG
50
+ favicon.save(OUTPUT_PNG)
51
+
52
+ # Save ICO in multiple resolutions
53
+ favicon.save(
54
+ OUTPUT_ICO,
55
+ format="ICO",
56
+ sizes=[(16,16),(32,32),(48,48),(64,64),(128,128),(256,256)]
57
+ )
58
+
59
+ OUTPUT_PNG, OUTPUT_ICO
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: polyline
3
- Version: 2.0.2
3
+ Version: 2.0.4
4
4
  Summary: A Python implementation of Google's Encoded Polyline Algorithm Format.
5
5
  Author: Frederick Jansen, Bruno M. Custódio
6
6
  License: Copyright (c) 2023 Frederick Jansen
@@ -26,7 +26,7 @@ License: Copyright (c) 2023 Frederick Jansen
26
26
 
27
27
  Project-URL: homepage, https://github.com/frederickjansen/polyline
28
28
  Project-URL: repository, https://github.com/frederickjansen/polyline
29
- Requires-Python: >=3.7
29
+ Requires-Python: >=3.8
30
30
  Description-Content-Type: text/x-rst
31
31
  License-File: LICENSE
32
32
  Provides-Extra: dev
@@ -35,10 +35,12 @@ Requires-Dist: pytest-cov~=4.0; extra == "dev"
35
35
  Requires-Dist: pylint~=3.0.3; extra == "dev"
36
36
  Requires-Dist: sphinx~=5.3.0; extra == "dev"
37
37
  Requires-Dist: sphinx-rtd-theme~=1.2.0; extra == "dev"
38
- Requires-Dist: toml~=0.10.2; extra == "dev"
38
+ Requires-Dist: standard-imghdr; python_version > "3.12" and extra == "dev"
39
+ Requires-Dist: tomli; python_version < "3.11" and extra == "dev"
39
40
  Provides-Extra: publish
40
41
  Requires-Dist: build~=0.8; extra == "publish"
41
- Requires-Dist: twine~=4.0; extra == "publish"
42
+ Requires-Dist: twine~=6.0; extra == "publish"
43
+ Dynamic: license-file
42
44
 
43
45
  polyline
44
46
  ========
@@ -3,6 +3,8 @@ README.rst
3
3
  pyproject.toml
4
4
  src/polyline/__init__.py
5
5
  src/polyline/polyline.py
6
+ src/polyline/py.typed
7
+ src/polyline/test.py
6
8
  src/polyline.egg-info/PKG-INFO
7
9
  src/polyline.egg-info/SOURCES.txt
8
10
  src/polyline.egg-info/dependency_links.txt
@@ -5,8 +5,13 @@ pytest-cov~=4.0
5
5
  pylint~=3.0.3
6
6
  sphinx~=5.3.0
7
7
  sphinx-rtd-theme~=1.2.0
8
- toml~=0.10.2
8
+
9
+ [dev:python_version < "3.11"]
10
+ tomli
11
+
12
+ [dev:python_version > "3.12"]
13
+ standard-imghdr
9
14
 
10
15
  [publish]
11
16
  build~=0.8
12
- twine~=4.0
17
+ twine~=6.0
File without changes
File without changes
File without changes