Skip to content

Commit

Permalink
Move to pyproject.toml and src-layout; stop writing _version.py.
Browse files Browse the repository at this point in the history
... and update warnings filters.
  • Loading branch information
anntzer committed Sep 16, 2024
1 parent 33b1a91 commit 8ae8e7f
Show file tree
Hide file tree
Showing 29 changed files with 93 additions and 106 deletions.
File renamed without changes.
2 changes: 0 additions & 2 deletions lib/hmmlearn/.gitignore

This file was deleted.

18 changes: 0 additions & 18 deletions lib/hmmlearn/__init__.py

This file was deleted.

74 changes: 74 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# Copyright (C) 2007-2009 Cournapeau David <cournape@gmail.com>
# 2010 Fabian Pedregosa <fabian.pedregosa@inria.fr>
# 2014 Gael Varoquaux
# 2014-2016 Sergei Lebedev <superbobry@gmail.com>
# 2018-2023 Antony Lee
# 2023- Matthew Danielson

[build-system]
requires = [
"setuptools>=62",
"setuptools_scm[toml]>=6.2",
"pybind11>=2.6.0",
]
build-backend = "setuptools.build_meta"

[project]
name = "hmmlearn"
description = "Hidden Markov Models in Python with scikit-learn like API"
readme = "README.rst"
authors = [
{name = "David Cournapeau"}, # 2007-2009
{name = "Fabian Pedregosa"}, # 2010
{name = "Gael Varoquaux"}, # 2014
{name = "Sergei Lebedev"}, # 2014-2016
{name = "Antony Lee"}, # 2018-2023
{name = "Matthew Danielson"}, # 2023
]
urls = {Repository = "https://github.com/hmmlearn/hmmlearn"}
classifiers = [
"Development Status :: 3 - Alpha",
"License :: OSI Approved :: BSD License",
"Intended Audience :: Developers",
"Intended Audience :: Science/Research",
"Topic :: Software Development",
"Topic :: Scientific/Engineering",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
]
requires-python = ">=3.8"
dependencies = [
"numpy>=1.10", # np.broadcast_to.
"scikit-learn>=0.16,!=0.22.0", # check_array, check_is_fitted.
"scipy>=0.19", # scipy.special.logsumexp.
]
dynamic = ["version"]

[project.optional-dependencies]
tests = [
"pytest",
]
docs = [
"matplotlib",
"pydata_sphinx_theme",
"sphinx>=2.0",
"sphinx-gallery",
]

[tool.setuptools_scm]
version_scheme = "post-release"
local_scheme = "node-and-date"
fallback_version = "0+unknown"

[tool.coverage.run]
branch = true
source_pkgs = ["hmmlearn"]

[tool.pytest.ini_options]
addopts = "--doctest-glob=src/**/*.py --doctest-glob=*.rst"
filterwarnings = [
"error",
"ignore::DeprecationWarning",
"error::DeprecationWarning:hmmlearn",
"ignore:underflow",
]
7 changes: 0 additions & 7 deletions setup.cfg

This file was deleted.

83 changes: 4 additions & 79 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,84 +1,9 @@
# Copyright (C) 2007-2009 Cournapeau David <cournape@gmail.com>
# 2010 Fabian Pedregosa <fabian.pedregosa@inria.fr>
# 2014 Gael Varoquaux
# 2014-2016 Sergei Lebedev <superbobry@gmail.com>
# 2018- Antony Lee

import os
os.environ.setdefault("SETUPTOOLS_USE_DISTUTILS", "stdlib")

import setuptools
from setuptools import Extension, find_packages, setup
from setuptools.command.build_ext import build_ext


class build_ext(build_ext):

def finalize_options(self):
from pybind11.setup_helpers import Pybind11Extension
self.distribution.ext_modules[:] = [Pybind11Extension(
"hmmlearn._hmmc", ["src/_hmmc.cpp"], cxx_std=11)]
super().finalize_options()

def build_extensions(self):
try:
self.compiler.compiler_so.remove("-Wstrict-prototypes")
except (AttributeError, ValueError):
pass
super().build_extensions()
from pybind11.setup_helpers import Pybind11Extension
from setuptools import setup


setup(
name="hmmlearn",
description="Hidden Markov Models in Python with scikit-learn like API",
long_description=open("README.rst", encoding="utf-8").read(),
long_description_content_type="text/x-rst",
maintainer="Antony Lee",
url="https://github.com/hmmlearn/hmmlearn",
license="new BSD",
classifiers=[
"Development Status :: 3 - Alpha",
"License :: OSI Approved",
"Intended Audience :: Developers",
"Intended Audience :: Science/Research",
"Topic :: Software Development",
"Topic :: Scientific/Engineering",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
],
cmdclass={"build_ext": build_ext},
py_modules=[],
packages=find_packages("lib"),
package_dir={"": "lib"},
ext_modules=[Extension("", [])],
package_data={},
python_requires=">=3.8",
setup_requires=[
"pybind11>=2.6",
"setuptools_scm>=3.3", # fallback_version.
],
use_scm_version=lambda: { # xref __init__.py
"version_scheme": "post-release",
"local_scheme": "node-and-date",
"write_to": "lib/hmmlearn/_version.py",
"fallback_version": "0+unknown",
},
install_requires=[
"numpy>=1.10", # np.broadcast_to.
"scikit-learn>=0.16,!=0.22.0", # check_array, check_is_fitted.
"scipy>=0.19", # scipy.special.logsumexp.
ext_modules=[
Pybind11Extension("hmmlearn._hmmc", ["ext/_hmmc.cpp"], cxx_std=11),
],
extras_require={
"tests": ["pytest"],
"docs": [
"matplotlib",
"pydata_sphinx_theme",
"sphinx>=2.0",
"sphinx-gallery",
],
},
entry_points={
"console_scripts": [],
"gui_scripts": [],
},
)
15 changes: 15 additions & 0 deletions src/hmmlearn/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
"""
hmmlearn
========
``hmmlearn`` is a set of algorithms for learning and inference of
Hidden Markov Models.
"""

import importlib.metadata


try:
__version__ = importlib.metadata.version("hmmlearn")
except ImportError:
__version__ = "0+unknown"
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 8ae8e7f

Please sign in to comment.