Skip to content

Commit

Permalink
Merge pull request #31 from filip-komarzyniec/30_switch_to_pyproject_…
Browse files Browse the repository at this point in the history
…toml

Introduce pyproject toml file
  • Loading branch information
mthh authored Jun 3, 2024
2 parents ffe6016 + 8352164 commit 1fdc950
Show file tree
Hide file tree
Showing 6 changed files with 61 additions and 56 deletions.
8 changes: 1 addition & 7 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,7 +1 @@
# C/cython source files
include jenkspy/src/*

include README.md
include LICENSE
include tests/*.*
include requirements.txt
graft tests
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Compute "natural breaks" (*Fisher-Jenks algorithm*) on list / tuple / array / nu

The algorithm implemented by this library is also sometimes referred to as *Fisher-Jenks algorithm*, *Jenks Optimisation Method* or *Fisher exact optimization method*. This is a deterministic method to calculate the optimal class boundaries.

Intended compatibility: CPython 3.6+
Intended compatibility: CPython 3.7+

Wheels are provided via PyPI for Windows / MacOS / Linux users - Also available on conda-forge channel for Anaconda users.

Expand Down Expand Up @@ -86,7 +86,7 @@ pip install jenkspy
```shell
git clone http://github.com/mthh/jenkspy
cd jenkspy/
python setup.py install
pip install .
```

- **For anaconda users**
Expand Down
2 changes: 1 addition & 1 deletion jenkspy/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__version__ = "0.4.0"
__version__ = "0.4.1"

from .core import jenks_breaks
from .core import _jenks_matrices
Expand Down
54 changes: 54 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
[build-system]
requires = ["setuptools >= 61.0", "Cython"]
build-backend = "setuptools.build_meta"

[project]
name = 'jenkspy'
dynamic = ["version"]
dependencies = [
"numpy"
]
requires-python = ">= 3.7"
authors = [
{name = "Matthieu Viry", email = "matthieu.viry@cnrs.fr"},
]
maintainers = [
{name = "Matthieu Viry", email = "matthieu.viry@cnrs.fr"},
]
description = "Compute Natural Breaks (Fisher-Jenks algorithm)"
readme = "README.md"
license = {file = "LICENSE"}

classifiers = [
"Programming Language :: Python",
"Development Status :: 5 - Production/Stable",
"Operating System :: OS Independent",
"License :: OSI Approved :: MIT License",
"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",
"Programming Language :: Python :: 3.12",
"Topic :: Scientific/Engineering",
"Typing :: Typed",
]


[project.urls]
Homepage = "https://github.com/mthh/jenkspy"
Repository = "https://github.com/mthh/jenkspy.git"
Issues = "https://github.com/mthh/jenkspy/issues"
Changelog = "https://github.com/mthh/jenkspy/blob/master/CHANGES.rst"

[tool.setuptools]
packages = ["jenkspy"]
include-package-data = false


[tool.setuptools.package-data]
jenkspy = ["src/*"]

[tool.setuptools.dynamic]
version = {attr = "jenkspy.__version__"}
readme = {file = "README.md", content-type = "text/x-rst"}
1 change: 0 additions & 1 deletion requirements.txt

This file was deleted.

48 changes: 3 additions & 45 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,61 +1,19 @@
# -*- coding: utf-8 -*-
from distutils.core import setup
from distutils.extension import Extension
from ast import parse
from os import path

from Cython.Distutils import build_ext
from Cython.Build import cythonize

ext = '.pyx'
from Cython.Distutils import build_ext

exts = [
Extension(
"jenkspy.jenks",
["jenkspy/src/jenks" + ext],
["jenkspy/src/jenks.pyx"],
["jenkspy"],
)
]

with open(path.join('jenkspy', '__init__.py')) as f:
__version__ = parse(next(filter(lambda line: line.startswith('__version__'),
f))).body[0].value.s

with open('README.md') as f:
long_desc = f.read()

with open('requirements.txt') as f:
requirements = f.read().splitlines()

setup(
name='jenkspy',
version=__version__,
license="MIT",
ext_modules=cythonize(exts),
cmdclass={'build_ext': build_ext},
packages=["jenkspy"],
include_package_data=True,
description="Compute Natural Breaks (Fisher-Jenks algorithm)",
long_description=long_desc,
long_description_content_type='text/x-rst',
install_requires=requirements,
test_suite="tests",
author="Matthieu Viry",
author_email="matthieu.viry@cnrs.fr",
url='https://github.com/mthh/jenkspy',
classifiers=[
"Programming Language :: Python",
"Development Status :: 5 - Production/Stable",
"Operating System :: OS Independent",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3.6",
"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",
"Programming Language :: Python :: 3.12",
"Topic :: Scientific/Engineering",
"Typing :: Typed",
],
cmdclass={'build_ext': build_ext}
)

0 comments on commit 1fdc950

Please sign in to comment.