Skip to content

Add [project] configuration to pyproject.toml #1364

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Nov 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions plugins/ext_test/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ def clean_all(context):
def sdist(context):
"""Create a source distribution"""
with context.cd(TASK_ROOT_STR):
context.run('python setup.py sdist')
context.run('python -m build --sdist')


namespace.add_task(sdist)
Expand All @@ -167,7 +167,7 @@ def sdist(context):
def wheel(context):
"""Build a wheel distribution"""
with context.cd(TASK_ROOT_STR):
context.run('python setup.py bdist_wheel')
context.run('python -m build --wheel')


namespace.add_task(wheel)
Expand Down
4 changes: 2 additions & 2 deletions plugins/template/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ def clean_all(context):
@invoke.task(pre=[clean_all])
def sdist(context):
"""Create a source distribution"""
context.run('python setup.py sdist')
context.run('python -m build --sdist')


namespace.add_task(sdist)
Expand All @@ -179,7 +179,7 @@ def sdist(context):
@invoke.task(pre=[clean_all])
def wheel(context):
"""Build a wheel distribution"""
context.run('python setup.py bdist_wheel')
context.run('python -m build --wheel')


namespace.add_task(wheel)
Expand Down
82 changes: 82 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,86 @@
requires = ["build", "setuptools>=64", "setuptools-scm>=8"]
build-backend = "setuptools.build_meta"

[project]
name = "cmd2"
dynamic = ["version"]
description = "cmd2 - quickly build feature-rich and user-friendly interactive command line applications in Python"
authors = [{ name = "cmd2 Contributors" }]
readme = "README.md"
requires-python = ">=3.8"
keywords = [
"CLI",
"cmd",
"command",
"interactive",
"prompt",
"Python",
]
license = { file = "LICENSE" }
classifiers = [
"Development Status :: 5 - Production/Stable",
"Environment :: Console",
"Operating System :: OS Independent",
"Intended Audience :: Developers",
"Intended Audience :: System Administrators",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Topic :: Software Development :: Libraries :: Python Modules",
]
dependencies = [
"gnureadline; platform_system == 'Darwin'",
"pyperclip",
"pyreadline3; platform_system == 'Windows'",
"wcwidth",
]

[project.optional-dependencies]
build = [
"build",
"setuptools",
"setuptools-scm",
]
dev = [
"codecov",
"doc8",
"invoke",
"mypy",
"nox",
"pytest",
"pytest-cov",
"pytest-mock",
"sphinx",
"sphinx-rtd-theme",
"sphinx-autobuild",
"ruff",
"twine",
]
docs = [
"setuptools",
"setuptools_scm",
"sphinx",
"sphinx-rtd-theme",
"sphinx-autobuild",
]
test = [
"codecov",
"coverage",
"pytest",
"pytest-cov",
"pytest-mock",
]
validate = [
"mypy",
"ruff",
"types-setuptools",
]

[tool.doc8]
ignore-path = [
"__pycache__",
Expand Down Expand Up @@ -232,3 +312,5 @@ docstring-code-format = false
# This only has an effect when the `docstring-code-format` setting is
# enabled.
docstring-code-line-length = "dynamic"

[tool.setuptools_scm]
4 changes: 2 additions & 2 deletions tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ def validatetag(context):
def sdist(context):
"""Create a source distribution"""
with context.cd(TASK_ROOT_STR):
context.run('python setup.py sdist')
context.run('python -m build --sdist')


namespace.add_task(sdist)
Expand All @@ -319,7 +319,7 @@ def sdist(context):
def wheel(context):
"""Build a wheel distribution"""
with context.cd(TASK_ROOT_STR):
context.run('python setup.py bdist_wheel')
context.run('python -m build --wheel')


namespace.add_task(wheel)
Expand Down
4 changes: 2 additions & 2 deletions tests/test_completion.py
Original file line number Diff line number Diff line change
Expand Up @@ -484,14 +484,14 @@ def test_path_completion_no_text(cmd2_app):

def test_path_completion_no_path(cmd2_app):
# Run path complete with search text that isn't preceded by a path. This should use CWD as the path.
text = 's'
text = 'p'
line = 'shell ls {}'.format(text)
endidx = len(line)
begidx = endidx - len(text)
completions_no_text = cmd2_app.path_complete(text, line, begidx, endidx)

# Run path complete with path set to the CWD
text = os.getcwd() + os.path.sep + 's'
text = os.getcwd() + os.path.sep + text
line = 'shell ls {}'.format(text)
endidx = len(line)
begidx = endidx - len(text)
Expand Down
8 changes: 1 addition & 7 deletions tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,15 +289,9 @@ def pr_none():
def test_proc_reader_send_sigint(pr_none):
assert pr_none._proc.poll() is None
pr_none.send_sigint()

wait_start = time.monotonic()
pr_none.wait()
wait_finish = time.monotonic()

# Make sure the process exited before sleep of 5 seconds finished
# 3 seconds accounts for some delay but is long enough for the process to exit
assert wait_finish - wait_start < 3

# Mac sure a SIGINT killed the process
ret_code = pr_none._proc.poll()
if sys.platform.startswith('win'):
assert ret_code is not None
Expand Down
Loading