Skip to content
Open
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
37 changes: 33 additions & 4 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 8 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
[build-system]
requires = ["setuptools>=42", "wheel"]
build-backend = "setuptools.build_meta"

[tool.poetry]
name = "pick"
version = "2.5.0"
Expand All @@ -10,14 +14,12 @@ homepage = "https://github.com/aisk/pick"
keywords = ["terminal", "gui"]

[tool.poetry.dependencies]
python = ">=3.8"
windows-curses = {version = "^2.2.0", platform = "win32"}
python = "^3.8"
windows-curses = {version = "^2.2.0", markers = "platform_system == 'Windows'"}

[tool.poetry.dev-dependencies]
pytest = "^8.3.5"
mypy = "^1.4"
pre-commit = "^3.5.0"

[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
setuptools = "^73.0.0"
types-setuptools = "^73.0.0"
37 changes: 37 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import sysconfig
from setuptools import setup, find_packages

install_requires = []

if not sysconfig.get_platform().startswith("mingw"):
install_requires.append('windows-curses>=2.2.0,<3.0.0; platform_system == "Windows"')

setup(
name='pick',
version='2.5.0',
packages=find_packages(where='src'),
package_dir={'': 'src'},
install_requires=install_requires,
description="Pick an option in the terminal with a simple GUI",
author="wong2",
author_email="wonderfuly@gmail.com",
license="MIT",
url="https://github.com/aisk/pick",
keywords=["terminal", "gui"],
classifiers=[
"Development Status :: 5 - Production/Stable",
"Environment :: Console",
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"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 :: 3.11",
"Programming Language :: Python :: 3.12",
"Topic :: Software Development :: Libraries :: Python Modules",
"Topic :: Terminals"
],
)
25 changes: 24 additions & 1 deletion src/pick/__init__.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,32 @@
import curses
import os
import sys
import textwrap
from collections import namedtuple
from dataclasses import dataclass, field
from typing import Any, Container, Generic, Iterable, List, Optional, Sequence, Tuple, TypeVar, Union

# Handle curses import for different environments
if sys.platform == "win32":
# Check if we're in an MSYS2 environment
if "MSYSTEM" in os.environ:
# MSYS2 has built-in curses support
import curses
else:
# Native Windows requires windows-curses
try:
import curses
except ImportError:
try:
import windows_curses as curses
except ImportError:
raise ImportError(
"On native Windows, the 'windows-curses' package is required. "
"Please install it using: pip install windows-curses"
)
else:
# Non-Windows systems have built-in curses
import curses

__all__ = ["Picker", "pick", "Option"]


Expand Down