Skip to content

Commit

Permalink
Update build system and switch to pyproject.toml
Browse files Browse the repository at this point in the history
  • Loading branch information
mwcraig committed Aug 21, 2023
1 parent b38fdea commit a7b9026
Show file tree
Hide file tree
Showing 4 changed files with 109 additions and 119 deletions.
9 changes: 0 additions & 9 deletions MANIFEST.in

This file was deleted.

109 changes: 107 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,108 @@
[build-system]
requires = ["jupyter_packaging~=0.7.0", "jupyterlab==3.*", "setuptools>=40.8.0", "wheel"]
build-backend = "setuptools.build_meta"
requires = [
"hatchling",
"jupyterlab==3.*",
]
build-backend = "hatchling.build"

[project]
name = "ipyevents"
description = "A custom widget for returning mouse and keyboard events to Python"
readme = "README.md"
license = {text = "BSD 3-clause"}
lincense_files = ["LICENSE.md"]
requires-python = ">=3.6"
authors = [
{ name = "Matt Craig", email = "[email protected]" },
]
keywords = [
"IPython",
"Jupyter",
"Widgets",
]
classifiers = [
"Framework :: Jupyter",
"Intended Audience :: Developers",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: BSD License",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
]
dependencies = [
"ipywidgets>=7.6.0",
]
version = "2.0.1"

[project.optional-dependencies]
docs = [
"jupyterlab>=3",
"nbsphinx",
"sphinx",
]
test = [
"nbval",
"pytest",
"pytest-cov",
]

[project.urls]
Homepage = "https://github.com/mwcraig/ipyevents"

[tool.hatch.build]
artifacts = [
"ipyevents/nbextension/",
"ipyevents/labextension/",
]

[tool.hatch.build.targets.wheel.shared-data]
"ipyevents/nbextension/static/*.js*" = "share/jupyter/nbextensions/ipyevents/*.js*"
"ipyevents/labextension" = "share/jupyter/labextensions/ipyevents"
"./ipyevents.json" = "etc/jupyter/nbconfig/notebook.d/ipyevents.json"

[tool.hatch.build.targets.sdist]
exclude = [
".github",
]

[tool.hatch.build.hooks.jupyter-builder]
ensured-targets = [
"ipyevents/nbextension/static/index.js",
"ipyevents/labextension/package.json",
]
dependencies = [
"hatch-jupyter-builder>=0.8.3",
]
build-function = "hatch_jupyter_builder.npm_builder"

[tool.hatch.build.hooks.jupyter-builder.build-kwargs]
path = "."
build_cmd = "build"

[tool.tbump]
field = [
{ name = "channel", default = "" },
{ name = "release", default = "" },
]

[tool.tbump.version]
current = "2.0.1"
regex = "(?P<major>\\d+)\\.(?P<minor>\\d+)\\.(?P<patch>\\d+)((?P<channel>a|b|rc|.dev)(?P<release>\\d+))?"

[tool.tbump.git]
message_template = "Bump to {new_version}"
tag_template = "v{new_version}"

[[tool.tbump.file]]
src = "pyproject.toml"
version_template = "version = \"{major}.{minor}.{patch}{channel}{release}\""

[[tool.tbump.file]]
src = "ipyevents/_version.py"

[[tool.tbump.file]]
src = "package.json"
version_template = "\"version\": \"{major}.{minor}.{patch}{channel}{release}\""
6 changes: 0 additions & 6 deletions setup.cfg

This file was deleted.

104 changes: 2 additions & 102 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,102 +1,2 @@
from os import path

from jupyter_packaging import (
create_cmdclass, install_npm, ensure_targets,
combine_commands,
get_version, skip_if_exists
)

from setuptools import setup, find_packages

LONG_DESCRIPTION = 'A custom widget for returning mouse and keyboard events to Python'

HERE = path.dirname(path.abspath(__file__))

# The name of the project
name = 'ipyevents'

# Get our version
version = get_version(path.join(name, '_version.py'))

nb_path = path.join(HERE, name, 'nbextension', 'static')
lab_path = path.join(HERE, name, 'labextension')

# Representative files that should exist after a successful build
jstargets = [
path.join(nb_path, 'index.js'),
path.join(lab_path, 'package.json'),
]

package_data_spec = {
name: [
'nbextension/static/*.*js*',
'labextension/**'
]
}

data_files_spec = [
('share/jupyter/nbextensions/ipyevents',
nb_path, '*.js*'),
('share/jupyter/labextensions/ipyevents', lab_path, '**'),
('etc/jupyter/nbconfig/notebook.d', HERE, 'ipyevents.json')
]


cmdclass = create_cmdclass('jsdeps', package_data_spec=package_data_spec,
data_files_spec=data_files_spec)
js_command = combine_commands(
install_npm(HERE, build_cmd='build'),
ensure_targets(jstargets),
)

is_repo = path.exists(path.join(HERE, '.git'))
if is_repo:
cmdclass['jsdeps'] = js_command
else:
cmdclass['jsdeps'] = skip_if_exists(jstargets, js_command)

setup_args = dict(
name = name,
description = 'A custom widget for returning mouse and keyboard events to Python',
version = version,
cmdclass = cmdclass,
packages = find_packages(),
author = 'Matt Craig',
author_email = '[email protected]',
url = 'https://github.com/mwcraig/ipyevents',
license = 'BSD 3-clause',
platforms = "Linux, Mac OS X, Windows",
keywords = ['Jupyter', 'Widgets', 'IPython'],
classifiers = [
'Intended Audience :: Developers',
'Intended Audience :: Science/Research',
'License :: OSI Approved :: BSD License',
'Programming Language :: Python',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Framework :: Jupyter',
],
include_package_data = True,
python_requires = '>=3.6',
install_requires = [
'ipywidgets>=7.6.0',
],
extras_require = {
'test': [
'pytest',
'pytest-cov',
'nbval',
],
'docs': [
'sphinx',
'nbsphinx',
'jupyterlab>=3'
],
},
)

if __name__ == "__main__":
setup(**setup_args)
# setup.py shim for use with applications that require it.
__import__("setuptools").setup()

0 comments on commit a7b9026

Please sign in to comment.