Skip to content

Commit a46722f

Browse files
committed
Merge branch 'master' into shinyapps-target-app-id-fix
# Conflicts: # CHANGELOG.md
2 parents 36e931b + eea813e commit a46722f

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77
## Unreleased
88

99
### Fixed
10+
- Python virtualenvs are now detected in Windows environments, and are automatically
11+
excluded from the uploaded bundle.
1012
- Error deploying to shinyapps.io when `--app-id` is provided [#464](https://github.com/rstudio/rsconnect-python/issues/464).
1113

1214
### Added

rsconnect/bundle.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -815,8 +815,13 @@ def create_glob_set(directory, excludes):
815815

816816

817817
def is_environment_dir(directory):
818+
"""Detect whether `directory` is a virtualenv"""
819+
820+
# A virtualenv will have Python at ./bin/python
818821
python_path = join(directory, "bin", "python")
819-
return exists(python_path)
822+
# But on Windows, it's at Scripts\Python.exe
823+
win_path = join(directory, "Scripts", "Python.exe")
824+
return exists(python_path) or exists(win_path)
820825

821826

822827
def list_environment_dirs(directory):
@@ -859,7 +864,7 @@ def make_api_manifest(
859864
:return: the manifest and a list of the files involved.
860865
"""
861866
if is_environment_dir(directory):
862-
excludes = list(excludes or []) + ["bin/", "lib/"]
867+
excludes = list(excludes or []) + ["bin/", "lib/", "Lib/", "Scripts/", "Include/"]
863868

864869
extra_files = extra_files or []
865870
skip = [environment.filename, "manifest.json"]
@@ -1483,7 +1488,7 @@ def _warn_if_environment_directory(directory):
14831488
if is_environment_dir(directory):
14841489
click.secho(
14851490
" Warning: The deployment directory appears to be a python virtual environment.\n"
1486-
" Excluding the 'bin' and 'lib' directories.",
1491+
" Python libraries and binaries will be excluded from the deployment.",
14871492
fg="yellow",
14881493
)
14891494

rsconnect/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -761,7 +761,7 @@ def _warn_if_environment_directory(directory):
761761
if is_environment_dir(directory):
762762
click.secho(
763763
" Warning: The deployment directory appears to be a python virtual environment.\n"
764-
" Excluding the 'bin' and 'lib' directories.",
764+
" Python libraries and binaries will be excluded from the deployment.",
765765
fg="yellow",
766766
)
767767

0 commit comments

Comments
 (0)