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
4 changes: 2 additions & 2 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
version: 2
updates:
- package-ecosystem: "pip"
- package-ecosystem: "uv"
directory: "/"
schedule:
interval: "monthly"
groups:
pip:
uv:
patterns: ["*"]
- package-ecosystem: "github-actions"
directory: "/"
Expand Down
15 changes: 11 additions & 4 deletions .github/workflows/bump-version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,24 @@ name: Bump Version
on:
workflow_dispatch:

permissions:
contents: read

jobs:
bump-version:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
ref: master
- uses: astral-sh/setup-uv@3259c6206f993105e3a61b142c2d97bf4b9ef83d # v7.1.0
with:
activate-environment: true

- name: Bump version
run: |
version_file="cloudsplaining/bin/version.py"

# https://github.com/bridgecrewio/checkov/blob/master/.github/workflows/build.yml#L87-L132
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
Expand All @@ -25,6 +31,7 @@ jobs:
new_tag=$(echo "$latest_tag" | awk -F. -v a="$1" -v b="$2" -v c="$3" '{printf("%d.%d.%d", $1+a, $2+b , $3+1)}')
echo "new tag: $new_tag"

printf "# pylint: disable=missing-module-docstring\n__version__ = \"%s\"\n""" "$new_tag" > $version_file
git commit -m "Bump to ${new_tag}" $version_file || echo "No changes to commit"
uv version --offline "$new_tag"

git commit -m "Bump to ${new_tag}" pyproject.toml uv.lock || echo "No changes to commit"
git push origin
45 changes: 17 additions & 28 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,47 +15,35 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0

- name: Setup Python
uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0
- uses: astral-sh/setup-uv@3259c6206f993105e3a61b142c2d97bf4b9ef83d # v7.1.0
with:
python-version-file: '.python-version'

- name: Install dependencies
run: |
make setup-dev
activate-environment: true
- run: uv sync --frozen

- name: Install the package to make sure nothing is randomly broken
run: |
make install

run: make build
- name: Run pytest (unit tests)
run: |
make test
run: make test


publish-package:
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- name: Set up Python
uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0
- uses: astral-sh/setup-uv@3259c6206f993105e3a61b142c2d97bf4b9ef83d # v7.1.0
with:
python-version-file: '.python-version'
activate-environment: true
- run: uv sync --frozen

- name: Install dependencies
run: |
pip install -r requirements.txt
pip install -r requirements-dev.txt
- name: create python package
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git fetch --tags
git pull origin master
pip install setuptools wheel twine
python -m setup sdist bdist_wheel

uv build
- name: Publish package
uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # v1.13.0
with:
Expand All @@ -68,8 +56,7 @@ jobs:
contents: write
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- name: Set up Python
uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0
- uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0
with:
python-version-file: '.python-version'
- name: publish brew
Expand Down Expand Up @@ -98,11 +85,12 @@ jobs:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
ref: master
- uses: astral-sh/setup-uv@3259c6206f993105e3a61b142c2d97bf4b9ef83d # v7.1.0
with:
activate-environment: true

- name: Bump version
run: |
version_file="cloudsplaining/bin/version.py"

# https://github.com/bridgecrewio/checkov/blob/master/.github/workflows/build.yml#L87-L132
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
Expand All @@ -113,6 +101,7 @@ jobs:
new_tag=$(echo "$latest_tag" | awk -F. -v a="$1" -v b="$2" -v c="$3" '{printf("%d.%d.%d", $1+a, $2+b , $3+1)}')
echo "new tag: $new_tag"

printf "# pylint: disable=missing-module-docstring\n__version__ = \"%s\"\n""" "$new_tag" > $version_file
git commit -m "Bump to ${new_tag}" $version_file || echo "No changes to commit"
uv version --offline "$new_tag"

git commit -m "Bump to ${new_tag}" pyproject.toml uv.lock || echo "No changes to commit"
git push origin
38 changes: 11 additions & 27 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,27 +32,17 @@ jobs:
timeout-minutes: 15
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0

- name: Setup Python
uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0
- uses: astral-sh/setup-uv@3259c6206f993105e3a61b142c2d97bf4b9ef83d # v7.1.0
with:
python-version-file: '.python-version'

- name: Install dependencies
run: |
make setup-dev
activate-environment: true
- run: uv sync --frozen

- name: Install the package to make sure nothing is randomly broken
run: |
make install

run: make build
- name: Run pytest (unit tests)
run: |
make test

run: make test
- name: Run mypy (static type check)
run: |
make type-check
run: make type-check

python-version:
needs: prek
Expand All @@ -65,19 +55,13 @@ jobs:
python: ['3.11', '3.12', '3.13', '3.14']
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0
- uses: astral-sh/setup-uv@3259c6206f993105e3a61b142c2d97bf4b9ef83d # v7.1.0
with:
python-version: ${{ matrix.python }}
allow-prereleases: true

- name: Install dependencies
run: |
make setup-dev
activate-environment: true
- run: uv sync --frozen

- name: Install the package to make sure nothing is randomly broken
run: |
make install

