Skip to content

Commit

Permalink
pyproject.toml (project.entrypoints, project.scripts): Define here (#…
Browse files Browse the repository at this point in the history
…14340)

... instead of in setup.py, setupbase.py

Another step toward removing setup.py, as requested by @Carreau in
#14327 (review)
  • Loading branch information
Carreau committed Feb 19, 2024
2 parents e60c06a + 64b1f85 commit 5f84fde
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 31 deletions.
11 changes: 10 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,16 @@ dependencies = [
"traitlets>=5",
"typing_extensions; python_version<'3.10'",
]
dynamic = ["authors", "entry-points", "license", "scripts", "version"]
dynamic = ["authors", "license", "version"]

[project.entry-points."pygments.lexers"]
ipythonconsole = "IPython.lib.lexers:IPythonConsoleLexer"
ipython = "IPython.lib.lexers:IPythonLexer"
ipython3 = "IPython.lib.lexers:IPython3Lexer"

[project.scripts]
ipython = "IPython:start_ipython"
ipython3 = "IPython:start_ipython"

[project.readme]
file = "long_description.rst"
Expand Down
11 changes: 1 addition & 10 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@

# Our own imports

from setupbase import target_update, find_entry_points
from setupbase import target_update

from setupbase import (
setup_args,
Expand Down Expand Up @@ -133,15 +133,6 @@
'sdist' : git_prebuild('IPython', sdist),
}

setup_args["entry_points"] = {
"console_scripts": find_entry_points(),
"pygments.lexers": [
"ipythonconsole = IPython.lib.lexers:IPythonConsoleLexer",
"ipython = IPython.lib.lexers:IPythonLexer",
"ipython3 = IPython.lib.lexers:IPython3Lexer",
],
}

#---------------------------------------------------------------------------
# Do the actual setup now
#---------------------------------------------------------------------------
Expand Down
20 changes: 0 additions & 20 deletions setupbase.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,26 +161,6 @@ def target_update(target,deps,cmd):
if target_outdated(target,deps):
os.system(cmd)

#---------------------------------------------------------------------------
# Find scripts
#---------------------------------------------------------------------------

def find_entry_points():
"""Defines the command line entry points for IPython
This always uses setuptools-style entry points. When setuptools is not in
use, our own build_scripts_entrypt class below parses these and builds
command line scripts.
Each of our entry points gets a plain name, e.g. ipython, and a name
suffixed with the Python major version number, e.g. ipython3.
"""
ep = [
'ipython%s = IPython:start_ipython',
]
major_suffix = str(sys.version_info[0])
return [e % "" for e in ep] + [e % major_suffix for e in ep]

#---------------------------------------------------------------------------
# VCS related
#---------------------------------------------------------------------------
Expand Down

0 comments on commit 5f84fde

Please sign in to comment.