From 5ccf512a6451944ac84b1ad6cd6214dfd0720975 Mon Sep 17 00:00:00 2001 From: Winston Chang Date: Fri, 14 Mar 2025 15:18:40 -0500 Subject: [PATCH 1/2] Switch to pyproject.toml --- Makefile | 3 +- pyproject.toml | 78 +++++++++++++++++++++++++++++++++++++++++++++++ setup.cfg | 82 -------------------------------------------------- setup.py | 3 -- 4 files changed, 79 insertions(+), 87 deletions(-) create mode 100644 pyproject.toml delete mode 100644 setup.cfg delete mode 100644 setup.py diff --git a/Makefile b/Makefile index cdc2479..3514f3c 100644 --- a/Makefile +++ b/Makefile @@ -76,8 +76,7 @@ release: dist ## package and upload a release twine upload dist/* dist: clean ## builds source and wheel package - python3 setup.py sdist - python3 setup.py bdist_wheel + python -m build ls -l dist ## install the package to the active Python's site-packages diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..9331d35 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,78 @@ +[build-system] +requires = ["setuptools>=42", "wheel", "build"] +build-backend = "setuptools.build_meta" + +[project] +name = "shinylive" +dynamic = ["version"] +authors = [ + {name = "Winston Chang", email = "winston@posit.co"}, +] +description = "Run Shiny applications running Python in the browser." +readme = "README.md" +license = {text = "MIT"} +requires-python = ">=3.8" +classifiers = [ + "Development Status :: 2 - Pre-Alpha", + "Intended Audience :: Developers", + "License :: OSI Approved :: MIT License", + "Natural Language :: English", + "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", +] +dependencies = [ + "shiny", + "click>=8.1.7", + "appdirs>=1.4.4", + "lzstring>=1.0.4", + "typing-extensions>=4.0.1", + "setuptools; python_version>='3.12'", + "chevron>=0.14.0", +] + +[project.urls] +"Bug Tracker" = "https://github.com/posit-dev/py-shinylive/issues" +"Documentation" = "https://github.com/posit-dev/py-shinylive" +"Source Code" = "https://github.com/posit-dev/py-shinylive" + +[project.optional-dependencies] +test = [ + "pytest>=6.2.4", +] +dev = [ + "black>=22.3.0", + "flake8>=3.9.2", + "flake8-bugbear>=22.6.22", + "isort>=5.11.2", + "pyright>=1.1.284", + "wheel", + "build", +] + +[project.scripts] +shinylive = "shinylive._main:main" + +[tool.setuptools] +include-package-data = true +zip-safe = false + +[tool.setuptools.packages.find] +where = ["."] +include = ["shinylive*"] +exclude = [] + +[tool.setuptools.package-data] +shinylive = ["py.typed"] + +[tool.setuptools.dynamic] +version = {attr = "shinylive._version.SHINYLIVE_PACKAGE_VERSION"} + +[tool.flake8] +ignore = ["E302", "E501", "E704", "F403", "F405", "W503"] +exclude = ["docs", ".venv", "_dev"] + +[tool.isort] +profile = "black" diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index dbf6d17..0000000 --- a/setup.cfg +++ /dev/null @@ -1,82 +0,0 @@ -[metadata] -name = shinylive -version = attr: shinylive._version.SHINYLIVE_PACKAGE_VERSION -author = Winston Chang -author_email = winston@posit.co -url = https://github.com/posit-dev/py-shinylive -description = Run Shiny applications running Python in the browser. -long_description = file: README.md -long_description_content_type = text/markdown -license = MIT -license_file = LICENSE -platforms = any -classifiers = - Development Status :: 2 - Pre-Alpha - Intended Audience :: Developers - License :: OSI Approved :: MIT License - Natural Language :: English - 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 -project_urls = - Bug Tracker = https://github.com/posit-dev/py-shinylive/issues - Documentation = https://github.com/posit-dev/py-shinylive - Source Code = https://github.com/posit-dev/py-shinylive - - - -[options] -python_requires = >=3.8 -packages = find: -test_suite = tests -include_package_data = True -setup_requires = - setuptools -install_requires = - shiny - click>=8.1.7 - appdirs>=1.4.4 - lzstring>=1.0.4 - typing-extensions>=4.0.1 - setuptools; python_version>='3.12' - chevron>=0.14.0 -tests_require = - pytest>=3 -zip_safe = False - -[options.extras_require] -test = - pytest>=6.2.4 -dev = - black>=22.3.0 - flake8>=3.9.2 - flake8-bugbear>=22.6.22 - isort>=5.11.2 - pyright>=1.1.284 - wheel - -[options.packages.find] -include = shinylive, shinylive.* - -[options.package_data] -shinylive = py.typed - -[options.entry_points] -console_scripts = - shinylive = shinylive._main:main - - -[flake8] -# E302: Expected 2 blank lines -# E501: Line too long -# E704: Multiple statements on one line (def) -# F403: 'from module import *' used; unable to detect undefined names -# F405: Name may be undefined, or defined from star imports -# W503: Line break occurred before a binary operator -ignore = E302, E501, E704, F403, F405, W503 -exclude = docs, .venv, _dev - -[isort] -profile=black diff --git a/setup.py b/setup.py deleted file mode 100644 index 6068493..0000000 --- a/setup.py +++ /dev/null @@ -1,3 +0,0 @@ -from setuptools import setup - -setup() From f583ff0ad0a071d98fa35972bb7bc57d03462b61 Mon Sep 17 00:00:00 2001 From: Winston Chang Date: Fri, 14 Mar 2025 15:34:20 -0500 Subject: [PATCH 2/2] Use hatchling --- Makefile | 3 ++- pyproject.toml | 29 ++++++++++++++--------------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/Makefile b/Makefile index 3514f3c..f5e0f37 100644 --- a/Makefile +++ b/Makefile @@ -76,7 +76,8 @@ release: dist ## package and upload a release twine upload dist/* dist: clean ## builds source and wheel package - python -m build + python -c "import hatch" 2>/dev/null || pip install hatch + hatch build ls -l dist ## install the package to the active Python's site-packages diff --git a/pyproject.toml b/pyproject.toml index 9331d35..a0a1b06 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [build-system] -requires = ["setuptools>=42", "wheel", "build"] -build-backend = "setuptools.build_meta" +requires = ["hatchling"] +build-backend = "hatchling.build" [project] name = "shinylive" @@ -48,27 +48,26 @@ dev = [ "flake8-bugbear>=22.6.22", "isort>=5.11.2", "pyright>=1.1.284", - "wheel", - "build", ] [project.scripts] shinylive = "shinylive._main:main" -[tool.setuptools] -include-package-data = true -zip-safe = false +[tool.hatch.version] +path = "shinylive/_version/__init__.py" +pattern = "SHINYLIVE_PACKAGE_VERSION\\s*=\\s*['\"](?P[^'\"]+)['\"]" -[tool.setuptools.packages.find] -where = ["."] -include = ["shinylive*"] -exclude = [] +[tool.hatch.build.targets.wheel] +packages = ["shinylive"] +include = ["py.typed"] -[tool.setuptools.package-data] -shinylive = ["py.typed"] -[tool.setuptools.dynamic] -version = {attr = "shinylive._version.SHINYLIVE_PACKAGE_VERSION"} +[tool.hatch.build.targets.sdist] +include = [ + "shinylive", + "LICENSE", + "README.md", +] [tool.flake8] ignore = ["E302", "E501", "E704", "F403", "F405", "W503"]