diff --git a/Makefile b/Makefile index 205af4b6..27703582 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,9 @@ VERSION := $(shell python -m setuptools_scm) HOSTNAME := $(shell hostname) S3_PREFIX := s3://rstudio-connect-downloads/connect/rsconnect-python -BDIST_WHEEL := dist/rsconnect_python-$(VERSION)-py2.py3-none-any.whl +PACKAGE_NAME := $(or $(PACKAGE_NAME), rsconnect_python) + +BDIST_WHEEL := dist/$(PACKAGE_NAME)-$(VERSION)-py2.py3-none-any.whl RUNNER = docker run \ -it --rm \ diff --git a/pyproject.toml b/pyproject.toml index 587add6b..61e0e2df 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,95 +1,8 @@ -[project] -name = "rsconnect_python" -description = "Python integration with Posit Connect" - -authors = [{ name = "Michael Marchetti", email = "mike@posit.co" }] -license = { file = "LICENSE.md" } -readme = { file = "README.md", content-type = "text/markdown" } -requires-python = ">=3.8" - -dependencies = [ - "typing-extensions>=4.8.0", - "pip>=10.0.0", - "semver>=2.0.0,<4.0.0", - "pyjwt>=2.4.0", - "click>=8.0.0", - "toml>=0.10; python_version < '3.11'" -] - -dynamic = ["version"] - -[project.scripts] -rsconnect = "rsconnect.main:cli" - -[project.optional-dependencies] -test = [ - "black==24.3.0", - "coverage", - "flake8-pyproject", - "flake8", - "httpretty", - "ipykernel", - "nbconvert", - "pyright", - "pytest-cov", - "pytest", - "setuptools>=61", - "setuptools_scm[toml]>=3.4", - "twine", - "types-Flask", -] -snowflake = ["snowflake-cli"] - -[project.urls] -Repository = "http://github.com/posit-dev/rsconnect-python" -Documentation = "https://docs.posit.co/rsconnect-python" - [build-system] -requires = ["setuptools>=61", "setuptools_scm[toml]>=3.4", "wheel"] - -[tool.distutils.bdist_wheel] -universal = true - -[tool.black] -line-length = 120 - -[tool.coverage.run] -omit = ["tests/*"] - -[tool.flake8] -max_line_length = 120 -show_source = true -exclude = [".git", ".venv", ".venv2", ".venv3", "__pycache__", ".cache"] - -# The following codes are ignored so that `flake8` plays nicer with how `black` -# likes to format: -# - E203: whitespace before ':' -# - E231: missing whitespace after ',', ';', or ':' -# - E302: expected 2 blank lines, found 0 -# -# ref: -# https://pycodestyle.readthedocs.io/en/latest/intro.html#error-codes -# -extend_ignore = ["E203", "E231", "E302"] -per-file-ignores = ["tests/test_metadata.py: E501"] - -[tool.setuptools] -packages = ["rsconnect"] - -[tool.setuptools_scm] -write_to = "rsconnect/version.py" - -[tool.setuptools.package-data] -rsconnect = ["py.typed"] - -[tool.pytest.ini_options] -markers = ["vetiver: tests for vetiver"] -addopts = """ - --ignore=tests/testdata -""" +requires = [ + "setuptools>=61", + "wheel", + "setuptools_scm[toml]>=3.4", +] -[tool.pyright] -typeCheckingMode = "strict" -reportPrivateUsage = "none" -reportUnnecessaryIsInstance = "none" -reportUnnecessaryComparison = "none" +build-backend = "setuptools.build_meta" diff --git a/setup.py b/setup.py index 60684932..533d480a 100644 --- a/setup.py +++ b/setup.py @@ -1,3 +1,89 @@ -from setuptools import setup +#!/usr/bin/env python +import os -setup() +from setuptools import find_packages, setup + +# Allow overriding the package name via $PACKAGE_NAME +PACKAGE_NAME = os.environ.get("PACKAGE_NAME", "rsconnect_python") + +# Pull in your README as the long description +with open("README.md", encoding="utf-8") as f: + long_description = f.read() + +setup( + # -- identity -- + name=PACKAGE_NAME, + use_scm_version={"write_to": "rsconnect/version.py"}, + setup_requires=["setuptools_scm[toml]>=3.4"], + + # -- metadata -- + description="Python integration with Posit Connect", + long_description=long_description, + long_description_content_type="text/markdown", + author="Michael Marchetti", + author_email="mike@posit.co", + license_file="LICENSE.md", + url="http://github.com/posit-dev/rsconnect-python", + project_urls={ + "Repository": "http://github.com/posit-dev/rsconnect-python", + "Documentation": "https://docs.posit.co/rsconnect-python", + }, + python_requires=">=3.8", + + # -- packages & typing stub -- + packages=find_packages(include=["rsconnect", "rsconnect.*"]), + include_package_data=True, + package_data={"rsconnect": ["py.typed"]}, + + # -- runtime dependencies -- + install_requires=[ + "typing-extensions>=4.8.0", + "pip>=10.0.0", + "semver>=2.0.0,<4.0.0", + "pyjwt>=2.4.0", + "click>=8.0.0", + "toml>=0.10; python_version < '3.11'", + ], + + # -- extras -- + extras_require={ + "test": [ + "black==24.3.0", + "coverage", + "flake8-pyproject", + "flake8", + "httpretty", + "ipykernel", + "nbconvert", + "pyright", + "pytest-cov", + "pytest", + "setuptools>=61", + "setuptools_scm[toml]>=3.4", + "twine", + "types-Flask", + ], + "snowflake": ["snowflake-cli"], + }, + + # -- console script entrypoint -- + entry_points={ + "console_scripts": [ + "rsconnect=rsconnect.main:cli", + ], + }, + + # -- wheel config -- + options={ + "bdist_wheel": {"universal": True}, + }, + + # -- classifiers (optional but recommended) -- + classifiers=[ + "Programming Language :: Python :: 3", + "License :: OSI Approved :: MIT License", + "Operating System :: OS Independent", + ], + + zip_safe=False, +)