Skip to content

Commit

Permalink
Usage of Poetry (#123)
Browse files Browse the repository at this point in the history
  • Loading branch information
benoit9126 committed Dec 22, 2022
1 parent 182f243 commit 5249a23
Show file tree
Hide file tree
Showing 8 changed files with 601 additions and 61 deletions.
14 changes: 8 additions & 6 deletions .github/workflows/ci.yml
Expand Up @@ -21,22 +21,24 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: Install poetry
run: pipx install poetry

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
cache-dependency-path: 'setup.py'
cache: 'poetry'

- name: Install dependencies
run: |
pip install -U pip setuptools tox tox-py coverage
python setup.py install
poetry env use "${{ matrix.python-version }}"
poetry install
- name: Run tox targets for ${{ matrix.python-version }}
run: |
tox --py current
coverage lcov
poetry run tox -f py$(echo ${{ matrix.python-version }} | tr -d .)
poetry run coverage lcov
- name: Coveralls Parallel
uses: coverallsapp/github-action@1.1.3
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -11,6 +11,7 @@ Version 2.0.0
[#113](https://github.com/tilezen/mapbox-vector-tile/issues/113)
* Support for Python 3.11
* Delete the `round_fn` argument as Python 2 has been dropped
* Use `pyproject.toml` and Poetry to replace the `setup.py` file

Version 1.2.1
-------------
Expand Down
1 change: 0 additions & 1 deletion MANIFEST.in

This file was deleted.

9 changes: 6 additions & 3 deletions README.md
Expand Up @@ -8,7 +8,8 @@ Mapbox Vector Tile
Installation
------------

mapbox-vector-tile is compatible with Python 2.7 and 3.5. It is listed on PyPi as `mapbox-vector-tile`. The recommended way to install is via `pip`:
mapbox-vector-tile is compatible with Python 3.7 or newer. It is listed on PyPi as `mapbox-vector-tile`. The
recommended way to install is via `pip`:

```shell
pip install mapbox-vector-tile
Expand All @@ -19,7 +20,8 @@ Note that `mapbox-vector-tile` depends on [Shapely](https://pypi.python.org/pypi
Encoding
--------

Encode method expects an array of layers or atleast a single valid layer. A valid layer is a dictionary with the following keys
Encode method expects an array of layers or at least a single valid layer. A valid layer is a dictionary with the
following keys

* `name`: layer name
* `features`: an array of features. A feature is a dictionary with the following keys:
Expand Down Expand Up @@ -189,7 +191,8 @@ mapbox_vector_tile.encode([

In this example, the coordinate that would get encoded would be (2048, 2048)

Additionally, if the data is already in a cooridnate system with y values going down, the encoder supports an option, `y_coord_down`, that can be set to True. This will suppress flipping the y coordinate values during encoding.
Additionally, if the data is already in a coordinate system with y values going down, the encoder supports an
option, `y_coord_down`, that can be set to True. This will suppress flipping the y coordinate values during encoding.

### Custom extents

Expand Down
534 changes: 534 additions & 0 deletions poetry.lock

Large diffs are not rendered by default.

54 changes: 51 additions & 3 deletions pyproject.toml
@@ -1,5 +1,49 @@
[tool.distutils.bdist_wheel]
universal = true
[tool.poetry]
name = "mapbox-vector-tile"
version = "2.0.0"
description = "Mapbox Vector Tile"
license = "MIT"
authors = [
"Rob Marianski <hello@mapzen.com>",
]
repository = "https://github.com/tilezen/mapbox-vector-tile"
readme = "README.md"
exclude = [
"**/tests/**",
"**/*.wkt",
]
classifiers = [
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
]
include = [
"mapbox_vector_tile/Mapbox/*.proto",
"README.md",
"CHANGELOG.md",
]
packages = [
{ include = "mapbox_vector_tile" }
]

[build-system]
requires = ["poetry_core>=1.0.0"]
build-backend = "poetry.core.masonry.api"

[tool.poetry.dependencies]
python = "^3.7"
protobuf = "^4.21"
shapely = [
{ version = "<2", python = "<3.8" },
{ version = "*", python = ">=3.8" }
]
pyclipper = "^1.3.0"

[tool.poetry.group.test.dependencies]
tox = "^4.0.16"
coverage = { version = "^7.0.0", extras = ["toml"] }

# Black
[tool.black]
Expand All @@ -12,11 +56,15 @@ extend-exclude = '''
)/
)
'''
target-version = ["py36", "py37", "py38", "py39", "py310", "py311"]
target-version = ["py37", "py38", "py39", "py310", "py311"]

# Isort
[tool.isort]
profile = "black"
line_length = 120
force_alphabetical_sort_within_sections = true
case_sensitive = true

# Coverage
[tool.coverage.run]
omit = ["mapbox_vector_tile/Mapbox/vector_tile_pb2.py"]
47 changes: 0 additions & 47 deletions setup.py

This file was deleted.

2 changes: 1 addition & 1 deletion tox.ini
Expand Up @@ -2,7 +2,7 @@
envlist = py37,py38,py39,py310,py311

[tox:.package]
# Because of poetry
isolated_build = true
basepython = python3

[testenv]
Expand Down

0 comments on commit 5249a23

Please sign in to comment.