From cd5d9bcd3cd08855ea73f4e2c150ebdc50ddc7d6 Mon Sep 17 00:00:00 2001 From: lvisei Date: Thu, 28 Mar 2024 13:05:45 +0800 Subject: [PATCH 1/7] Revert "docs: link" This reverts commit 5a76d0a5d6b164fce004cda7df4ba5bbf776ffdd. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d38f689..5768d92 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ [L7VP](https://github.com/antvis/L7VP) is an geospatial intelligent visual analysis and application development tools. -This project was created to allow us to render [L7VP](https://github.com/antvis/L7VP) maps in streamlit.🌍 [Live Demo](https://location-insight.streamlit.app) 🌍 +This project was created to allow us to render [L7VP](https://github.com/antvis/L7VP) maps in streamlit.🌍 [Live Demo]() 🌍 [![Latest Stable Version](https://img.shields.io/pypi/v/streamlit-l7vp.svg)](https://pypi.python.org/pypi/streamlit-l7vp) [![Test Status](https://github.com/lvisei/streamlit-l7vp/workflows/test/badge.svg)](https://github.com/lvisei/streamlit-l7vp/actions?query=workflow:test) From 14030d97a5b5ead93cddbd18fbcdb84e4eaaeffe Mon Sep 17 00:00:00 2001 From: lvisei Date: Thu, 28 Mar 2024 13:05:45 +0800 Subject: [PATCH 2/7] Revert "chore: streamlit" This reverts commit 4d9b501d8e819c2cd7b288740bfa84715f0e03fd. --- .streamlit/config.toml | 2 - README.md | 3 +- examples/requirements.txt | 3 +- ...p-map.py => streamlit-keplergl-example.py} | 0 examples/welcome.py | 21 +--- setup.py | 107 +++--------------- 6 files changed, 20 insertions(+), 116 deletions(-) delete mode 100644 .streamlit/config.toml rename examples/{streamlit-l7vp-map.py => streamlit-keplergl-example.py} (100%) diff --git a/.streamlit/config.toml b/.streamlit/config.toml deleted file mode 100644 index c9b8c45..0000000 --- a/.streamlit/config.toml +++ /dev/null @@ -1,2 +0,0 @@ -[theme] -base="dark" \ No newline at end of file diff --git a/README.md b/README.md index 5768d92..8ceff96 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,6 @@ pip install streamlit-l7vp ```py import streamlit as st -from pyl7vp import L7VP from streamlit_l7vp import l7vp_static import pandas as pd @@ -58,6 +57,8 @@ git clone https://github.com/lvisei/streamlit-l7vp.git ### Install python module ```sh +cd bindings/pyl7vp + # dev install from folder containing setup.py pip install -e . ``` diff --git a/examples/requirements.txt b/examples/requirements.txt index ed342da..f1cde63 100644 --- a/examples/requirements.txt +++ b/examples/requirements.txt @@ -1,3 +1,2 @@ streamlit -streamlit-l7vp -pandas \ No newline at end of file +streamlit-l7vp \ No newline at end of file diff --git a/examples/streamlit-l7vp-map.py b/examples/streamlit-keplergl-example.py similarity index 100% rename from examples/streamlit-l7vp-map.py rename to examples/streamlit-keplergl-example.py diff --git a/examples/welcome.py b/examples/welcome.py index 5f83b3e..f4113ec 100644 --- a/examples/welcome.py +++ b/examples/welcome.py @@ -1,7 +1,5 @@ import streamlit as st -from pyl7vp import L7VP from streamlit_l7vp import l7vp_static -import pandas as pd st.set_page_config(page_title="streamlit-l7vp: AntV L7VP for Streamlit!", page_icon="🌍", layout="wide") @@ -10,22 +8,5 @@ [L7VP](https://github.com/antvis/L7VP) is an geospatial intelligent visual analysis and application development tools. -This project was created to allow us to render [L7VP](https://github.com/antvis/L7VP) maps in streamlit. +This project was created to allow us to render [L7VP](https://github.com/antvis/L7VP) maps in streamlit. In the meantime, below are some examples of what you can do with just a few lines of code: """ - - -df = pd.DataFrame( - {'id': ['a', 'b', 'c'], - 'point_latitude': [31.2384, 31.2311, 31.2334], - 'point_longitude': [108.30948, 108.30231, 108.30238], - 'value': [5, 11, 9], - 'time': ['2019-08-01 12:00:00', '2019-08-01 12:05:00', '2020-08-01 11:55:00'] - }) - -l7vp_map = L7VP(height = 800) -# Add dataset to map -l7vp_map.add_dataset({"id": "my_dataset", "type": 'local', "data": df}) -l7vp_map.set_theme("dark") - - -l7vp_static(l7vp_map) \ No newline at end of file diff --git a/setup.py b/setup.py index aeecab2..f2dcfdf 100644 --- a/setup.py +++ b/setup.py @@ -1,96 +1,21 @@ -import io -import os -import sys -from shutil import rmtree -from setuptools import Command, find_packages, setup +import setuptools +from pathlib import Path +parent_dir = Path(__file__).resolve().parent -def read(*names, **kwargs): - return io.open( - os.path.join(os.path.dirname(__file__), *names), - encoding=kwargs.get("encoding", "utf8") - ).read() - -# RELEASE STEPS -# python setup.py upload - - -__title__ = "streamlit-l7vp" -__description__ = "Streamlit Component for rendering L7VP maps" -__long_description__ = read('README.md') -__url__ = "https://github.com/lvisei/streamlit-l7vp" -__author_email__ = "yunji.me@outlook.com" -__license__ = "Apache-2.0" - -__requires__ = ["streamlit>=0.79", "pyl7vp"] -__extra_requires__ = {} - -__keywords__ = ["Streamlit", "L7VP", "PyL7VP", - "visualization", "map", "geospatial visualization", "geospatial analysis"] - -# Load the package's _version.py module as a dictionary. -here = os.path.abspath(os.path.dirname(__file__)) - - -class UploadCommand(Command): - description = "Build and publish the package." - user_options = [] - - @staticmethod - def status(s): - print("✨✨ {0}".format(s)) - - def initialize_options(self): - pass - - def finalize_options(self): - pass - - def run(self): - try: - self.status("Removing previous builds…") - rmtree(os.path.join(here, "dist")) - rmtree(os.path.join(here, "build")) - rmtree(os.path.join(here, "{0}.egg-info".format(__title__))) - except OSError: - pass - - self.status("Building Source and Wheel distribution…") - os.system("{0} setup.py bdist_wheel sdist".format(sys.executable)) - - self.status("Uploading the package to PyPI via Twine…") - os.system("python -m twine upload dist/*") - - sys.exit() - - -setup( - name=__title__, +setuptools.setup( + name="streamlit-l7vp", version="0.0.1", - description=__description__, - long_description=__long_description__, - long_description_content_type="text/markdown", - url=__url__, author="lvisei", - author_email=__author_email__, - license=__license__, - packages=find_packages(exclude=("tests",)), - keywords=__keywords__, - install_requires=__requires__, - zip_safe=False, + author_email="yunji.me@outlook.com", + description="Streamlit Component for rendering L7VP maps", + long_description=parent_dir.joinpath("README.md").read_text(), + long_description_content_type="text/markdown", + url="https://github.com/lvisei/streamlit-l7vp", + license="Apache-2.0", + packages=setuptools.find_packages(exclude=("tests", "docs", "examples")), include_package_data=True, - classifiers=[ - "Environment :: Console", - "Intended Audience :: Developers", - "License :: OSI Approved :: Apache Software License", - "Operating System :: OS Independent", - "Programming Language :: Python", - "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.7", - "Programming Language :: Python :: 3.8", - "Programming Language :: Python :: 3.9", - "Topic :: Software Development :: Libraries", - ], - cmdclass={"upload": UploadCommand}, - extras_require=__extra_requires__, -) + classifiers=[], + python_requires=">=3.7", + install_requires=parent_dir.joinpath("requirements.txt").read_text().splitlines(), +) \ No newline at end of file From 7068a8e21a12b1cc3d2d04ff3cd0827f040a19b5 Mon Sep 17 00:00:00 2001 From: lvisei Date: Thu, 28 Mar 2024 13:05:45 +0800 Subject: [PATCH 3/7] Revert "chore: docs" This reverts commit eeafc4e048475de3530413e8d3fe73afb7456795. --- README.md | 81 ++------------------------------------------- examples/welcome.py | 2 ++ 2 files changed, 5 insertions(+), 78 deletions(-) diff --git a/README.md b/README.md index 8ceff96..5c96eff 100644 --- a/README.md +++ b/README.md @@ -1,82 +1,7 @@ ## streamlit-l7vp -[L7VP](https://github.com/antvis/L7VP) is an geospatial intelligent visual analysis and application development tools. - -This project was created to allow us to render [L7VP](https://github.com/antvis/L7VP) maps in streamlit.🌍 [Live Demo]() 🌍 - -[![Latest Stable Version](https://img.shields.io/pypi/v/streamlit-l7vp.svg)](https://pypi.python.org/pypi/streamlit-l7vp) -[![Test Status](https://github.com/lvisei/streamlit-l7vp/workflows/test/badge.svg)](https://github.com/lvisei/streamlit-l7vp/actions?query=workflow:test) - -## Installation - -``` -pip install streamlit-l7vp -``` - -## Usage - -```py -import streamlit as st -from streamlit_l7vp import l7vp_static -import pandas as pd - -df = pd.DataFrame( - {'id': ['a', 'b', 'c'], - 'point_latitude': [31.2384, 31.2311, 31.2334], - 'point_longitude': [108.30948, 108.30231, 108.30238], - 'value': [5, 11, 9], - 'time': ['2019-08-01 12:00:00', '2019-08-01 12:05:00', '2020-08-01 11:55:00'] - }) - -l7vp_map = L7VP(height = 600) -# Add dataset to map -l7vp_map.add_dataset({"id": "my_dataset", "type": 'local', "data": df}) - - -l7vp_static(l7vp_map) -``` - -## API - -### l7vp_static parameters +Welcome to [streamlit-l7vp](https://github.com/lvisei/streamlit-l7vp)! -- fig: `pyl7vp.L7VP` map figure. -- height: Fixed pixel height of the map. Optional, might result in non-optimal layout on some devices. By - default the map height is determined by the l7vp figure height. -- width: Fixed pixel width of the map. Optional, by default the map width adjusts to the streamlit layout. -- read_only: Disables the side panel for map customization, default False. - -## Local Development - -### Clone code - -```shell -git clone https://github.com/lvisei/streamlit-l7vp.git -``` - -### Install python module - -```sh -cd bindings/pyl7vp - -# dev install from folder containing setup.py -pip install -e . -``` - -### Release a new version - -Update `version` in `setup.py` - -```py -version="0.0.1" -``` - -Build and publish - -```bash -python setup.py upload -``` - -## License +[L7VP](https://github.com/antvis/L7VP) is an geospatial intelligent visual analysis and application development tools. -[Apache-2.0](./LICENSE) +This project was created to allow us to render [L7VP](https://github.com/antvis/L7VP) maps in streamlit. diff --git a/examples/welcome.py b/examples/welcome.py index f4113ec..78d70f8 100644 --- a/examples/welcome.py +++ b/examples/welcome.py @@ -10,3 +10,5 @@ This project was created to allow us to render [L7VP](https://github.com/antvis/L7VP) maps in streamlit. In the meantime, below are some examples of what you can do with just a few lines of code: """ + +st.image("https://mdn.alipayobjects.com/huamei_qa8qxu/afts/img/A*_GfqQoRCqQkAAAAAAAAAAAAADmJ7AQ/fmt.webp") \ No newline at end of file From 3b230c3e97e849b73f8dfa4ba9c71867f5ef5bac Mon Sep 17 00:00:00 2001 From: lvisei Date: Thu, 28 Mar 2024 13:05:45 +0800 Subject: [PATCH 4/7] Revert "chore: name" This reverts commit f69c8a62ba7aad58c191901be6548a8d8f322024. --- examples/streamlit-keplergl-example.py | 2 +- examples/welcome.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/streamlit-keplergl-example.py b/examples/streamlit-keplergl-example.py index 1274d50..6c21626 100644 --- a/examples/streamlit-keplergl-example.py +++ b/examples/streamlit-keplergl-example.py @@ -1,5 +1,5 @@ import streamlit as st -from streamlit_l7vp import l7vp_static +from streamlit-l7vp import l7vp_static from pyl7vp import L7VP st.write("This is a l7vp map in streamlit") diff --git a/examples/welcome.py b/examples/welcome.py index 78d70f8..1288479 100644 --- a/examples/welcome.py +++ b/examples/welcome.py @@ -1,5 +1,5 @@ import streamlit as st -from streamlit_l7vp import l7vp_static +from streamlit-l7vp import l7vp_static st.set_page_config(page_title="streamlit-l7vp: AntV L7VP for Streamlit!", page_icon="🌍", layout="wide") From 4cebb3bf0f46073b6db83303e377e00471e64fae Mon Sep 17 00:00:00 2001 From: lvisei Date: Thu, 28 Mar 2024 13:05:45 +0800 Subject: [PATCH 5/7] Revert "chore: ci" This reverts commit ac49bf52558e922e036604613e284f2ae7d65b66. --- .github/workflows/test.yml | 1 + README.md | 6 ------ 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c02ea4b..32b744e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -18,6 +18,7 @@ jobs: - name: Install dependencies run: | + cd bindings/pyl7vp python -m pip install --upgrade pip pip install -e . pip install flake8 pytest diff --git a/README.md b/README.md index 5c96eff..57d4221 100644 --- a/README.md +++ b/README.md @@ -1,7 +1 @@ ## streamlit-l7vp - -Welcome to [streamlit-l7vp](https://github.com/lvisei/streamlit-l7vp)! - -[L7VP](https://github.com/antvis/L7VP) is an geospatial intelligent visual analysis and application development tools. - -This project was created to allow us to render [L7VP](https://github.com/antvis/L7VP) maps in streamlit. From 95d3426a309a3bdf62ba0743ac93f03d78148764 Mon Sep 17 00:00:00 2001 From: lvisei Date: Thu, 28 Mar 2024 13:05:45 +0800 Subject: [PATCH 6/7] Revert "chore: python version" This reverts commit e58004f41ac9531d581772cac40bc38dce88f340. --- .github/workflows/test.yml | 2 +- setup.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 32b744e..4fccf08 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -7,7 +7,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: [3.7, 3.8, 3.9] + python-version: [3.6, 3.7, 3.8, 3.9] steps: - uses: actions/checkout@v2 diff --git a/setup.py b/setup.py index f2dcfdf..abcdf31 100644 --- a/setup.py +++ b/setup.py @@ -16,6 +16,6 @@ packages=setuptools.find_packages(exclude=("tests", "docs", "examples")), include_package_data=True, classifiers=[], - python_requires=">=3.7", + python_requires=">=3.6", install_requires=parent_dir.joinpath("requirements.txt").read_text().splitlines(), ) \ No newline at end of file From 3890ba479c0bfb9067de3805d87b73f7f0cc38ce Mon Sep 17 00:00:00 2001 From: lvisei Date: Thu, 28 Mar 2024 13:05:45 +0800 Subject: [PATCH 7/7] Revert "chore: init project" This reverts commit d0ef6f66edec980e5daeed3972d12809d18c7cb0. --- .github/workflows/test.yml | 36 ---------------------- README.md | 1 - examples/requirements.txt | 2 -- examples/streamlit-keplergl-example.py | 8 ----- examples/welcome.py | 14 --------- requirements.txt | 2 -- setup.py | 21 ------------- streamlit_l7vp/__init__.py | 41 -------------------------- tests/test_meta.py | 4 --- 9 files changed, 129 deletions(-) delete mode 100644 .github/workflows/test.yml delete mode 100644 README.md delete mode 100644 examples/requirements.txt delete mode 100644 examples/streamlit-keplergl-example.py delete mode 100644 examples/welcome.py delete mode 100644 requirements.txt delete mode 100644 setup.py delete mode 100644 streamlit_l7vp/__init__.py delete mode 100644 tests/test_meta.py diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml deleted file mode 100644 index 4fccf08..0000000 --- a/.github/workflows/test.yml +++ /dev/null @@ -1,36 +0,0 @@ -name: test - -on: push - -jobs: - test: - runs-on: ubuntu-latest - strategy: - matrix: - python-version: [3.6, 3.7, 3.8, 3.9] - - steps: - - uses: actions/checkout@v2 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 - with: - python-version: ${{ matrix.python-version }} - - - name: Install dependencies - run: | - cd bindings/pyl7vp - python -m pip install --upgrade pip - pip install -e . - pip install flake8 pytest - if [ -f requirements.txt ]; then pip install -r requirements.txt; fi - - - name: Lint with flake8 - run: | - # any syntax error, break build - flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics - # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide - flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics - - - name: Test with pytest - run: | - pytest diff --git a/README.md b/README.md deleted file mode 100644 index 57d4221..0000000 --- a/README.md +++ /dev/null @@ -1 +0,0 @@ -## streamlit-l7vp diff --git a/examples/requirements.txt b/examples/requirements.txt deleted file mode 100644 index f1cde63..0000000 --- a/examples/requirements.txt +++ /dev/null @@ -1,2 +0,0 @@ -streamlit -streamlit-l7vp \ No newline at end of file diff --git a/examples/streamlit-keplergl-example.py b/examples/streamlit-keplergl-example.py deleted file mode 100644 index 6c21626..0000000 --- a/examples/streamlit-keplergl-example.py +++ /dev/null @@ -1,8 +0,0 @@ -import streamlit as st -from streamlit-l7vp import l7vp_static -from pyl7vp import L7VP - -st.write("This is a l7vp map in streamlit") - -l7vp_map = L7VP(height=600) -l7vp_static(l7vp_map) \ No newline at end of file diff --git a/examples/welcome.py b/examples/welcome.py deleted file mode 100644 index 1288479..0000000 --- a/examples/welcome.py +++ /dev/null @@ -1,14 +0,0 @@ -import streamlit as st -from streamlit-l7vp import l7vp_static - -st.set_page_config(page_title="streamlit-l7vp: AntV L7VP for Streamlit!", page_icon="🌍", layout="wide") - -""" -# Welcome to [streamlit-l7vp](https://github.com/lvisei/streamlit-l7vp)! - -[L7VP](https://github.com/antvis/L7VP) is an geospatial intelligent visual analysis and application development tools. - -This project was created to allow us to render [L7VP](https://github.com/antvis/L7VP) maps in streamlit. In the meantime, below are some examples of what you can do with just a few lines of code: -""" - -st.image("https://mdn.alipayobjects.com/huamei_qa8qxu/afts/img/A*_GfqQoRCqQkAAAAAAAAAAAAADmJ7AQ/fmt.webp") \ No newline at end of file diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index a30d241..0000000 --- a/requirements.txt +++ /dev/null @@ -1,2 +0,0 @@ -streamlit>=0.79 -pyl7vp \ No newline at end of file diff --git a/setup.py b/setup.py deleted file mode 100644 index abcdf31..0000000 --- a/setup.py +++ /dev/null @@ -1,21 +0,0 @@ -import setuptools -from pathlib import Path - -parent_dir = Path(__file__).resolve().parent - -setuptools.setup( - name="streamlit-l7vp", - version="0.0.1", - author="lvisei", - author_email="yunji.me@outlook.com", - description="Streamlit Component for rendering L7VP maps", - long_description=parent_dir.joinpath("README.md").read_text(), - long_description_content_type="text/markdown", - url="https://github.com/lvisei/streamlit-l7vp", - license="Apache-2.0", - packages=setuptools.find_packages(exclude=("tests", "docs", "examples")), - include_package_data=True, - classifiers=[], - python_requires=">=3.6", - install_requires=parent_dir.joinpath("requirements.txt").read_text().splitlines(), -) \ No newline at end of file diff --git a/streamlit_l7vp/__init__.py b/streamlit_l7vp/__init__.py deleted file mode 100644 index 319b5c0..0000000 --- a/streamlit_l7vp/__init__.py +++ /dev/null @@ -1,41 +0,0 @@ -from typing import Optional - -import streamlit.components.v1 as components -from pyl7vp import L7VP - - -def l7vp_static( - fig: L7VP, - height: Optional[int] = None, - width: Optional[int] = None, - read_only: Optional[bool] = False, -) -> components.html: - """ - Renders a `pyl7vp.L7VP` map figure in a Streamlit app. - - This is a static Streamlit component, thus information from browser interaction can not be passed back from - L7VP to Python. - - Args: - fig: `pyl7vp.L7VP` map figure. - height: Fixed pixel height of the map. Optional, might result in non-optimal layout on some devices. By - default the map height is determined by the l7vp figure height. - width: Fixed pixel width of the map. Optional, by default the map width adjusts to the streamlit layout. - read_only: Disables the side panel for map customization, default False. - - Example: - ```python - >>> l7vp_map = L7VP() - >>> l7vp_static(l7vp_map) - ``` - """ - try: - html = fig._get_html_str(read_only=read_only) - except AttributeError: - raise TypeError( - "fig argument has to be a l7vp map object of type pyl7vp.L7VP!" - ) - - if height is None: - height = fig.height - return components.html(html, height=height + 10, width=width) \ No newline at end of file diff --git a/tests/test_meta.py b/tests/test_meta.py deleted file mode 100644 index 688deda..0000000 --- a/tests/test_meta.py +++ /dev/null @@ -1,4 +0,0 @@ -import pytest - -def test_meta(): - assert "1" == "1" \ No newline at end of file