Skip to content

build: parameterizes package name using the PACKAGE_NAME environment variable. #668

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

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
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: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
99 changes: 6 additions & 93 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -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"
90 changes: 88 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
@@ -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,
)
Loading