Skip to content

Commit

Permalink
Use pyproject.toml for project configuration (#38)
Browse files Browse the repository at this point in the history
This PR:

- Moves project configuration to `pyproject.toml`. One motivation for
this was that `cibuildwheel` was picking up the wrong Python versions,
and the recommended way to fix this is to have a `requires-python`
setting in our `pyproject.toml`.
- Removes `ibm2ieee.version` and `ibm2ieee.__version__`, whose presence
complicates the versioning and release process.
  • Loading branch information
mdickinson authored Mar 31, 2023
1 parent 8cfcd9b commit 1c3d024
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 102 deletions.
11 changes: 11 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
Changelog for ibm2ieee
======================

Release 1.3.1
-------------

Release date: 2023-03-31

This bugfix release fixes the wheel building configuration. In the process,
we also:

- Move most of the package configuration to `pyproject.toml`
- Drop the `ibm2ieee.version` module and the `ibm2ieee.__version__` attribute.

Release 1.3.0
-------------

Expand Down
2 changes: 0 additions & 2 deletions ibm2ieee/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,8 @@
# Thanks for using Enthought open source!

from ._ibm2ieee import ibm2float32, ibm2float64
from .version import version as __version__

__all__ = [
"__version__",
"ibm2float32",
"ibm2float64",
]
1 change: 0 additions & 1 deletion ibm2ieee/test/test_ibm2ieee.py
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,6 @@ def test_import_star(self):
exec("from ibm2ieee import *", locals, locals)
self.assertIn("ibm2float32", locals)
self.assertIn("ibm2float64", locals)
self.assertIn("__version__", locals)

def test_np_info(self):
output = io.StringIO()
Expand Down
31 changes: 0 additions & 31 deletions ibm2ieee/test/test_version.py

This file was deleted.

12 changes: 0 additions & 12 deletions ibm2ieee/version.py

This file was deleted.

26 changes: 26 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,32 @@
requires = ['oldest-supported-numpy', 'setuptools', 'wheel']
build-backend = 'setuptools.build_meta'

[project]
name = 'ibm2ieee'
version = '1.3.1'
description = 'Convert IBM hexadecimal floating-point to IEEE 754 floating-point'
readme = 'README.rst'
requires-python = ">=3.7"
license = {file = 'LICENSE.txt'}
authors = [{name = 'Enthought', email = '[email protected]'}]
keywords = ['ibm', 'hfp', 'ieee754', 'hexadecimal', 'floating-point', 'ufunc']
classifiers=[
'Development Status :: 5 - Production/Stable',
'Intended Audience :: Developers',
'License :: OSI Approved :: BSD License',
'Operating System :: OS Independent',
'Programming Language :: Python :: 3',
]
dependencies = ['numpy']

[project.urls]
readme = 'https://github.com/enthought/ibm2ieee/blob/main/README.rst'
repository = 'https://github.com/enthought/ibm2ieee'
issues = 'https://github.com/enthought/ibm2ieee/issues'

[tool.setuptools.packages.find]
include = ['ibm2ieee*']

[tool.black]
line-length = 79
target-version = ['py36']
Expand Down
65 changes: 9 additions & 56 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,63 +8,16 @@
#
# Thanks for using Enthought open source!

import os

import numpy
import setuptools


def get_version_info():
"""Extract version information as a dictionary from version.py."""
version_info = {}
version_filename = os.path.join("ibm2ieee", "version.py")
with open(version_filename, "r", encoding="utf-8") as version_module:
version_code = compile(version_module.read(), "version.py", "exec")
exec(version_code, version_info)
return version_info


def get_long_description():
"""Read long description from README.txt."""
with open("README.rst", "r", encoding="utf-8") as readme:
return readme.read()


ibm2ieee_extension = setuptools.Extension(
name="ibm2ieee._ibm2ieee",
sources=["ibm2ieee/_ibm2ieee.c"],
define_macros=[("NPY_NO_DEPRECATED_API", "NPY_1_7_API_VERSION")],
include_dirs=[numpy.get_include()],
setuptools.setup(
ext_modules=[
setuptools.Extension(
name="ibm2ieee._ibm2ieee",
sources=["ibm2ieee/_ibm2ieee.c"],
define_macros=[("NPY_NO_DEPRECATED_API", "NPY_1_7_API_VERSION")],
include_dirs=[numpy.get_include()],
)
],
)

SHORT_DESCRIPTION = """\
Convert IBM hexadecimal floating-point data to IEEE 754 floating-point data.
""".rstrip()


if __name__ == "__main__":
setuptools.setup(
name="ibm2ieee",
version=get_version_info()["version"],
author="Enthought",
author_email="[email protected]",
url="https://github.com/enthought/ibm2ieee",
description=SHORT_DESCRIPTION,
long_description=get_long_description(),
long_description_content_type="text/x-rst",
keywords="ibm hfp ieee754 hexadecimal floating-point ufunc",
install_requires=["numpy"],
extras_require={
"test": ["setuptools"],
},
python_requires=">=3.7",
packages=setuptools.find_packages(),
ext_modules=[ibm2ieee_extension],
classifiers=[
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"License :: OSI Approved :: BSD License",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3",
],
)

0 comments on commit 1c3d024

Please sign in to comment.