Skip to content

Commit

Permalink
Merge branch 'master' into moong23-docs_update
Browse files Browse the repository at this point in the history
  • Loading branch information
Pessimistress committed Apr 26, 2024
2 parents da60e65 + e823e40 commit 3235dcd
Show file tree
Hide file tree
Showing 83 changed files with 3,579 additions and 3,149 deletions.
51 changes: 40 additions & 11 deletions .github/workflows/release.yml
Expand Up @@ -5,35 +5,64 @@ on:
tags:
- v*

permissions:
contents: read

jobs:
release-notes:
check_branch:
runs-on: ubuntu-latest
outputs:
should_build: ${{ steps.permitted.outputs.result }}

steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

if: github.repository_owner == 'visgl'
- name: Fetch remote branches
run: |
git fetch origin --depth=1
- name: Check if on permitted branch
id: permitted
run: |
result=
branchName=$(git branch -a --contains $GITHUB_SHA | grep 'remotes/origin/' || echo "")
if [[ $branchName == *"master" || $branchName == *"-release" ]]; then
result=true
fi
echo "result=${result}" >> "$GITHUB_OUTPUT"
release:
runs-on: ubuntu-latest
needs: check_branch
permissions:
contents: write

if: ${{ github.repository_owner == 'visgl' && needs.check_branch.outputs.should_build }}

