diff --git a/MANIFEST.in b/MANIFEST.in index c28ab72..1ea1a47 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,2 +1,3 @@ include README.md include LICENSE.md +include float_raster/VERSION diff --git a/float_raster/VERSION b/float_raster/VERSION new file mode 100644 index 0000000..bd73f47 --- /dev/null +++ b/float_raster/VERSION @@ -0,0 +1 @@ +0.4 diff --git a/float_raster/__init__.py b/float_raster/__init__.py new file mode 100644 index 0000000..1d96371 --- /dev/null +++ b/float_raster/__init__.py @@ -0,0 +1,16 @@ +""" +Module for rasterizing polygons, with float-precision anti-aliasing on + a non-uniform rectangular grid. + +See the documentation for float_raster.raster(...) for details. +""" + +import pathlib + +from .float_raster import * + +__author__ = 'Jan Petykiewicz' + +with open(pathlib.Path(__file__).parent / 'VERSION', 'r') as f: + __version__ = f.read().strip() + diff --git a/float_raster.py b/float_raster/float_raster.py similarity index 98% rename from float_raster.py rename to float_raster/float_raster.py index fed9bc1..e43d234 100644 --- a/float_raster.py +++ b/float_raster/float_raster.py @@ -1,19 +1,8 @@ -""" -Module for rasterizing polygons, with float-precision anti-aliasing on - a non-uniform rectangular grid. - -See the documentation for raster(...) for details. -""" - from typing import Tuple import numpy from numpy import logical_and, diff, floor, ceil, ones, zeros, hstack, full_like, newaxis from scipy import sparse -__author__ = 'Jan Petykiewicz' - -version = '0.4' - def raster(vertices: numpy.ndarray, grid_x: numpy.ndarray, diff --git a/setup.py b/setup.py index b9f163d..08a7ed9 100644 --- a/setup.py +++ b/setup.py @@ -1,20 +1,25 @@ #!/usr/bin/env python3 -from setuptools import setup -import float_raster +from setuptools import setup, find_packages with open('README.md', 'r') as f: long_description = f.read() +with open('float_raster/VERSION', 'r') as f: + version = f.read().strip() + setup(name='float_raster', - version=float_raster.version, + version=version, description='High-precision anti-aliasing polygon rasterizer', long_description=long_description, long_description_content_type='text/markdown', author='Jan Petykiewicz', author_email='anewusername@gmail.com', url='https://mpxd.net/code/jan/float_raster', - py_modules=['float_raster'], + packages=find_packages(), + package_data={ + 'float_raster': ['VERSION'] + }, install_requires=[ 'numpy', 'scipy',