diff --git a/.github/workflows/build-docs.yaml b/.github/workflows/build-docs.yaml index 7b98723c4..f88b71ef9 100644 --- a/.github/workflows/build-docs.yaml +++ b/.github/workflows/build-docs.yaml @@ -20,6 +20,8 @@ jobs: steps: - uses: actions/checkout@v4 + with: + fetch-depth: 0 - name: Setup py-shiny uses: ./.github/py-shiny/setup diff --git a/.github/workflows/deploy-tests.yaml b/.github/workflows/deploy-tests.yaml index d0e17f727..775316b14 100644 --- a/.github/workflows/deploy-tests.yaml +++ b/.github/workflows/deploy-tests.yaml @@ -20,6 +20,8 @@ jobs: steps: - uses: actions/checkout@v4 + with: + fetch-depth: 0 - name: Setup py-shiny uses: ./.github/py-shiny/setup with: diff --git a/.github/workflows/pytest.yaml b/.github/workflows/pytest.yaml index 43e5338d0..7fd04a9e9 100644 --- a/.github/workflows/pytest.yaml +++ b/.github/workflows/pytest.yaml @@ -30,6 +30,8 @@ jobs: steps: - uses: actions/checkout@v4 + with: + fetch-depth: 0 - name: Setup py-shiny id: install uses: ./.github/py-shiny/setup @@ -63,6 +65,8 @@ jobs: needs: [check] steps: - uses: actions/checkout@v4 + with: + fetch-depth: 0 - name: "Set up Python 3.10" uses: actions/setup-python@v4 with: @@ -117,6 +121,8 @@ jobs: steps: - uses: actions/checkout@v4 + with: + fetch-depth: 0 - name: Setup py-shiny uses: ./.github/py-shiny/setup with: @@ -159,6 +165,8 @@ jobs: steps: - uses: actions/checkout@v4 + with: + fetch-depth: 0 - name: Setup py-shiny uses: ./.github/py-shiny/setup with: @@ -205,6 +213,8 @@ jobs: steps: - uses: actions/checkout@v4 + with: + fetch-depth: 0 - name: Setup py-shiny uses: ./.github/py-shiny/setup with: diff --git a/.github/workflows/verify-js-built.yaml b/.github/workflows/verify-js-built.yaml index 02127f3b0..a0c4f4f18 100644 --- a/.github/workflows/verify-js-built.yaml +++ b/.github/workflows/verify-js-built.yaml @@ -11,6 +11,8 @@ jobs: steps: - uses: actions/checkout@v4 + with: + fetch-depth: 0 - name: Extract node version from .nvmrc id: nvm diff --git a/.gitignore b/.gitignore index df03125cb..a913e78fb 100644 --- a/.gitignore +++ b/.gitignore @@ -115,3 +115,6 @@ docs/source/reference/ _dev/ tests/playwright/deploys/**/requirements.txt test-results/ + +# setuptools_scm +shiny/_version.py diff --git a/Makefile b/Makefile index ecabe5f9f..f89477142 100644 --- a/Makefile +++ b/Makefile @@ -188,9 +188,9 @@ release: dist ## package and upload a release twine upload dist/* dist: clean ## builds source and wheel package - pip install setuptools - python setup.py sdist - python setup.py bdist_wheel + pip install build + python -m build --sdist + python -m build --wheel ls -l dist diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 000000000..4643bdaea --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,148 @@ +[build-system] +requires = ["setuptools>=60", "wheel", "setuptools_scm>=8.0"] +build-backend = "setuptools.build_meta" + +[tool.setuptools] +packages = {find = {include = ["shiny", "shiny.*"]}} + +[tool.setuptools_scm] +write_to = "shiny/_version.py" +local_scheme = "no-local-version" + +[project] +name = "shiny" +dynamic = ["version"] +authors = [ + {name = "Winston Chang", email = "winston@posit.co"}, +] +description = "A web development framework for Python." +readme = "README.md" +requires-python = ">=3.8" +license = {text = "MIT"} +classifiers = [ + "Development Status :: 5 - Production/Stable", + "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 = [ + "typing-extensions>=4.10.0", + "uvicorn>=0.16.0;platform_system!='Emscripten'", + "starlette", + "websockets>=10.0", + "python-multipart", + "htmltools>=0.5.2", + "click>=8.1.4;platform_system!='Emscripten'", + "markdown-it-py>=1.1.0", + "mdit-py-plugins>=0.3.0", + "linkify-it-py>=1.0", + "appdirs>=1.4.4", + "asgiref>=3.5.2", + "packaging>=20.9", + "watchfiles>=0.18.0;platform_system!='Emscripten'", + "questionary>=2.0.0;platform_system!='Emscripten'", + "prompt-toolkit;platform_system!='Emscripten'", + "python-multipart>=0.0.7;platform_system!='Emscripten'", + "setuptools;python_version>='3.12'", +] + +[project.optional-dependencies] +theme = ["libsass>=0.23.0"] +test = [ + "pytest>=6.2.4", + "pytest-asyncio>=0.17.2", + "pytest-playwright>=0.3.0", + "playwright>=1.43.0", + "pytest-xdist", + "pytest-timeout", + "pytest-rerunfailures", + "pytest-cov", + "coverage", + "syrupy>=4.7.1", + "psutil", + "astropy", + "suntime", + "timezonefinder", + "ipyleaflet", + "shinywidgets", + "seaborn", + "plotnine", + "plotly", + "duckdb", + "holoviews", + "bokeh", + "xarray", + "geopandas", + "geodatasets", + "missingno", + "rsconnect-python", + "scikit-learn", + "folium", + "palmerpenguins", + "faicons", + "ridgeplot", + "great_tables", +] +dev = [ + "black>=24.0", + "flake8>=6.0.0", + "flake8-bugbear>=23.2.13", + "Flake8-pyproject>=1.2.3", + "isort>=5.10.1", + "libsass>=0.23.0", + "pyright==1.1.369", + "pre-commit>=2.15.0", + "wheel", + "matplotlib", + "pandas", + "pandas-stubs", + "polars", + "numpy", + "shinyswatch>=0.7.0", + "python-dotenv", + "anthropic", + "google-generativeai;python_version>='3.9'", + "langchain_core", + "openai", + "ollama", + "tokenizers", + "aiohttp", + "beautifulsoup4", +] +doc = [ + "jupyter", + "jupyter_client < 8.0.0", + "tabulate", + "shinylive", + "pydantic>=2.7.4", + "quartodoc==0.7.5", + "griffe<1.0.0", +] + +[project.urls] +Homepage = "https://github.com/posit-dev/py-shiny" +Documentation = "https://shiny.posit.co/py/" +Repository = "https://github.com/posit-dev/py-shiny" +"Bug Tracker" = "https://github.com/posit-dev/py-shiny/issues" + +[project.scripts] +shiny = "shiny._main:main" + +[project.entry-points.pytest11] +shiny-test = "shiny.pytest._pytest" + +[tool.pytest.ini_options] +testpaths = ["tests"] + +[tool.flake8] +extend-exclude = ["docs", ".venv", "venv", "typings", "build", "_dev"] +ignore = ["E302", "E501", "F403", "F405", "W503", "E203", "E701", "E704"] + +[tool.isort] +profile = "black" +skip = ["__init__.py", "typings/", "_dev/", ".venv", "venv", ".tox", "build"] diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 9223b46f7..000000000 --- a/setup.cfg +++ /dev/null @@ -1,175 +0,0 @@ -[metadata] -name = shiny -version = attr: shiny.__version__ -author = Winston Chang -author_email = winston@posit.co -url = https://github.com/posit-dev/py-shiny -description = A web development framework for Python. -long_description = file: README.md -long_description_content_type = text/markdown -license = MIT -license_files = LICENSE -platforms = any -classifiers = - Development Status :: 5 - Production/Stable - 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-shiny/issues - Documentation = https://shiny.posit.co/py/ - Source Code = https://github.com/posit-dev/py-shiny - -[options] -python_requires = >=3.8 -packages = find_namespace: -test_suite = tests -include_package_data = True -setup_requires = - setuptools -install_requires = - typing-extensions>=4.10.0 - uvicorn>=0.16.0;platform_system!="Emscripten" - starlette - websockets>=10.0 - python-multipart - htmltools>=0.5.2 - click>=8.1.4;platform_system!="Emscripten" - markdown-it-py>=1.1.0 - # This is needed for markdown-it-py. Without it, when loading shiny/ui/_markdown.py, - # Python emits the following: "UserWarning: The 'tasklists' feature of GitHub - # flavored markdown requires the mdit_py_plugins package." - mdit-py-plugins>=0.3.0 - linkify-it-py>=1.0 - appdirs>=1.4.4 - asgiref>=3.5.2 - packaging>=20.9 - watchfiles>=0.18.0;platform_system!="Emscripten" - questionary>=2.0.0;platform_system!="Emscripten" - prompt-toolkit;platform_system!="Emscripten" - # This is needed to address a DoS issue. In the future, when we are able to upgrade - # to starlette>=0.36.2, we can remove this, because it will be brought in by - # starlette. For more information, see: - # https://github.com/posit-dev/py-shiny/issues/1114#issuecomment-1942757757 - python-multipart>=0.0.7;platform_system!="Emscripten" - setuptools;python_version>="3.12" -tests_require = - pytest>=3 -zip_safe = False - -[options.extras_require] -theme = - # Theme extras are provided as a convenience. They are duplicated under the `dev` - # extra for testing and local development. Update these versions in both locations! - libsass>=0.23.0 -test = - pytest>=6.2.4 - pytest-asyncio>=0.17.2 - pytest-playwright>=0.3.0 - playwright>=1.43.0 - pytest-xdist - pytest-timeout - pytest-rerunfailures - pytest-cov - coverage - # For snapshot testing. v4.6.3 is incompatible with pytest-rerunfailures, see - # https://github.com/syrupy-project/syrupy/issues/879 - syrupy==4.6.2 - psutil - astropy - suntime - timezonefinder - ipyleaflet - shinywidgets - seaborn - plotnine - plotly - duckdb - holoviews - bokeh - xarray - geopandas - geodatasets - missingno - rsconnect-python - scikit-learn - folium - palmerpenguins - faicons - ridgeplot - great_tables -dev = - black>=24.0 - flake8>=6.0.0 - flake8-bugbear>=23.2.13 - isort>=5.10.1 - libsass>=0.23.0 - pyright==1.1.369 # Future version: >=1.1.371; - pre-commit>=2.15.0 - wheel - matplotlib - pandas - pandas-stubs - polars - numpy - shinyswatch>=0.7.0 - python-dotenv - # Chat() provider types - anthropic - google-generativeai;python_version>="3.9" - langchain_core - openai - ollama - tokenizers - # examples/chat/RAG - aiohttp - beautifulsoup4 -doc = - jupyter - jupyter_client < 8.0.0 - tabulate - shinylive - pydantic>=2.7.4 - quartodoc==0.7.5 - griffe<1.0.0 - -[options.packages.find] -include = shiny, shiny.* - -[options.package_data] -shiny = py.typed - -[options.entry_points] -pytest11 = - shiny-test = shiny.pytest._pytest -console_scripts = - shiny = shiny._main:main - - -[flake8] -# E302: Expected 2 blank lines -# E501: Line too long -# 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 -# E203: whitespace before ':' (see https://black.readthedocs.io/en/stable/guides/using_black_with_other_tools.html#flake8) -# E701 multiple statements on one line (colon) -# E704: Multiple statements on one line (def) -ignore = E302, E501, F403, F405, W503, E203, E701, E704 -extend_exclude = docs, .venv, venv, typings, build, _dev - -[isort] -profile=black -skip= - __init__.py - typings/ - _dev/ - .venv - venv - .tox - build diff --git a/setup.py b/setup.py deleted file mode 100644 index 606849326..000000000 --- a/setup.py +++ /dev/null @@ -1,3 +0,0 @@ -from setuptools import setup - -setup() diff --git a/shiny/__init__.py b/shiny/__init__.py index 9a40535b1..8869f881b 100644 --- a/shiny/__init__.py +++ b/shiny/__init__.py @@ -1,6 +1,6 @@ """A package for building reactive web applications.""" -__version__ = "1.0.0.9000" +from ._version import __version__ from ._shinyenv import is_pyodide as _is_pyodide @@ -37,6 +37,7 @@ __all__ = ( + "__version__", # public sub-packages "quarto", "reactive", diff --git a/shiny/express/_module.py b/shiny/express/_module.py index d4366d79b..9e040bd73 100644 --- a/shiny/express/_module.py +++ b/shiny/express/_module.py @@ -53,7 +53,7 @@ def wrapper(id: Id, *args: P.args, **kwargs: P.kwargs) -> R: module_session.output, module_session, *args, - **kwargs + **kwargs, ) return wrapper