Skip to content

Commit b95c743

Browse files
committed
build: parameterizes package name using the PACKAGE_NAME environment variable
1 parent d544fc1 commit b95c743

File tree

3 files changed

+96
-96
lines changed

3 files changed

+96
-96
lines changed

Makefile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@ VERSION := $(shell python -m setuptools_scm)
22
HOSTNAME := $(shell hostname)
33
S3_PREFIX := s3://rstudio-connect-downloads/connect/rsconnect-python
44

5-
BDIST_WHEEL := dist/rsconnect_python-$(VERSION)-py2.py3-none-any.whl
5+
PACKAGE_NAME := $(or $(PACKAGE_NAME), rsconnect_python)
6+
7+
BDIST_WHEEL := dist/$(PACKAGE_NAME)-$(VERSION)-py2.py3-none-any.whl
68

79
RUNNER = docker run \
810
-it --rm \

pyproject.toml

Lines changed: 6 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -1,94 +1,7 @@
1-
[project]
2-
name = "rsconnect_python"
3-
description = "Python integration with Posit Connect"
4-
5-
authors = [{ name = "Michael Marchetti", email = "[email protected]" }]
6-
license = { file = "LICENSE.md" }
7-
readme = { file = "README.md", content-type = "text/markdown" }
8-
requires-python = ">=3.8"
9-
10-
dependencies = [
11-
"typing-extensions>=4.8.0",
12-
"pip>=10.0.0",
13-
"semver>=2.0.0,<4.0.0",
14-
"pyjwt>=2.4.0",
15-
"click>=8.0.0",
16-
"toml>=0.10; python_version < '3.11'"
17-
]
18-
19-
dynamic = ["version"]
20-
21-
[project.scripts]
22-
rsconnect = "rsconnect.main:cli"
23-
24-
[project.optional-dependencies]
25-
test = [
26-
"black==24.3.0",
27-
"coverage",
28-
"flake8-pyproject",
29-
"flake8",
30-
"httpretty",
31-
"ipykernel",
32-
"nbconvert",
33-
"pyright",
34-
"pytest-cov",
35-
"pytest",
36-
"setuptools>=61",
37-
"setuptools_scm[toml]>=3.4",
38-
"twine",
39-
"types-Flask",
40-
]
41-
42-
[project.urls]
43-
Repository = "http://github.com/posit-dev/rsconnect-python"
44-
Documentation = "https://docs.posit.co/rsconnect-python"
45-
461
[build-system]
47-
requires = ["setuptools>=61", "setuptools_scm[toml]>=3.4", "wheel"]
48-
49-
[tool.distutils.bdist_wheel]
50-
universal = true
51-
52-
[tool.black]
53-
line-length = 120
54-
55-
[tool.coverage.run]
56-
omit = ["tests/*"]
57-
58-
[tool.flake8]
59-
max_line_length = 120
60-
show_source = true
61-
exclude = [".git", ".venv", ".venv2", ".venv3", "__pycache__", ".cache"]
62-
63-
# The following codes are ignored so that `flake8` plays nicer with how `black`
64-
# likes to format:
65-
# - E203: whitespace before ':'
66-
# - E231: missing whitespace after ',', ';', or ':'
67-
# - E302: expected 2 blank lines, found 0
68-
#
69-
# ref:
70-
# https://pycodestyle.readthedocs.io/en/latest/intro.html#error-codes
71-
#
72-
extend_ignore = ["E203", "E231", "E302"]
73-
per-file-ignores = ["tests/test_metadata.py: E501"]
74-
75-
[tool.setuptools]
76-
packages = ["rsconnect"]
77-
78-
[tool.setuptools_scm]
79-
write_to = "rsconnect/version.py"
80-
81-
[tool.setuptools.package-data]
82-
rsconnect = ["py.typed"]
83-
84-
[tool.pytest.ini_options]
85-
markers = ["vetiver: tests for vetiver"]
86-
addopts = """
87-
--ignore=tests/testdata
88-
"""
89-
90-
[tool.pyright]
91-
typeCheckingMode = "strict"
92-
reportPrivateUsage = "none"
93-
reportUnnecessaryIsInstance = "none"
94-
reportUnnecessaryComparison = "none"
2+
requires = [
3+
"setuptools>=61",
4+
"wheel",
5+
"setuptools_scm[toml]>=3.4",
6+
]
7+
build-backend = "setuptools.build_meta"

setup.py

Lines changed: 87 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,88 @@
1-
from setuptools import setup
1+
#!/usr/bin/env python
2+
import os
23

3-
setup()
4+
from setuptools import find_packages, setup
5+
6+
# dynamic package name
7+
PACKAGE_NAME = os.environ.get("PACKAGE_NAME", "rsconnect_python")
8+
9+
# read long description from README.md
10+
with open("README.md", encoding="utf-8") as f:
11+
long_description = f.read()
12+
13+
setup(
14+
# -- project identity --
15+
name=PACKAGE_NAME,
16+
use_scm_version={"write_to": "rsconnect/version.py"},
17+
setup_requires=["setuptools_scm[toml]>=3.4"],
18+
19+
# -- metadata --
20+
description="Python integration with Posit Connect",
21+
long_description=long_description,
22+
long_description_content_type="text/markdown",
23+
author="Michael Marchetti",
24+
author_email="[email protected]",
25+
license="MIT", # or use license_file below
26+
license_file="LICENSE.md",
27+
url="https://github.com/posit-dev/rsconnect-python",
28+
project_urls={
29+
"Repository": "https://github.com/posit-dev/rsconnect-python",
30+
"Documentation": "https://docs.posit.co/rsconnect-python",
31+
},
32+
python_requires=">=3.8",
33+
34+
# -- packages & data --
35+
packages=find_packages(include=["rsconnect", "rsconnect.*"]),
36+
include_package_data=True,
37+
package_data={"rsconnect": ["py.typed"]},
38+
39+
# -- dependencies --
40+
install_requires=[
41+
"typing-extensions>=4.8.0",
42+
"pip>=10.0.0",
43+
"semver>=2.0.0,<4.0.0",
44+
"pyjwt>=2.4.0",
45+
"click>=8.0.0",
46+
"toml>=0.10; python_version < '3.11'",
47+
],
48+
49+
extras_require={
50+
"test": [
51+
"black==24.3.0",
52+
"coverage",
53+
"flake8-pyproject",
54+
"flake8",
55+
"httpretty",
56+
"ipykernel",
57+
"nbconvert",
58+
"pyright",
59+
"pytest-cov",
60+
"pytest",
61+
"setuptools>=61",
62+
"setuptools_scm[toml]>=3.4",
63+
"twine",
64+
"types-Flask",
65+
],
66+
},
67+
68+
# -- console scripts --
69+
entry_points={
70+
"console_scripts": [
71+
"rsconnect=rsconnect.main:cli",
72+
],
73+
},
74+
75+
# -- wheel options --
76+
options={
77+
"bdist_wheel": {"universal": True},
78+
},
79+
80+
# -- (optional) PyPI classifiers, pick what applies --
81+
classifiers=[
82+
"Programming Language :: Python :: 3",
83+
"License :: OSI Approved :: MIT License",
84+
"Operating System :: OS Independent",
85+
],
86+
87+
zip_safe=False,
88+
)

0 commit comments

Comments
 (0)