Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix deck module typo and update uv lock #2217

Merged
merged 7 commits into from
Feb 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 0 additions & 42 deletions .github/workflows/py313.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]

env:
USE_MKDOCS: ${{ secrets.USE_MKDOCS }}
Expand Down
26 changes: 8 additions & 18 deletions geemap/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import urllib.request
import warnings
import zipfile
import importlib.resources

import ee
import ipywidgets as widgets
Expand Down Expand Up @@ -3454,12 +3455,11 @@ def create_colorbar(
import decimal

# import io
import pkg_resources
from colour import Color
from PIL import Image, ImageDraw, ImageFont

warnings.simplefilter("ignore")
pkg_dir = os.path.dirname(pkg_resources.resource_filename("geemap", "geemap.py"))
pkg_dir = str(importlib.resources.files("geemap").joinpath("geemap.py").parent)

if out_file is None:
filename = "colorbar_" + random_string() + ".png"
Expand Down Expand Up @@ -4120,11 +4120,9 @@ def ee_api_to_csv(outfile=None, timeout=300, proxies=None):
timeout (int, optional): Timeout in seconds. Defaults to 300.
proxies (dict, optional): Proxy settings. Defaults to None.
"""
import pkg_resources

from bs4 import BeautifulSoup

pkg_dir = os.path.dirname(pkg_resources.resource_filename("geemap", "geemap.py"))
pkg_dir = str(importlib.resources.files("geemap").joinpath("geemap.py").parent)
data_dir = os.path.join(pkg_dir, "data")
template_dir = os.path.join(data_dir, "template")
csv_file = os.path.join(template_dir, "ee_api_docs.csv")
Expand Down Expand Up @@ -4240,9 +4238,7 @@ def read_api_csv():
"""
import copy

import pkg_resources

pkg_dir = os.path.dirname(pkg_resources.resource_filename("geemap", "geemap.py"))
pkg_dir = str(importlib.resources.files("geemap").joinpath("geemap.py").parent)
data_dir = os.path.join(pkg_dir, "data")
template_dir = os.path.join(data_dir, "template")
csv_file = os.path.join(template_dir, "ee_api_docs.csv")
Expand Down Expand Up @@ -5129,9 +5125,8 @@ def vis_to_qml(ee_class_table, out_qml):
ee_class_table (str): An Earth Engine class table with triple quotes.
out_qml (str): File path to the output QGIS Layer Style (.qml).
"""
import pkg_resources

pkg_dir = os.path.dirname(pkg_resources.resource_filename("geemap", "geemap.py"))
pkg_dir = str(importlib.resources.files("geemap").joinpath("geemap.py").parent)
data_dir = os.path.join(pkg_dir, "data")
template_dir = os.path.join(data_dir, "template")
qml_template = os.path.join(template_dir, "NLCD.qml")
Expand Down Expand Up @@ -5178,9 +5173,7 @@ def create_nlcd_qml(out_qml):
Args:
out_qml (str): File path to the output qml.
"""
import pkg_resources

pkg_dir = os.path.dirname(pkg_resources.resource_filename("geemap", "geemap.py"))
pkg_dir = str(importlib.resources.files("geemap").joinpath("geemap.py").parent)
data_dir = os.path.join(pkg_dir, "data")
template_dir = os.path.join(data_dir, "template")
qml_template = os.path.join(template_dir, "NLCD.qml")
Expand Down Expand Up @@ -10012,9 +10005,7 @@ def get_census_dict(reset=False):
Returns:
dict: A dictionary of Census data.
"""
import pkg_resources

pkg_dir = os.path.dirname(pkg_resources.resource_filename("geemap", "geemap.py"))
pkg_dir = str(importlib.resources.files("geemap").joinpath("geemap.py").parent)
census_data = os.path.join(pkg_dir, "data/census_data.json")

if reset:
Expand Down Expand Up @@ -13729,10 +13720,9 @@ def create_legend(
str: The HTML code of the legend.
"""

import pkg_resources
from .legends import builtin_legends

pkg_dir = os.path.dirname(pkg_resources.resource_filename("geemap", "geemap.py"))
pkg_dir = str(importlib.resources.files("geemap").joinpath("geemap.py").parent)
legend_template = os.path.join(pkg_dir, "data/template/legend_style.html")

if draggable:
Expand Down
4 changes: 2 additions & 2 deletions geemap/datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from pathlib import Path

import ipywidgets as widgets
import pkg_resources
import importlib.resources
from box import Box
from IPython.display import display

Expand All @@ -25,7 +25,7 @@ def get_data_csv() -> str:
Returns:
str: File path to the CSV file.
"""
pkg_dir = os.path.dirname(pkg_resources.resource_filename("geemap", "geemap.py"))
pkg_dir = str(importlib.resources.files("geemap").joinpath("geemap.py").parent)
template_dir = os.path.join(pkg_dir, "data/template")
data_csv = os.path.join(template_dir, "ee_data_catalog.csv")
return data_csv
Expand Down
4 changes: 2 additions & 2 deletions geemap/examples/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import box
import os
import pkg_resources
import importlib.resources

_pkg_dir = os.path.dirname(pkg_resources.resource_filename("geemap", "geemap.py"))
_pkg_dir = str(importlib.resources.files("geemap").joinpath("geemap.py").parent)
_datasets_path = os.path.join(_pkg_dir, "examples/datasets.txt")
_baseurl = (
"https://raw.githubusercontent.com/gee-community/geemap/master/examples/data/"
Expand Down
2 changes: 0 additions & 2 deletions geemap/legends.py
Original file line number Diff line number Diff line change
Expand Up @@ -493,8 +493,6 @@ def ee_table_to_legend(in_table, out_file):
in_table (str): The input file path (*.txt) to the Earth Engine color table.
out_file (str): The output file path (*.txt) to the legend dictionary.
"""
# pkg_dir = os.path.dirname(pkg_resources.resource_filename("geemap", "geemap.py"))
# ee_legend_table = os.path.join(pkg_dir, "data/template/ee_legend_table.txt")

if not os.path.exists(in_table):
print("The class table does not exist.")
Expand Down
6 changes: 3 additions & 3 deletions geemap/map_widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -1437,10 +1437,10 @@ def _select_dataset(self, dataset_title):

def get_ee_example(self, asset_id):
try:
import pkg_resources
import importlib.resources

pkg_dir = os.path.dirname(
pkg_resources.resource_filename("geemap", "geemap.py")
pkg_dir = str(
importlib.resources.files("geemap").joinpath("geemap.py").parent
)
with open(os.path.join(pkg_dir, "data/gee_f.json"), encoding="utf-8") as f:
functions = json.load(f)
Expand Down
6 changes: 2 additions & 4 deletions geemap/maplibregl.py
Original file line number Diff line number Diff line change
Expand Up @@ -2468,12 +2468,10 @@ def add_legend(
Returns:
None
"""
import pkg_resources
import importlib.resources
from .legends import builtin_legends

pkg_dir = os.path.dirname(
pkg_resources.resource_filename("geemap", "geemap.py")
)
pkg_dir = str(importlib.resources.files("geemap").joinpath("geemap.py").parent)
legend_template = os.path.join(pkg_dir, "data/template/legend.html")

if not os.path.exists(legend_template):
Expand Down
5 changes: 3 additions & 2 deletions geemap/timelapse.py
Original file line number Diff line number Diff line change
Expand Up @@ -412,11 +412,12 @@ def add_text_to_gif(
# import io
import warnings

import pkg_resources
import importlib.resources
from PIL import Image, ImageDraw, ImageFont, ImageSequence

warnings.simplefilter("ignore")
pkg_dir = os.path.dirname(pkg_resources.resource_filename("geemap", "geemap.py"))

pkg_dir = str(importlib.resources.files("geemap").joinpath("geemap.py").parent)
default_font = os.path.join(pkg_dir, "data/fonts/arial.ttf")

in_gif = os.path.abspath(in_gif)
Expand Down
4 changes: 2 additions & 2 deletions geemap/toolbar.py
Original file line number Diff line number Diff line change
Expand Up @@ -1574,9 +1574,9 @@ def set_properties(_, geometry):

def get_tools_dict():
import pandas as pd
import pkg_resources
import importlib.resources

pkg_dir = os.path.dirname(pkg_resources.resource_filename("geemap", "geemap.py"))
pkg_dir = str(importlib.resources.files("geemap").joinpath("geemap.py").parent)
toolbox_csv = os.path.join(pkg_dir, "data/template/toolbox.csv")

df = pd.read_csv(toolbox_csv).set_index("index")
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ dependencies = [
"bqplot",
"colour",
"earthengine-api>=1.0.0",
"eerepr>=0.0.4",
"eerepr>=0.0.5",
"folium>=0.17.0",
"geocoder",
"ipyevents",
Expand Down
48 changes: 0 additions & 48 deletions tests/test_deck.py

This file was deleted.

Loading