Skip to content
Merged
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
2 changes: 1 addition & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ updates:
interval: "weekly"
allow:
- dependency-name: "uv-build"
versioning-strategy: "widen"
versioning-strategy: "increase"
commit-message:
prefix: "chore(deps)"

Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest]
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13', '3.14']
python-version: ['3.11', '3.12', '3.13', '3.14', '3.15']
include:
- os: macos-latest
python-version: '3.13'
Expand All @@ -45,7 +45,7 @@ jobs:
- run: just lint
- run: uv run --python ${{ matrix.python-version }} --group test rsconnect version
- run: just test ${{ matrix.python-version }}
- if: github.event_name == 'pull_request' && matrix.python-version == '3.8'
- if: github.event_name == 'pull_request' && matrix.python-version == '3.11'
uses: orgoro/coverage@d77626a5fa35d39123e86d6c62907fabe2491496 # v3
with:
coverageFile: coverage.xml
Expand Down Expand Up @@ -84,7 +84,7 @@ jobs:
# --upgrade forces a fresh resolve (ignoring the lock) so prereleases are
# actually exercised; plain `--prerelease allow` against the lock is a no-op.
- run: uv run --upgrade --prerelease allow --group test rsconnect version
- run: uv run --python 3.8 --upgrade --prerelease allow --group test ./scripts/runtests
- run: uv run --python 3.11 --upgrade --prerelease allow --group test ./scripts/runtests

snowflake-extra:
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/uv-lock-upgrade.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
title: "chore(deps): upgrade uv.lock"
body: |
Automated `uv lock --upgrade`. Dependabot can't update this lockfile because it
resolves different versions per Python version (`requires-python = ">=3.8"`).
resolves different versions per Python version (`requires-python = ">=3.11"`).