env:
ADMIN_TOKEN: ${{ secrets.ADMIN_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_ACCESS_TOKEN: ${{ secrets.NPM_ACCESS_TOKEN }}

steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

- name: Get git tags (https://github.com/actions/checkout/issues/206)
run: git fetch --tags -f

- name: Use Node.js
uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v4.0.0
with:
node-version: '18.x'

- name: Publish release
- name: Create GitHub release entry
run: |
body=$(node scripts/github-release.js) &&
curl \
-X POST \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/visgl/deck.gl/releases \
-d "${body}" \
-H "Authorization: token ${ADMIN_TOKEN}"
-H "Authorization: token ${GITHUB_TOKEN}"
- name: Login to NPM
run: npm config set "//registry.npmjs.org/:_authToken=${NPM_ACCESS_TOKEN}"

- name: Install dependencies
run: yarn

- name: Publish to NPM
run: npx ocular-publish from-git
8 changes: 2 additions & 6 deletions .github/workflows/test.yml
Expand Up @@ -26,14 +26,10 @@ jobs:
node-version: '18.x'

- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y mesa-utils xvfb libgl1-mesa-dri libglapi-mesa libosmesa6 libxi-dev
yarn bootstrap
run: yarn bootstrap

- name: Run tests
run: |
xvfb-run -s "-ac -screen 0 1280x1024x16" yarn test-ci
run: yarn test-ci

- name: Coveralls
uses: coverallsapp/github-action@09b709cf6a16e30b0808ba050c7a6e8a5ef13f8d # v1.2.5
Expand Down
47 changes: 23 additions & 24 deletions .github/workflows/website.yml
Expand Up @@ -5,52 +5,51 @@ on:
branches:
- '*-release'

permissions:
contents: read

jobs:
publish-website:
check_branch:
runs-on: ubuntu-latest
outputs:
should_deploy: ${{ endsWith(github.ref, steps.get_version.outputs.latest) }}

steps:
- name: Get version
id: get_version
run: |
LATEST=$(npm show deck.gl@latest version | grep -o -E "^[0-9]+\.[0-9]+")
echo "latest=${LATEST}-release" >> "$GITHUB_OUTPUT"
if: github.repository_owner == 'visgl'
deploy:
runs-on: ubuntu-latest
needs: check_branch

permissions:
contents: write

env:
MapboxAccessToken: ${{ secrets.MAPBOX_ACCESS_TOKEN }}
GoogleMapsAPIKey: ${{ secrets.GOOGLE_MAPS_API_KEY }}
GoogleMapsMapId: ${{ secrets.GOOGLE_MAPS_MAP_ID }}
if: ${{ github.repository_owner == 'visgl' && needs.check_branch.outputs.should_deploy }}

steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
token: ${{ secrets.ADMIN_TOKEN }}
token: ${{ secrets.WEBSITE_DEPLOY_TOKEN }}

- name: Use Node.js
uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v4.0.0
with:
node-version: '18.x'

- name: Get version
id: get-version
run: LATEST=$(npm show deck.gl version | grep -o -E "^[0-9]+\.[0-9]+") && echo "::set-output name=latest::/${LATEST}-release"

- name: Check version
if: ${{ !endsWith(github.ref, steps.get-version.outputs.latest) }}
- name: Install dependencies
run: |
echo "Website is only published from the latest release branch"
yarn bootstrap
(cd website && yarn)
- name: Build website
if: ${{ endsWith(github.ref, steps.get-version.outputs.latest) }}
run: |
yarn bootstrap
cd website
yarn
yarn build
env:
MapboxAccessToken: ${{ secrets.MAPBOX_ACCESS_TOKEN }}
GoogleMapsAPIKey: ${{ secrets.GOOGLE_MAPS_API_KEY }}
GoogleMapsMapId: ${{ secrets.GOOGLE_MAPS_MAP_ID }}
run: (cd website && yarn build)

- name: Deploy
if: ${{ endsWith(github.ref, steps.get-version.outputs.latest) }}
uses: JamesIves/github-pages-deploy-action@132898c54c57c7cc6b80eb3a89968de8fc283505 # 3.7.1
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Expand Up @@ -21,6 +21,10 @@ Ref: http://keepachangelog.com/en/0.3.0/

### deck.gl v9.0 Prereleases

#### deck.gl [9.0.0-beta.11] - Apr 24 2024

- Publish NPM packages from CI (#8828)

#### deck.gl [9.0.0-beta.10] - Mar 20 2024

- Add Zoom and Compass widgets (#8072)
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Expand Up @@ -37,7 +37,7 @@ If you consider opening a PR, here is some documentation to get you started:

Each example can be run so that it is built against the deck.gl source code in this repo instead of building against the installed version of deck.gl. This enables using the examples to debug the main deck.gl library source.

To do so use the `yarn start-local` command present in each example's directory. See [webpack.config.local.js](https://github.com/visgl/deck.gl/blob/master/examples/webpack.config.local.js) for details.
To do so use the `yarn start-local` command present in each example's directory. See [vite.config.local.mjs](https://github.com/visgl/deck.gl/blob/master/examples/vite.config.local.mjs) for details.

### Working with other vis.gl dependencies

Expand Down
3 changes: 3 additions & 0 deletions bindings/pydeck-carto/Makefile
Expand Up @@ -16,6 +16,9 @@ lint:
test:
$(BIN)/pytest tests --cov=pydeck_carto

test-scripts:
for file in examples/scripts/*.py; do $(BIN)/python "$$file"; done

publish-pypi:
rm -rf $(DIST) $(BUILD) *.egg-info
$(BIN)/python setup.py sdist bdist_wheel
Expand Down
21 changes: 12 additions & 9 deletions bindings/pydeck-carto/README.md
Expand Up @@ -31,16 +31,19 @@ from carto_auth import CartoAuth
# Authentication with CARTO
carto_auth = CartoAuth.from_oauth()

# Register CartoLayer in pydeck
pdkc.register_carto_layer()

# Render CartoLayer in pydeck
# Register new layer types in pydeck
pdkc.register_layers()

# Render CARTO layer in pydeck
data = pdkc.sources.vector_query_source(
access_token=carto_auth.get_access_token(),
api_base_url=carto_auth.get_api_base_url(),
connection_name="carto_dw",
sql_query="SELECT geom, name FROM carto-demo-data.demo_tables.world_airports",
)
layer = pdk.Layer(
"CartoLayer",
data="SELECT geom, name FROM carto-demo-data.demo_tables.airports",
type_=pdkc.MapType.QUERY,
connection=pdkc.CartoConnection.CARTO_DW,
credentials=pdkc.get_layer_credentials(carto_auth),
"VectorTileLayer",
data=data,
get_fill_color=[238, 77, 90],
point_radius_min_pixels=2.5,
pickable=True,
Expand Down
14 changes: 14 additions & 0 deletions bindings/pydeck-carto/docs/changelog.rst
Expand Up @@ -3,9 +3,23 @@ CHANGELOG

Releases and associated GitHub PRs for pydeck-carto are documented here.

0.2 Releases
------------

0.2.0b0 - Apr 24 2024
^^^^^^^^^^^^^^^^^^^
- Update to deck.gl v9.0
- Rename register_carto_layer to register_layers
- Add layer enums: VectorTileLayer, H3TileLayer, QuadbinTileLayer
- Add source functions: vector_table_source, vector_query_source, vector_tileset_source, h3_table_source, h3_query_source, h3_tileset_source, quadbin_table_source, quadbin_query_source, quadbin_tileset_source

0.1 Releases
------------

0.1.1b0 - Apr 24 2024
^^^^^^^^^^^^^^^^^^^
- Update to deck.gl v8.9

0.1.0 - Nov 04 2022
^^^^^^^^^^^^^^^^^^^
- Add register_carto_layer function: integration with pydeck (CartoLayer).
Expand Down
4 changes: 2 additions & 2 deletions bindings/pydeck-carto/docs/conf.py
Expand Up @@ -12,9 +12,9 @@
copyright = f"{datetime.datetime.utcnow().year}, CartoDB Inc"
author = "CARTO"
# The short X.Y version
version = "0.1"
version = "0.2"
# The full version, including alpha/beta/rc tags
release = "0.1.0"
release = "0.2.0b0"
# Extensions to generate documents from our docstrings here
extensions = ["sphinx.ext.autodoc", "sphinx.ext.napoleon", "sphinx_rtd_theme"]
templates_path = ["_templates"]
Expand Down
2 changes: 1 addition & 1 deletion bindings/pydeck-carto/docs/contributing.rst
Expand Up @@ -9,7 +9,7 @@ For governance policy and code of conduct, please see the `deck.gl contribution
Development installation
^^^^^^^^^^^^^^^^^^^^^^^^

Please develop using Python 3.7 or above.
Please develop using Python 3.8 or above.

.. code-block:: bash
Expand Down
19 changes: 12 additions & 7 deletions bindings/pydeck-carto/examples/scripts/carto_layer_geo_query.py
Expand Up @@ -7,17 +7,22 @@
import pydeck as pdk
import pydeck_carto as pdkc
from carto_auth import CartoAuth
from os.path import join, dirname

carto_auth = CartoAuth.from_oauth()

pdkc.register_carto_layer()
pdkc.register_layers()

data = pdkc.sources.vector_query_source(
access_token=carto_auth.get_access_token(),
api_base_url=carto_auth.get_api_base_url(),
connection_name="carto_dw",
sql_query="SELECT geom, name FROM carto-demo-data.demo_tables.world_airports",
)

layer = pdk.Layer(
"CartoLayer",
data="SELECT geom, name FROM carto-demo-data.demo_tables.airports",
type_=pdkc.MapType.QUERY,
connection=pdkc.CartoConnection.CARTO_DW,
credentials=pdkc.get_layer_credentials(carto_auth),
"VectorTileLayer",
data=data,
get_fill_color=[238, 77, 90],
point_radius_min_pixels=2.5,
pickable=True,
Expand All @@ -26,4 +31,4 @@
view_state = pdk.ViewState(latitude=0, longitude=0, zoom=1)

r = pdk.Deck(layer, map_style=pdk.map_styles.ROAD, initial_view_state=view_state)
r.to_html("carto_layer_geo_query.html", open_browser=True)
r.to_html(join(dirname(__file__), "carto_layer_geo_query.html"))
Expand Up @@ -7,19 +7,24 @@
import pydeck as pdk
import pydeck_carto as pdkc
from carto_auth import CartoAuth
from os.path import join, dirname

carto_auth = CartoAuth.from_oauth()

pdkc.register_carto_layer()
pdkc.register_layers()

layer = pdk.Layer(
"CartoLayer",
data="SELECT geom, event FROM carto-demo-data.demo_tables"
data = pdkc.sources.vector_query_source(
access_token=carto_auth.get_access_token(),
api_base_url=carto_auth.get_api_base_url(),
connection_name="carto_dw",
sql_query="SELECT geom, event FROM carto-demo-data.demo_tables"
".spain_earthquakes where depth > ?",
query_parameters=[2],
type_=pdkc.MapType.QUERY,
connection=pdkc.CartoConnection.CARTO_DW,
credentials=pdkc.get_layer_credentials(carto_auth),
)

layer = pdk.Layer(
"VectorTileLayer",
data=data,
get_fill_color=[238, 77, 90],
point_radius_min_pixels=2.5,
pickable=True,
Expand All @@ -28,4 +33,4 @@
view_state = pdk.ViewState(latitude=36, longitude=-7.44, zoom=5)

r = pdk.Deck(layer, map_style=pdk.map_styles.ROAD, initial_view_state=view_state)
r.to_html("carto_layer_geo_query_param.html", open_browser=True)
r.to_html(join(dirname(__file__), "carto_layer_geo_query_param.html"))
19 changes: 12 additions & 7 deletions bindings/pydeck-carto/examples/scripts/carto_layer_geo_table.py
Expand Up @@ -7,17 +7,22 @@
import pydeck as pdk
import pydeck_carto as pdkc
from carto_auth import CartoAuth
from os.path import join, dirname

carto_auth = CartoAuth.from_oauth()

pdkc.register_carto_layer()
pdkc.register_layers()

data = pdkc.sources.vector_table_source(
access_token=carto_auth.get_access_token(),
api_base_url=carto_auth.get_api_base_url(),
connection_name="carto_dw",
table_name="carto-demo-data.demo_tables.world_airports",
)

layer = pdk.Layer(
"CartoLayer",
data="carto-demo-data.demo_tables.airports",
type_=pdkc.MapType.TABLE,
connection=pdkc.CartoConnection.CARTO_DW,
credentials=pdkc.get_layer_credentials(carto_auth),
"VectorTileLayer",
data=data,
get_fill_color=[200, 0, 80],
point_radius_min_pixels=2,
pickable=True,
Expand All @@ -26,4 +31,4 @@
view_state = pdk.ViewState(latitude=0, longitude=0, zoom=1)

r = pdk.Deck(layer, map_style=pdk.map_styles.ROAD, initial_view_state=view_state)
r.to_html("carto_layer_geo_table.html", open_browser=True)
r.to_html(join(dirname(__file__), "carto_layer_geo_table.html"))

0 comments on commit 3235dcd

Please sign in to comment.