Skip to content

Commit

Permalink
Add setup script for PyPi distribution.
Browse files Browse the repository at this point in the history
  • Loading branch information
muety committed Nov 2, 2019
1 parent e23cdeb commit 54efaa2
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 17 deletions.
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.7.4
13 changes: 11 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,19 @@ For more details on the concept, please refer to the [original article](https://
This library requires **Python 3.6** or higher. To compile it by yourself, Cython is required in addition.

### Using Pip
`pip3 install pyquadkey2`
* `pip3 install pyquadkey2`

Currently, there are pre-built `linux_x86_64` for Python 3.6, 3.7 and 3.8. If you're on a Linux system, you can simply use pip without any additional requirements.
On other systems, you might need to install Cython first (`pip3 install cython`). If you encounter problems while installing, please report them as a new issue.

### From Source
TODO
* `git clone https://github.com/n1try/pyquadkey2`
* `pip3 install cython`
* `cd pyquadkey2/quadkey/tilesystem && python3 setup.py build_ext --inplace && ../../`
* `pip3 install .`

### Troubleshooting
* `ImportError: cannot import name 'tilesystem'`: Simply try `pip3 install --upgrade pyquadkey2` once again. Second time usually works, as required build extensions are installed then. This is a known issue and will be fixed in the future.

## License
Apache 2.0
Expand Down
13 changes: 11 additions & 2 deletions docs/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,16 @@
This library requires **Python 3.6** or higher. To compile it by yourself, Cython is required in addition.

## Using Pip
`pip3 install pyquadkey2`
* `pip3 install pyquadkey2`

Currently, there are pre-built `linux_x86_64` for Python 3.6, 3.7 and 3.8. If you're on a Linux system, you can simply use pip without any additional requirements.
On other systems, you might need to install Cython first (`pip3 install cython`). If you encounter problems while installing, please report them as a new issue.

## From Source
TODO
* `git clone https://github.com/n1try/pyquadkey2`
* `pip3 install cython`
* `cd pyquadkey2/quadkey/tilesystem && python3 setup.py build_ext --inplace && ../../`
* `pip3 install .`

## Troubleshooting
* `ImportError: cannot import name 'tilesystem'`: Simply try `pip3 install --upgrade pyquadkey2` once again. Second time usually works, as required build extensions are installed then. This is a known issue and will be fixed in the future.
46 changes: 33 additions & 13 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,39 @@
#!/usr/bin/env python
# https://packaging.python.org/tutorials/packaging-projects/
import os

from setuptools import setup, find_packages
from setuptools.glob import glob

try:
from Cython.Distutils.extension import Extension
from Cython.Build import build_ext
except ImportError:
from setuptools import Extension

USING_CYTHON = False
else:
USING_CYTHON = True

ext = 'pyx' if USING_CYTHON else 'c'
sources = glob('quadkey/tilesystem/*.%s' % (ext,))
extensions = [Extension(source.split('.')[0].replace(os.path.sep, '.'), sources=[source]) for source in sources]
cmdclass = {'build_ext': build_ext} if USING_CYTHON else {}

setup(
name='pyquadkey2',
version='0.1.0',
description='Python implementation of geographical tiling using QuadKeys as proposed by Microsoft',
author='Ferdinand Mütsch',
author_email='[email protected]',
url='https://github.com/n1try/pyquadkey2',
packages=find_packages(),
install_requires=['Cython>=0.29.12'],
project_urls={
'Bug Tracker': 'https://github.com/n1try/pyquadkey2/issues',
'Source Code': 'https://github.com/n1try/pyquadkey2',
},
keywords='tiling quadkey quadtile geospatial geohash'
name='pyquadkey2',
version='0.1.0',
description='Python implementation of geographical tiling using QuadKeys as proposed by Microsoft',
author='Ferdinand Mütsch',
author_email='[email protected]',
url='https://github.com/n1try/pyquadkey2',
packages=find_packages(),
project_urls={
'Bug Tracker': 'https://github.com/n1try/pyquadkey2/issues',
'Source Code': 'https://github.com/n1try/pyquadkey2',
},
keywords='tiling quadkey quadtile geospatial geohash',
python_requires='>=3.6',
ext_modules=extensions,
cmdclass=cmdclass
)

0 comments on commit 54efaa2

Please sign in to comment.