Skip to content

Commit

Permalink
Merge branch 'master' into mm-docs-log
Browse files Browse the repository at this point in the history
  • Loading branch information
mmarchetti authored Oct 20, 2023
2 parents 76f9521 + f3d9d72 commit c16c9b1
Show file tree
Hide file tree
Showing 39 changed files with 550 additions and 739 deletions.
20 changes: 0 additions & 20 deletions .flake8

This file was deleted.

49 changes: 31 additions & 18 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12']
include:
- os: macos-latest
python-version: '3.9'
Expand All @@ -26,16 +26,19 @@ jobs:
runs-on: ${{ matrix.os }}
name: test (py${{ matrix.python-version }} ${{ matrix.os }})
steps:
- uses: actions/checkout@v2
- run: git fetch --prune --unshallow
- uses: actions/checkout@v4
with:
fetch-depth: 0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- run: pip install -r requirements.txt
- run: pip install '.[test]'
- run: pip freeze
- run: make fmt
- run: make lint
- run: python setup.py --version
- run: rsconnect version
- run: make test-${{ matrix.python-version }}
- if: github.event_name == 'pull_request' && matrix.python-version == '3.8'
uses: orgoro/coverage@v3
Expand All @@ -47,28 +50,34 @@ jobs:
runs-on: ubuntu-latest
continue-on-error: true
steps:
- uses: actions/checkout@v2
- run: git fetch --prune --unshallow
- uses: actions/checkout@v4
with:
fetch-depth: 0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/setup-python@v2
with:
python-version: 3.8.x
- run: pip install --pre -r requirements.txt
- run: pip install --pre '.[test]'
- run: pip freeze
- run: make fmt
- run: make lint
- run: python setup.py --version
- run: rsconnect version
- run: make mock-test-3.8

