-
Notifications
You must be signed in to change notification settings - Fork 2
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
Update toolchain to uv; add more linting #3
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
3.12 |
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# CDN Maintenance Toggle script | ||
# CDN maintenance toggle script | ||
|
||
This script disables/enables CDN services operating on AWS Cloudfront by | ||
setting them into maintenance mode, implemented as a Cloudfront edge function | ||
|
@@ -14,31 +14,33 @@ Features include: | |
|
||
For more details, run the script with the `--help` option. | ||
|
||
## Setup & Usage for Linux Foundation / LFX sites | ||
## Setup & usage for Linux Foundation / LFX sites | ||
|
||
Recommend installation is via a pipenv-managed virtualenv, and pyenv to install | ||
the supported Python release if your system doesn't have Python 3.11. | ||
Recommend installation is via a `uv` virtualenv, and `pyenv` to install the | ||
supported Python release. | ||
|
||
Be sure to set `AWS_PROFILE` with MFA and/or SSO authentication helpers before | ||
running the script. | ||
The script relies on the environment to provide AWS authentication and | ||
determine which account to connect to. Export the `AWS_PROFILE` environment | ||
variable, or run the script with `aws-vault`, depending on your setup. | ||
|
||
```bash | ||
pyenv install 3.11 | ||
pipenv install | ||
pipenv shell | ||
pyenv install 3.12 # or: brew install [email protected]; brew pyenv-sync | ||
make sync # requires `uv` to be installed | ||
source .venv/bin/activate | ||
./cdn_maintenance_toggle.py --template lfx-maintenance.html -v --disable-sites "*.platform.linuxfoundation.org" "*.lfx.dev" | ||
./cdn_maintenance_toggle.py -v --enable-sites "*.platform.linuxfoundation.org" "*.lfx.dev" | ||
./cdn_maintenance_toggle.py --cleanup | ||
deactivate | ||
``` | ||
|
||
Alternativelly, you can install the required Python packages system-wide or to | ||
the current user. This tool has been developed against Python 3.11 and may not | ||
the current user. This tool has been developed against Python 3.12 and may not | ||
work on other versions. | ||
|
||
```bash | ||
pip3.11 install --user boto3 trieregex | ||
pip install --user boto3 trieregex | ||
# Optional: to set AWS_PROFILE or other parameters via .env: | ||
# pip3.11 install --user python-dotenv | ||
# pip install --user python-dotenv | ||
Comment on lines
-39
to
+43
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If the user has the .venv setup and got the packages installed via the
If you wanted to be sure the end user has those packages installed in the venv, they can do it through the
|
||
./cdn_maintenance_toggle.py --template lfx-maintenance.html -v --disable-sites "*.platform.linuxfoundation.org" "*.lfx.dev" | ||
./cdn_maintenance_toggle.py -v --enable-sites "*.platform.linuxfoundation.org" "*.lfx.dev" | ||
./cdn_maintenance_toggle.py --cleanup | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Copyright The Linux Foundation and each contributor to LFX. | ||
# SPDX-License-Identifier: MIT | ||
|
||
[project] | ||
name = "cdn-maintenance-toggle" | ||
version = "0.0.1" | ||
requires-python = ">=3.12" | ||
|
||
[tool.isort] | ||
profile = "black" | ||
|
||
[tool.ruff] | ||
target-version = "py312" | ||
# For linting only; not intended for `ruff format`. | ||
line-length = 100 | ||
|
||
[tool.ruff.lint] | ||
select = ["E", "F", "UP", "B", "G", "I", "ANN"] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
boto3 | ||
botocore | ||
python-dotenv | ||
trieregex |
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is slightly redundant since the
uv venv
step will see the.python-version
and grab auv
managed Python with the correct version (and doesn't need that version on the system to be installed):