run: make build
- name: Run pytest (unit tests)
run: |
make test
run: make test
15 changes: 3 additions & 12 deletions .github/workflows/update-bundle-report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,15 @@ on:
permissions:
contents: read

env:
MIN_PYTHON_VERSION: "3.10"

jobs:
update:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0

- name: Setup python
uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0
- uses: astral-sh/setup-uv@3259c6206f993105e3a61b142c2d97bf4b9ef83d # v7.1.0
with:
python-version-file: '.python-version'

- name: Install dependencies
run: |
pip install -r requirements.txt
pip install -r requirements-dev.txt
activate-environment: true
- run: uv sync --frozen

- name: Update the JavaScript bundle
run: |
Expand Down
11 changes: 0 additions & 11 deletions .pyup.yml

This file was deleted.

7 changes: 0 additions & 7 deletions MANIFEST.in

This file was deleted.

50 changes: 19 additions & 31 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,41 +1,30 @@
SHELL:=/bin/bash

PROJECT := cloudsplaining
PROJECT_UNDERSCORE := cloudsplaining

virtualenv:
python3 -m venv ./venv && source venv/bin/activate

setup-env: virtualenv
python3 -m pip install -r requirements.txt

setup-dev: setup-env
python3 -m pip install -r requirements-dev.txt
setup-env:
uv sync --frozen

# Create the documentation files and open them locally
build-docs: clean virtualenv
build-docs: clean
mkdocs build

# Serve the docs locally as you edit them
serve-docs: clean virtualenv
serve-docs: clean
mkdocs serve --dev-addr "127.0.0.1:8001"

# Build the cloudsplaining package from the current directory contents for use with PyPi
build: setup-env clean
python3 -m pip install --upgrade setuptools wheel
python3 -m setup -q sdist bdist_wheel
uv build

# Install the package locally
install: build
python3 -m pip install -q ./dist/${PROJECT}*.tar.gz
uv pip install -q ./dist/${PROJECT}*.tar.gz
${PROJECT} --help

# Uninstall the package
uninstall: virtualenv
python3 -m pip uninstall ${PROJECT} -y
python3 -m pip uninstall -r requirements.txt -y
python3 -m pip uninstall -r requirements-dev.txt -y
python3 -m pip freeze | xargs python3 -m pip uninstall -y
uninstall:
uv pip uninstall ${PROJECT} -y

# Clean the directory of extra python files
clean:
Expand All @@ -49,18 +38,17 @@ clean:
find . -name '*.pyo' -exec rm --force {} +

# Run unit tests
test: setup-dev
python3 -m coverage run -m pytest -v
python3 -m coverage report -m
test: setup-env
coverage run -m pytest -v
coverage report -m

type-check: setup-dev
type-check: setup-env
mypy

# Publish to PyPi
publish: build
python3 -m pip install --upgrade twine
python3 -m twine upload dist/*
python3 -m pip install ${PROJECT}
uv publish
uv pip install ${PROJECT}

# count lines of code
count-loc:
Expand All @@ -70,8 +58,8 @@ count-loc:

# Generate the example report
generate-report:
python3 ./utils/generate_example_iam_data.py
python3 ./utils/generate_example_report.py
python ./utils/generate_example_iam_data.py
python ./utils/generate_example_report.py
# ---------------------------------------------------------------------------------------------------------------------
# JavaScript
# ---------------------------------------------------------------------------------------------------------------------
Expand All @@ -89,7 +77,7 @@ install-js-production: clean-js

# Generate the updated Javascript bundle
build-js: setup-env install-js-production
python3 ./utils/generate_example_iam_data.py
python ./utils/generate_example_iam_data.py
npm run build

# Run Javascript unit tests
Expand All @@ -104,8 +92,8 @@ serve-js: install-js-production

# Update Homebrew file. Does not commit to Git
update-homebrew-file: uninstall
python3 -m pip install homebrew-pypi-poet
python3 -m pip install cloudsplaining -U
uv pip install homebrew-pypi-poet
uv pip install cloudsplaining -U
git fetch origin
latest_tag := $(git describe --tags `git rev-list --tags --max-count=1`)
echo "latest tag: $latest_tag"
Expand Down
9 changes: 7 additions & 2 deletions cloudsplaining/bin/version.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,7 @@
# pylint: disable=missing-module-docstring
__version__ = "0.8.3"
import importlib.metadata

try:
__version__ = importlib.metadata.version("cloudsplaining")
except Exception:
# needed for local dev
__version__ = "0.0.0"
5 changes: 2 additions & 3 deletions docs/contributing/documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ get set up with Mkdocs, our documentation tool. First you will want to
make sure you have a few things on your local system:

- python-dev (if you're on OS X, you already have this)
- pip
- [uv](https://docs.astral.sh/uv/getting-started/installation/)

Once you've got all that, the rest is simple:

Expand All @@ -17,8 +17,7 @@ git clone git@github.com:salesforce/cloudsplaining.git

# Set up the virtual environment
python3 -m venv ./venv && source venv/bin/activate
pip3 install -r requirements.txt
pip3 install -r requirements-dev.txt
uv sync --frozen

# Create the HTML files
make build-docs
Expand Down
Loading