distributions:
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: git fetch --prune --unshallow
- uses: actions/checkout@v4
with:
fetch-depth: 0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/setup-python@v2
with:
python-version: 3.8.x
- run: pip install -r requirements.txt
- run: pip install -e '.[test]'
- run: pip freeze
- run: make dist
id: create_dist
Expand Down Expand Up @@ -117,12 +126,14 @@ jobs:
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: git fetch --prune --unshallow
- uses: actions/checkout@v4
with:
fetch-depth: 0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/setup-python@v2
with:
python-version: 3.8.x
- run: pip install -r requirements.txt
- run: pip freeze
- run: make docs
- uses: actions/upload-artifact@v2
Expand Down Expand Up @@ -163,15 +174,15 @@ jobs:
name: "Integration tests against latest Connect"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install -r requirements.txt
python -m pip install -r vetiver-testing/vetiver-requirements.txt
python -m pip install '.[test]'
- name: Run RStudio Connect
run: |
docker-compose up --build -d
Expand All @@ -197,7 +208,9 @@ jobs:
CONNECT_LICENSE: ${{ secrets.RSC_LICENSE }}
ADMIN_API_KEY: ${{ secrets.ADMIN_API_KEY }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
fetch-depth: 0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: extractions/setup-just@v1
Expand Down
36 changes: 28 additions & 8 deletions .github/workflows/snyk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,34 @@ jobs:
with:
fetch-depth: 0

- name: Run Snyk (setup.py)
uses: snyk/actions/python@master
# - name: Run Snyk (setup.py)
# uses: snyk/actions/python@master
# with:
# command: monitor
# args: --file=setup.py --package-manager=pip --project-name=setup.py --org=${{ env.SNYK_ORG }}

# - name: Run Snyk (requirements.txt)
# uses: snyk/actions/python@master
# with:
# command: monitor
# args: --file=requirements.txt --package-manager=pip --project-name=requirements.txt --org=${{ env.SNYK_ORG }}

# On Oct 2 2023, the steps using snyk/actions/python@master started failing with "undefined".
# Nothing obvious changed in our code or in the Snyk action or Docker image.
# Setting up and running snyk generically seems to work, so we'll go with that.
- name: Set up Python
uses: actions/setup-python@v4
with:
command: monitor
args: --file=setup.py --package-manager=pip --project-name=setup.py --org=${{ env.SNYK_ORG }}
python-version: '3.11'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e '.[test]'
- uses: snyk/actions/setup@master

- name: Run Snyk (setup.py)
run: snyk monitor --file="setup.py" --package-manager=pip --project-name="setup.py" --org=${{ env.SNYK_ORG }}

- name: Run Snyk (requirements.txt)
uses: snyk/actions/python@master
with:
command: monitor
args: --file=requirements.txt --package-manager=pip --project-name=requirements.txt --org=${{ env.SNYK_ORG }}
run: snyk monitor --file="requirements.txt" --package-manager=pip --project-name="requirements.txt" --org=${{ env.SNYK_ORG }}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,12 @@
/rsconnect-build-test
/rsconnect/version.py
/tests/testdata/**/rsconnect-python/
env
htmlcov
test-home/
venv
coverage.xml

# Temporary dev files
vetiver-testing/rsconnect_api_keys.json
/pip-wheel-metadata/
30 changes: 30 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,36 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## Unreleased

### Fixed
- The `https_proxy` environment variable is recognized as a synonym for
`HTTPS_PROXY`.
- When adding a new server, the initial request now includes an
Authorization header containing the API key. This is needed
for Connect installations behind a proxy that only passes
authenticated requests.
- Common environment directories (`env, venv, .env, .venv`) are no longer
excluded by name. Environments are detected by the presence of a python
executable in `bin` or `Scripts` and excluded.

### Added
- Added support for the `no_proxy` or `NO_PROXY` environment variables to specify
hosts that should not be accessed via proxy server. It's a comma-separated list
of host or domain suffixes. For example, specifying `example.com` will
bypass the proxy for example.com, host.example.com, etc.
- If an entrypoint is not specified with `--entrypoint`, rsconnect-python will try
harder than before to choose an entrypoint file. In addition to the previously
recognized filename patterns, the file patterns `app-*.py`, `app_*.py`, `*-app.py`,
and `*_app.py` are now considered. However, if the directory contains more than
one file matching these new patterns, you must provide rsconnect-python with an
explicit `--entrypoint` argument.
- Added a new verbose logging level. Specifying `-v` on the command line uses this
new level. Currently this will cause filenames to be logged as they are added to
a bundle. To enable maximum verbosity (debug level), use `-vv`.

### Changed
- Removing experimental support for Conda. Connect does not support restoring Conda environments.

## [1.20.0] - 2023-09-11

Expand Down
15 changes: 7 additions & 8 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,10 @@ cd rsconnect-python
python3 -m venv .venv
# Activate the virtual environment
source .venv/bin/activate
# install our requirements into the virtual environment
pip install -r requirements.txt
# install rsconnect-python with a symbolic link to the locations repository,
# meaning any changes to code in there will automatically be reflected
pip install -e ./
# Install rsconnect-python with a symbolic link to the locations repository,
# meaning any changes to code in there will automatically be reflected.
# Also install dev/test dependencies.
pip install -e '.[test]'
```

## Workflow
Expand All @@ -46,8 +45,8 @@ make test
make all-tests
```

As another example, the [`test` job in the default GitHub Actions workflow](.github/workflows/main.yml)
uses some of these targets during the CI for building and testing.
As another example, the [`test` job in the default GitHub Actions workflow](.github/workflows/main.yml)
uses some of these targets during the CI for building and testing.

## Proposing Change

Expand Down Expand Up @@ -82,7 +81,7 @@ a release will be created and published to the repository

rsconnect-python exists on conda-forge as its own [feedstock](https://github.com/conda-forge/rsconnect-python-feedstock)

Updating the package requires a fork of the repository and a [push request](https://github.com/conda-forge/rsconnect-python-feedstock#updating-rsconnect-python-feedstock).
Updating the package requires a fork of the repository and a [push request](https://github.com/conda-forge/rsconnect-python-feedstock#updating-rsconnect-python-feedstock).

- For new version/release, update the [meta.yaml](https://github.com/conda-forge/rsconnect-python-feedstock/blob/master/recipe/meta.yaml) file with the new version number, source url, and corresponding checksum.

Expand Down
1 change: 0 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,4 @@ FROM ${BASE_IMAGE}

WORKDIR /rsconnect
COPY scripts/build-image build-image
COPY requirements.txt requirements.txt
RUN bash build-image && rm -vf build-image
19 changes: 6 additions & 13 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
VERSION := $(shell python setup.py --version)
VERSION := $(shell python -m setuptools_scm)
HOSTNAME := $(shell hostname)
S3_PREFIX := s3://rstudio-connect-downloads/connect/rsconnect-python

Expand Down Expand Up @@ -67,13 +67,6 @@ fmt-%:
@echo ERROR: This python version cannot run the fmting tools
@exit 1

.PHONY: deps-prerelease
deps-prerelease:
pip install --pre -r requirements.txt

deps-%:
$(RUNNER) 'pip install --pre -r requirements.txt'

lint-%:
$(RUNNER) 'black --check --diff rsconnect/'
$(RUNNER) 'flake8 rsconnect/'
Expand Down Expand Up @@ -112,10 +105,6 @@ test: test-3.8
lint: RUNNER = bash -c
lint: lint-3.8

.PHONY: deps
deps: RUNNER = bash -c
deps: deps-3.8

.PHONY: fmt
fmt: RUNNER = bash -c
fmt: fmt-3.8
Expand All @@ -133,12 +122,16 @@ version:
# exported as a point of reference instead.
.PHONY: dist
dist:
python setup.py bdist_wheel
pip wheel --no-deps -w dist .
twine check $(BDIST_WHEEL)
rm -vf dist/*.egg
@echo "::set-output name=whl::$(BDIST_WHEEL)"
@echo "::set-output name=whl_basename::$(notdir $(BDIST_WHEEL))"

.PHONY: dist-install
dist-install: dist
pip install $(BDIST_WHEEL)

.PHONY: sync-to-s3
sync-to-s3:
aws s3 cp --acl bucket-owner-full-control \
Expand Down
17 changes: 7 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
# The rsconnect-python CLI

> **Warning**
> As of version 1.14.0, rsconnect-python requires Python version 3.7 or higher.
This package provides a CLI (command-line interface) for interacting
with and deploying to Posit Connect. This is also used by the
[`rsconnect-jupyter`](https://github.com/rstudio/rsconnect-jupyter) package to deploy
Expand Down Expand Up @@ -45,7 +42,7 @@ You may also build and install a wheel directly from a repository clone:
git clone https://github.com/rstudio/rsconnect-python.git
cd rsconnect-python
pip install pipenv
make deps dist
make dist
pip install ./dist/rsconnect_python-*.whl
```

Expand Down Expand Up @@ -120,7 +117,7 @@ you will need to include the `--cacert` option that points to your certificate
authority (CA) trusted certificates file. Both of these options can be saved along
with the URL and API Key for a server.

> **Note**
> **Note**
> When certificate information is saved for the server, the specified file
> is read and its _contents_ are saved under the server's nickname. If the CA file's
> contents are ever changed, you will need to add the server information again.
Expand All @@ -138,7 +135,7 @@ rsconnect add \
--name myserver
```

> **Note**
> **Note**
> The `rsconnect` CLI will verify that the serve URL and API key
> are valid. If either is found not to be, no information will be saved.
Expand Down Expand Up @@ -433,7 +430,7 @@ filename referenced in the manifest.

### Environment variables
You can set environment variables during deployment. Their names and values will be
passed to Posit Connect during deployment so you can use them in your code. Note that
passed to Posit Connect during deployment so you can use them in your code. Note that
if you are using `rsconnect` to deploy to shinyapps.io, environment variable management
is not supported on that platform.

Expand Down Expand Up @@ -988,9 +985,9 @@ xargs printf -- '-g %s\n' < guids.txt | xargs rsconnect content build add
```
## Programmatic Provisioning
Posit Connect supports the programmatic bootstrapping of an administrator API key
Posit Connect supports the programmatic bootstrapping of an administrator API key
for scripted provisioning tasks. This process is supported by the `rsconnect bootstrap` command,
which uses a JSON Web Token to request an initial API key from a fresh Connect instance.
which uses a JSON Web Token to request an initial API key from a fresh Connect instance.
> **Warning**
> This feature **requires Python version 3.6 or higher**.
Expand All @@ -1001,7 +998,7 @@ rsconnect bootstrap \
--jwt-keypath /path/to/secret.key
```
A full description on how to use `rsconnect bootstrap` in a provisioning workflow is provided in the Connect administrator guide's
A full description on how to use `rsconnect bootstrap` in a provisioning workflow is provided in the Connect administrator guide's
[programmatic provisioning](https://docs.posit.co/connect/admin/programmatic-provisioning) documentation.
## Server Administration Tasks
Expand Down
Loading

0 comments on commit c16c9b1

Please sign in to comment.