From 7158ae310c1902da85f710736bca60922244071b Mon Sep 17 00:00:00 2001 From: Matthieu Dartiailh Date: Wed, 30 Mar 2022 22:36:54 +0200 Subject: [PATCH] move install information to pyproject.toml --- enaml/version.py | 37 ------------------ pyproject.toml | 100 +++++++++++++++++++++++++++++++++++++++++++++++ setup.py | 91 ++---------------------------------------- 3 files changed, 103 insertions(+), 125 deletions(-) delete mode 100644 enaml/version.py create mode 100644 pyproject.toml diff --git a/enaml/version.py b/enaml/version.py deleted file mode 100644 index ab1fba1d6..000000000 --- a/enaml/version.py +++ /dev/null @@ -1,37 +0,0 @@ -#------------------------------------------------------------------------------ -# Copyright (c) 2013-2019, Nucleic Development Team. -# -# Distributed under the terms of the Modified BSD License. -# -# The full license is in the file LICENSE, distributed with this software. -#------------------------------------------------------------------------------ -""" The version information for this release of Enaml. - -""" -from collections import namedtuple - -# The major release number. Differences in the major number indicate -# possibly large differences in API. -MAJOR = 0 - -# The minor release number. Differences in the minor number indicate -# possibly small differences in the API, but these changes will come -# backwards compatibility support when possible. Minor releases are -# typically used for large feature additions. -MINOR = 14 - -# The micro release number. The micro release number is incremented -# for bug fix releases and small feature additions. -MICRO = 1 - -# The status indicate if this is a development or pre-release version -STATUS = '' - -#: A namedtuple of the version info for the current release. -version_info = namedtuple('version_info', 'major minor micro status') -version_info = version_info(MAJOR, MINOR, MICRO, STATUS) -# Remove everything but the 'version_info' from this module. -del namedtuple, MAJOR, MINOR, MICRO, STATUS - -__version__ = ('{0}.{1}.{2}'.format(*version_info) if not version_info.status - else '{0}.{1}.{2}.{3}'.format(*version_info)) diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 000000000..7641696c4 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,100 @@ +# -------------------------------------------------------------------------------------- +# Copyright (c) 2013-2022, Nucleic Development Team. +# +# Distributed under the terms of the Modified BSD License. +# +# The full license is in the file LICENSE, distributed with this software. +# -------------------------------------------------------------------------------------- + +[project] +name = "enaml" +description = "Declarative DSL for building rich user interfaces in Python" +readme = "README.rst" +requires-python = ">=3.8" +license = {file = "LICENSE"} +authors = [ + {name = "The Nucleic Development Team", email = "sccolbert@gmail.com"} +] +maintainers = [ + {name = "Matthieu C. Dartiailh", email = "m.dartiailh@gmail.com"} +] +classifiers = [ + "License :: OSI Approved :: BSD License", + "Programming Language :: Python", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: Implementation :: CPython", +] +dependencies = [ + "ply", + "atom>=0.8.0", + "kiwisolver>=1.2.0", + "bytecode>=0.13.0", +] +dynamic=["version"] + +[project.optional-dependencies] +qt5-pyqt = ["qtpy", "pyqt5"] +qt5-pyside = ["qtpy", "pyside2"] +qt6-pyqt = ["qtpy>=2.0.1", "pyqt6>=6.2"] +qt6-pyside = ["qtpy>=2.0.1", "pyside6>=6.2.3"] + +[project.urls] +homepage = "https://github.com/nucleic/enaml" +documentation = "https://enaml.readthedocs.io/en/latest/" +repository = "https://github.com/nucleic/enaml" +changelog = "https://github.com/nucleic/enaml/blob/main/releasenotes.rst" + +[project.scripts] +enaml-run = "enaml.runner:main" +enaml-compileall = "enaml.compile_all:main" + +[build-system] +requires = ["setuptools>=61.2", "wheel", "setuptools_scm[toml]>=3.4.3", "cppy>=1.2.0"] +build-backend = "setuptools.build_meta" + +[tool.setuptools] +include-package-data = false + [tools.setuptools.package-data] + "enaml.applib" = ['*.enaml'] + "enaml.stdlib" = ['*.enaml'] + "enaml.workbench.core" = ['*.enaml'] + "enaml.workbench.ui" = ['*.enaml'] + "enaml.qt.docking" = [ + 'dock_images/*.png', + 'dock_images/*.py', + 'enaml_dock_resources.qrc' + ] + +[tool.setuptools_scm] +write_to = "enaml/version.py" +write_to_template = """ +# -------------------------------------------------------------------------------------- +# Copyright (c) 2013-2022, Nucleic Development Team. +# +# Distributed under the terms of the Modified BSD License. +# +# The full license is in the file LICENSE, distributed with this software. +# -------------------------------------------------------------------------------------- +# This file is auto-generated by setuptools-scm do NOT edit it. + +from collections import namedtuple + +#: A namedtuple of the version info for the current release. +_version_info = namedtuple("_version_info", "major minor micro status") + +parts = "{version}".split(".", 3) +version_info = _version_info( + int(parts[0]), + int(parts[1]), + int(parts[2]), + parts[3] if len(parts) == 4 else "", +) + +# Remove everything but the 'version_info' from this module. +del namedtuple, _version_info, parts + +__version__ = "{version}" +""" diff --git a/setup.py b/setup.py index 2d7da95cf..219b61dc4 100755 --- a/setup.py +++ b/setup.py @@ -5,16 +5,13 @@ # # The full license is in the file LICENSE, distributed with this software. #------------------------------------------------------------------------------ -import os import sys import inspect -from setuptools import find_packages, Extension, setup -from setuptools.command.build_ext import build_ext +from setuptools import Extension, setup from setuptools.command.install import install from setuptools.command.develop import develop -sys.path.insert(0, os.path.abspath('.')) -from enaml.version import __version__ +from cppy import CppyBuildExt # Use the env var ENAML_DISABLE_FH4 to disable linking against VCRUNTIME140_1.dll @@ -78,40 +75,6 @@ ) -class BuildExt(build_ext): - """ A custom build extension for adding compiler-specific options. - - """ - c_opts = { - 'msvc': ['/EHsc'] - } - - def initialize_options(self): - build_ext.initialize_options(self) - self.debug = False - - def build_extensions(self): - - # Delayed import of cppy to let setup_requires install it if necessary - import cppy - - ct = self.compiler.compiler_type - opts = self.c_opts.get(ct, []) - for ext in self.extensions: - ext.include_dirs.insert(0, cppy.get_include()) - ext.extra_compile_args = opts - if sys.platform == 'darwin': - ext.extra_compile_args += ['-stdlib=libc++'] - ext.extra_link_args += ['-stdlib=libc++'] - if (ct == 'msvc' and os.environ.get('ENAML_DISABLE_FH4')): - # Disable FH4 Exception Handling implementation so that we don't - # require VCRUNTIME140_1.dll. For more details, see: - # https://devblogs.microsoft.com/cppblog/making-cpp-exception-handling-smaller-x64/ - # https://github.com/joerick/cibuildwheel/issues/423#issuecomment-677763904 - ext.extra_compile_args.append('/d2FH4-') - build_ext.build_extensions(self) - - class Install(install): """ Calls the parser to construct a lex and parse table specific to the system before installation. @@ -152,56 +115,8 @@ def run(self): setup( - name='enaml', - version=__version__, - author='The Nucleic Development Team', - author_email='sccolbert@gmail.com', - url='https://github.com/nucleic/enaml', - description='Declarative DSL for building rich user interfaces in Python', - long_description=open('README.rst').read(), - license='BSD', - classifiers=[ - # https://pypi.org/pypi?%3Aaction=list_classifiers - 'License :: OSI Approved :: BSD License', - 'Programming Language :: Python', - 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.8', - 'Programming Language :: Python :: 3.9', - 'Programming Language :: Python :: 3.10', - 'Programming Language :: Python :: Implementation :: CPython', - ], - python_requires='>=3.8', - requires=['atom', 'ply', 'kiwisolver'], - install_requires=['atom>=0.7.0', - 'kiwisolver>=1.2.0', - 'ply>=3.4', - "bytecode>=0.11.0" - ], - setup_requires=['cppy>=1.1.0'], - extras_require={ - "qt5-pyqt": ["qtpy", "pyqt5"], - "qt5-pyside": ["qtpy", "pyside2"], - "qt6-pyqt": ["qtpy>=2.0.1", "pyqt6>=6.2"], - "qt6-pyside": ["qtpy>=2.0.1", "pyside6>=6.2.3"] - }, - packages=find_packages(), - package_data={ - 'enaml.applib': ['*.enaml'], - 'enaml.stdlib': ['*.enaml'], - 'enaml.workbench.core': ['*.enaml'], - 'enaml.workbench.ui': ['*.enaml'], - 'enaml.qt.docking': [ - 'dock_images/*.png', - 'dock_images/*.py', - 'enaml_dock_resources.qrc' - ], - }, - entry_points={'console_scripts': [ - 'enaml-run = enaml.runner:main', - 'enaml-compileall = enaml.compile_all:main', - ]}, ext_modules=ext_modules, - cmdclass={'build_ext': BuildExt, + cmdclass={'build_ext': CppyBuildExt, 'install': Install, 'develop': Develop}, )