Skip to content

Commit 894ecf0

Browse files
committed
prepare release
1 parent ece527e commit 894ecf0

File tree

8 files changed

+48
-58
lines changed

8 files changed

+48
-58
lines changed

.bumpversion.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[bumpversion]
2-
current_version = 0.7.0
2+
current_version = 0.8.0a0
33
commit = True
44
tag = True
55
tag_name = {new_version}

.github/workflows/ci.yml

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -118,25 +118,26 @@ jobs:
118118
- name: Install dependencies
119119
run: |
120120
python -m pip install --upgrade pip
121-
python -m pip install flit
122-
python -m pip install .
121+
python -m pip install hatch
122+
python -m hatch build
123123
124124
- name: Set tag version
125125
id: tag
126-
# https://stackoverflow.com/questions/58177786/get-the-current-pushed-tag-in-github-actions
127-
run: echo ::set-output name=tag::${GITHUB_REF#refs/*/}
126+
run: |
127+
echo "version=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT
128128
129129
- name: Set module version
130130
id: module
131-
# https://stackoverflow.com/questions/58177786/get-the-current-pushed-tag-in-github-actions
132-
run: echo ::set-output name=version::$(python -c 'from importlib.metadata import version; print(version("timvt"))')
131+
run: |
132+
echo "version=$(hatch --quiet version)" >> $GITHUB_OUTPUT
133133
134134
- name: Build and publish
135-
if: steps.tag.outputs.tag == steps.module.outputs.version
135+
if: ${{ steps.tag.outputs.version }} == ${{ steps.module.outputs.version}}
136136
env:
137137
FLIT_USERNAME: ${{ secrets.PYPI_USERNAME }}
138138
FLIT_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
139-
run: flit publish
139+
run: |
140+
python -m hatch publish
140141
141142
publish-docker:
142143
needs: [tests]

CHANGES.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Release Notes
22

3-
## Next (TBD)
3+
## 0.8.0a0 (2022-11-16)
44

55
* remove `.pbf` extension in tiles endpoints
66
* add `orjson` as an optional dependency (for faster JSON encoding/decoding within the database communication)
@@ -15,6 +15,7 @@
1515
* Update dockerfiles to python3.10 and postgres14-postgis3.3
1616
* update FastAPI requirement to >0.87
1717
* remove endpoint Tags
18+
* make orjson a default requirement
1819

1920
**breaking changes**
2021

dockerfiles/Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@ FROM ghcr.io/vincentsarago/uvicorn-gunicorn:${PYTHON_VERSION}
55
WORKDIR /tmp
66

77
COPY README.md README.md
8+
COPY LICENSE LICENSE
89
COPY timvt/ timvt/
910
COPY pyproject.toml pyproject.toml
1011

1112
RUN pip install . --no-cache-dir
12-
RUN rm -rf timvt/ README.md pyproject.toml
13+
RUN rm -rf timvt/ README.md pyproject.toml LICENSE
1314

1415
ENV MODULE_NAME timvt.main
1516
ENV VARIABLE_NAME app

pyproject.toml

Lines changed: 21 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
[project]
22
name = "timvt"
33
description = "A lightweight PostGIS based dynamic vector tile server."
4-
readme = "README.md"
54
requires-python = ">=3.8"
65
license = {file = "LICENSE"}
76
authors = [
8-
{name = "Vincent Sarago", email = "[email protected]"},
7+
{name = "Vincent Sarago", email = "[email protected]"},
8+
{name = "David Bitner", email = "[email protected]"},
99
]
1010
keywords = ["FastAPI", "MVT", "POSTGIS"]
1111
classifiers = [
@@ -18,8 +18,9 @@ classifiers = [
1818
"Programming Language :: Python :: 3.11",
1919
"Topic :: Scientific/Engineering :: GIS",
2020
]
21-
dynamic = ["version"]
21+
dynamic = ["version", "readme"]
2222
dependencies = [
23+
"orjson",
2324
"asyncpg>=0.23.0",
2425
"buildpg>=0.3",
2526
"fastapi>=0.87",
@@ -31,9 +32,6 @@ dependencies = [
3132
]
3233

3334
[project.optional-dependencies]
34-
all = [
35-
"orjson",
36-
]
3735
test = [
3836
"pytest",
3937
"pytest-cov",
@@ -50,7 +48,7 @@ dev = [
5048
"pre-commit",
5149
]
5250
server = [
53-
"uvicorn[standard]>=0.12.0,<0.16.0",
51+
"uvicorn[standard]>=0.12.0,<0.19.0",
5452
]
5553
docs = [
5654
"nbconvert",
@@ -62,30 +60,29 @@ docs = [
6260
]
6361

6462
[project.urls]
63+
Homepage = "https://developmentseed.org/timvt/"
6564
Source = "https://github.com/developmentseed/timvt"
6665
Documentation = "https://developmentseed.org/timvt/"
6766

68-
[build-system]
69-
requires = ["flit>=3.2,<4"]
70-
build-backend = "flit_core.buildapi"
71-
72-
[tool.flit.module]
73-
name = "timvt"
67+
[tool.hatch.version]
68+
path = "timvt/__init__.py"
7469

75-
[tool.flit.sdist]
70+
[tool.hatch.build.targets.sdist]
7671
exclude = [
77-
"tests/",
78-
"docs/",
79-
".github/",
80-
"CHANGES.md",
81-
"CONTRIBUTING.md",
82-
"dockerfiles",
83-
"demo",
84-
".env*",
85-
"data/",
86-
"docker-compose.yml",
72+
"/tests",
73+
"/dockerfiles",
74+
"/docs",
75+
"/demo",
76+
"/data",
77+
"docker-compose.yml",
78+
"CONTRIBUTING.md",
79+
"CHANGES.md",
8780
]
8881

82+
[build-system]
83+
requires = ["hatchling"]
84+
build-backend = "hatchling.build"
85+
8986
[tool.isort]
9087
profile = "black"
9188
known_first_party = ["timvt"]

timvt/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
"""timvt."""
22

3-
__version__ = "0.7.0"
3+
__version__ = "0.8.0a0"

timvt/db.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,22 @@
22

33
from typing import Any, Optional
44

5+
import orjson
56
from buildpg import asyncpg
67

78
from timvt.dbmodel import get_table_index
89
from timvt.settings import PostgresSettings
910

1011
from fastapi import FastAPI
1112

12-
try:
13-
import orjson as json
14-
15-
except ModuleNotFoundError:
16-
import json # type: ignore
17-
1813

1914
async def con_init(conn):
2015
"""Use json for json returns."""
2116
await conn.set_type_codec(
22-
"json", encoder=json.dumps, decoder=json.loads, schema="pg_catalog"
17+
"json", encoder=orjson.dumps, decoder=orjson.loads, schema="pg_catalog"
2318
)
2419
await conn.set_type_codec(
25-
"jsonb", encoder=json.dumps, decoder=json.loads, schema="pg_catalog"
20+
"jsonb", encoder=orjson.dumps, decoder=orjson.loads, schema="pg_catalog"
2621
)
2722

2823

timvt/dbmodel.py

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"""tifeatures.dbmodel: database events."""
1+
"""timvt.dbmodel: database events."""
22

33
from typing import Any, Dict, List, Optional
44

@@ -116,21 +116,16 @@ def id_column_info(self) -> Column: # type: ignore
116116

117117
def columns(self, properties: Optional[List[str]] = None) -> List[str]:
118118
"""Return table columns optionally filtered to only include columns from properties."""
119-
cols = [c.name for c in self.properties]
120-
if properties is not None:
121-
if self.id_column and self.id_column not in properties:
122-
properties.append(self.id_column)
119+
if properties in [[], [""]]:
120+
return []
123121

124-
geom_col = self.get_geometry_column()
125-
if geom_col:
126-
properties.append(geom_col.name)
122+
cols = [
123+
c.name for c in self.properties if c.type not in ["geometry", "geography"]
124+
]
125+
if properties is None:
126+
return cols
127127

128-
cols = [col for col in cols if col in properties]
129-
130-
if len(cols) < 1:
131-
raise TypeError("No columns selected")
132-
133-
return cols
128+
return [c for c in cols if c in properties]
134129

135130
def get_column(self, property_name: str) -> Optional[Column]:
136131
"""Return column info."""

0 commit comments

Comments
 (0)