```
${{ steps.upgrade.outputs.summary }}
Expand Down
3 changes: 2 additions & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ just install

- `ruff format` (120-character lines) and `ruff check` are enforced in CI. `tests/test_metadata.py` is exempt from the line-length rule.
- Pyright runs in strict mode (`typeCheckingMode = "strict"`). It is advisory and doesn't fail `just lint`.
- Support Python 3.8+. Import newer typing features from `typing_extensions`.
- Support Python 3.11+ (see ADR-0001). The CLI Python and the content Python are separate: all of `rsconnect/` runs on the CLI Python, including `subprocesses/inspect_environment.py`, which only shells out to the content Python for its version and packages.
- Import typing features from `typing`, never `typing_extensions`. It's installed in dev environments through other tools, but it's not a runtime dependency, so imports pass tests and then fail for users.
- Use `TypedDict` for structured dictionaries such as API responses and manifest data.

## Important Patterns
Expand Down
2 changes: 1 addition & 1 deletion Justfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# rsconnect-python task runner. Run `just --list` to see recipes.

python_versions := "3.8 3.9 3.10 3.11 3.12 3.13 3.14"
python_versions := "3.11 3.12 3.13 3.14 3.15"

# Run the test suite against a single Python version (default 3.13)
# Invoke via `bash` so the recipe works on Windows, where uv cannot spawn the
Expand Down
4 changes: 4 additions & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- Reads deployment settings from `[tool.posit.connect]` in `pyproject.toml` and generates it in quickstart projects. The legacy `[tool.rsconnect]` name remains supported with a deprecation warning.

### Removed

- **Breaking:** Removes support for running the CLI on Python 3.8–3.10. Installing on those versions resolves to 1.33.2, the last compatible release. Content can still target those versions [#972](https://github.com/posit-dev/rsconnect-python/pull/972).

### Fixed

- Follows symlinks when bundling content: linked files are archived with their target contents and linked directories are included, instead of archiving broken links or omitting the directories. [#955](https://github.com/posit-dev/rsconnect-python/pull/955)
Expand Down
2 changes: 1 addition & 1 deletion docs/agents/architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Server classes subclass `AbstractRemoteServer` in `api.py`:
- **`bundle.py`**: `Manifest` and `Bundle`, plus `make_*_bundle()` builders per content type (notebook, Quarto, HTML, TensorFlow, Voila, API, Node.js, from an existing manifest).
- **`models.py`**: `AppModes` (canonical content types) and `TypedDict` models for API payloads.
- **`metadata.py`**: on-disk stores. `ServerStore` holds saved server credentials in the platform config directory (see `config_dirname()`). `AppStore` records deployments, next to the content in an `rsconnect-python/` directory, falling back to the config directory.
- **`environment.py`**: Python environment detection. Runs `subprocesses/inspect_environment.py` under the target interpreter so inspection is isolated from the CLI's own environment.
- **`environment.py`**: Python environment detection. Runs `subprocesses/inspect_environment.py` under the CLI interpreter; the inspector queries the content interpreter for its version and installed packages.
- **`environment_node.py`**: Node.js/npm environment detection.
- **`preflight.py`**, **`preflight_node.py`**: checks that a Python or Node.js project is deployable before uploading.
- **`pyproject.py`**: reads Python version requirements from static project metadata.
Expand Down
12 changes: 4 additions & 8 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,16 @@ description = "The Posit Connect command-line interface."
authors = [{ name = "Posit, PBC", email = "rsconnect@posit.co" }]
license = { file = "LICENSE.md" }
readme = { file = "README.md", content-type = "text/markdown" }
requires-python = ">=3.8"
version = "1.33.3.dev1"
requires-python = ">=3.11"
version = "1.34.0.dev1"

dependencies = [
"typing-extensions>=4.8.0",
"pip>=20.3",
"uv>=0.9.0",
"semver>=2.0.0,<4.0.0",
"pyjwt>=2.4.0; python_version < '3.9'",
"pyjwt>=2.15.0; python_version >= '3.9'",
"pyjwt>=2.15.0",
"click>=8.0.0",
"packaging>=20.0",
"toml>=0.10; python_version < '3.11'",
]

[project.scripts]
Expand All @@ -26,8 +23,7 @@ rsconnect = "rsconnect.main:cli"
[project.optional-dependencies]
keyring = ["keyring>=23.0.0"]
snowflake = [
"snowflake-cli>=2.8.2; python_version < '3.10'",
"snowflake-cli>=3.23.0; python_version >= '3.10'",
"snowflake-cli>=3.23.0",
]

[dependency-groups]
Expand Down
13 changes: 2 additions & 11 deletions rsconnect/actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,9 @@
import typing
from os.path import basename, exists, isdir, join, relpath
from pathlib import PurePath
from typing import Optional, Sequence, cast
from warnings import warn

# Even though TypedDict is available in Python 3.8, because it's used with NotRequired,
# they should both come from the same typing module.
# https://peps.python.org/pep-0655/#usage-in-python-3-11
if sys.version_info >= (3, 11):
from typing import NotRequired, TypedDict
else:
from typing_extensions import NotRequired, TypedDict

from typing import NotRequired, Optional, Sequence, TypedDict, cast
from urllib.parse import urlparse
from warnings import warn

import click

Expand Down
6 changes: 2 additions & 4 deletions rsconnect/actions_content.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ def build_start(
# were allowed to shut down gracefully, they may have been interrupted.
build_store.set_build_running(False)
if content_executor:
content_executor.shutdown(wait=False)
content_executor.shutdown(wait=False, cancel_futures=True)
if build_monitor:
build_monitor.shutdown()

Expand Down Expand Up @@ -303,9 +303,7 @@ def _build_content_item(
):
build_store = ensure_content_build_store(connect_server)
with RSConnectClient(connect_server) as client:
# Pending futures will still try to execute when ThreadPoolExecutor.shutdown() is called
# so just exit immediately if the current build has been aborted.
# ThreadPoolExecutor.shutdown(cancel_futures=) isnt available until py3.9
# A worker can pick up a queued item after the abort flag is set but before shutdown cancels it.
if build_store.aborted():
return

Expand Down
17 changes: 3 additions & 14 deletions rsconnect/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import os
import re
import shlex
import sys
import tarfile
import time
import typing
Expand All @@ -29,7 +28,10 @@
Literal,
Mapping,
NamedTuple,
NotRequired,
Optional,
ParamSpec,
TypedDict,
TypeVar,
Union,
cast,
Expand All @@ -41,19 +43,6 @@

import click

if sys.version_info >= (3, 10):
from typing import ParamSpec
else:
from typing_extensions import ParamSpec

# Even though TypedDict is available in Python 3.8, because it's used with NotRequired,
# they should both come from the same typing module.
# https://peps.python.org/pep-0655/#usage-in-python-3-11
if sys.version_info >= (3, 11):
from typing import NotRequired, TypedDict
else:
from typing_extensions import NotRequired, TypedDict

from . import connect_cloud, validation
from .bundle import _default_title, _find_manifest_member
from .shiny_express import unescape_from_var_name
Expand Down
20 changes: 4 additions & 16 deletions rsconnect/bundle.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,24 +36,17 @@
Callable,
Iterator,
Literal,
NotRequired,
Optional,
Sequence,
TypedDict,
Union,
cast,
)
from urllib.parse import urlsplit

from . import metadata

# Even though TypedDict is available in Python 3.8, because it's used with NotRequired,
# they should both come from the same typing module.
# https://peps.python.org/pep-0655/#usage-in-python-3-11
if sys.version_info >= (3, 11):
from typing import NotRequired, TypedDict
else:
from typing_extensions import NotRequired, TypedDict


from .environment import Environment, list_environment_dirs, is_environment_dir
from .environment_node import NodeEnvironment
from .environment_r import REnvironment
Expand Down Expand Up @@ -535,13 +528,8 @@ def manifest_add_buffer(manifest: ManifestData, filename: str, buf: str | bytes)


def make_hasher():
try:
return hashlib.md5()
except Exception:
# md5 is not available in FIPS mode, see if the usedforsecurity option is available
# (it was added in python 3.9). We set usedforsecurity=False since we are only
# using this for a file upload integrity check.
return hashlib.md5(usedforsecurity=False)
# MD5 checks upload integrity, not security; the flag keeps it available in FIPS mode.
return hashlib.md5(usedforsecurity=False)


def file_checksum(path: str | Path) -> str:
Expand Down
14 changes: 3 additions & 11 deletions rsconnect/environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
import json
import pathlib
import os.path
import enum
import tomllib
from enum import StrEnum

from . import pyproject
from .subprocesses import inspect_environment
Expand All @@ -23,15 +24,6 @@
from .subprocesses.inspect_environment import EnvironmentData, MakeEnvironmentData as _MakeEnvironmentData


try:
from enum import StrEnum
except ImportError: # Python <3.11

class StrEnum(str, enum.Enum):
def __str__(self) -> str:
return str(self.value)


class PackageInstaller(StrEnum):
PIP = "pip"
UV = "uv"
Expand Down Expand Up @@ -138,7 +130,7 @@ def create_python_environment(

try:
python_version_requirement = pyproject.detect_python_version_requirement(directory)
except pyproject.TOMLDecodeError as err:
except tomllib.TOMLDecodeError as err:
raise RSConnectException(f"Error reading pyproject.toml: {err}") from err
_warn_on_missing_python_version(python_version_requirement)

Expand Down
16 changes: 2 additions & 14 deletions rsconnect/log.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,7 @@
import logging
import sys
from functools import partial, wraps
from typing import TYPE_CHECKING, Any, Callable, Literal, Optional, Protocol, TypeVar

if sys.version_info >= (3, 10):
from typing import Concatenate, ParamSpec
else:
from typing_extensions import Concatenate, ParamSpec

from typing import TYPE_CHECKING, Any, Callable, Concatenate, Literal, Optional, ParamSpec, Protocol, TypeVar

if TYPE_CHECKING:
from collections.abc import MutableMapping
Expand Down Expand Up @@ -94,13 +88,7 @@ def format(self, record: logging.LogRecord):
return json.dumps(message_dict, default=str)


# This is a workaround for LoggerAdapter not being generic in Python<=3.10.
# See also:
# https://github.com/python/typeshed/issues/7855#issuecomment-1128857842
if sys.version_info >= (3, 11):
_LoggerAdapter = logging.LoggerAdapter[logging.Logger]
else:
_LoggerAdapter = logging.LoggerAdapter
_LoggerAdapter = logging.LoggerAdapter[logging.Logger]


class RSLogger(_LoggerAdapter):
Expand Down
45 changes: 18 additions & 27 deletions rsconnect/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import sys
import tempfile
import textwrap
import tomllib
import traceback
from functools import wraps
from os.path import abspath, dirname, exists, isdir, join
Expand All @@ -18,24 +19,16 @@
Callable,
ItemsView,
Literal,
Never,
Optional,
ParamSpec,
Sequence,
TypeVar,
cast,
)

import click

if sys.version_info >= (3, 10):
from typing import ParamSpec
else:
from typing_extensions import ParamSpec

if sys.version_info >= (3, 11):
from typing import Never
else:
from typing_extensions import Never

from rsconnect.certificates import read_certificate_file

from . import VERSION, api, validation
Expand Down Expand Up @@ -148,7 +141,6 @@
)
from .pyproject import (
InvalidPyprojectConfigError,
TOMLDecodeError,
UnsupportedAppModeError,
resolve_pyproject_deploy_target,
)
Expand Down Expand Up @@ -201,20 +193,19 @@ def output_params(
ctx: click.Context,
vars: ItemsView[str, object],
):
if click.__version__ >= "8.0.0" and sys.version_info >= (3, 7):
logger.log(VERBOSE, "Detected the following inputs:")
for k, v in vars:
if k in {"ctx", "verbose", "quiet", "kwargs"}:
continue
if v is not None:
val: object = v
if k in _MASKED_PARAMS:
val = "**********"
elif k == "env_vars" and isinstance(v, dict):
# The values are sent to the server as secrets; log names only.
val = "%s (values hidden)" % sorted(cast("dict[str, str]", v))
sourceName = validation.get_parameter_source_name_from_ctx(k, ctx)
logger.log(VERBOSE, " %-18s%s (from %s)", (k + ":"), val, sourceName)
logger.log(VERBOSE, "Detected the following inputs:")
for k, v in vars:
if k in {"ctx", "verbose", "quiet", "kwargs"}:
continue
if v is not None:
val: object = v
if k in _MASKED_PARAMS:
val = "**********"
elif k == "env_vars" and isinstance(v, dict):
# The values are sent to the server as secrets; log names only.
val = "%s (values hidden)" % sorted(cast("dict[str, str]", v))
sourceName = validation.get_parameter_source_name_from_ctx(k, ctx)
logger.log(VERBOSE, " %-18s%s (from %s)", (k + ":"), val, sourceName)


def device_login_args(kind: Literal["connect", "cloud"]) -> Callable[[Callable[..., Any]], Callable[..., Any]]:
Expand Down Expand Up @@ -2811,7 +2802,7 @@ def quickstart_hint() -> str:
raise RSConnectException(f"{err}\n\n{quickstart_hint()}") from err
except FileNotFoundError as err:
raise RSConnectException(f"pyproject.toml not found at {pyproject_path}.\n\n{quickstart_hint()}") from err
except TOMLDecodeError as err:
except tomllib.TOMLDecodeError as err:
raise RSConnectException(f"pyproject.toml could not be parsed: {err}\n\n{quickstart_hint()}") from err

app_mode = target.app_mode
Expand Down Expand Up @@ -4421,7 +4412,7 @@ def quickstart_hint() -> str:
raise RSConnectException(f"{err}\n\n{quickstart_hint()}") from err
except FileNotFoundError as err:
raise RSConnectException(f"pyproject.toml not found at {pyproject_path}.\n\n{quickstart_hint()}") from err
except TOMLDecodeError as err:
except tomllib.TOMLDecodeError as err:
raise RSConnectException(f"pyproject.toml could not be parsed: {err}\n\n{quickstart_hint()}") from err

app_mode = target.app_mode
Expand Down
Loading
Loading