Skip to content

Commit

Permalink
Merge branch 'master' into dependabot/go_modules/tools/google.golang.…
Browse files Browse the repository at this point in the history
…org/protobuf-1.33.0
  • Loading branch information
kapilt committed May 21, 2024
2 parents 554899a + a34cd40 commit 411e068
Show file tree
Hide file tree
Showing 18 changed files with 1,331 additions and 232 deletions.
44 changes: 32 additions & 12 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ name: "CI"
on:
push:
pull_request:
env:
POETRY_VERSION: "1.8.3"
DEFAULT_PY_VERSION: "3.12"

jobs:
Lint:
Expand All @@ -11,25 +14,37 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-python@v1
with:
python-version: 3.8
python-version: ${{ env.DEFAULT_PY_VERSION }}
- name: Linting
env:
RUFF_OUTPUT_FORMAT: github
run: |
pip install pre-commit
pre-commit run --all-files
pip install ruff
ruff check src
Tests:
needs: Lint
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.7, 3.8]
include:
- python-version: 3.7
tox-target: py37
- python-version: 3.8
- python-version: "3.8"
tox-target: py38
- python-version: "3.9"
tox-target: py39
- python-version: "3.10"
tox-target: py310
- python-version: "3.11"
tox-target: py311
- python-version: "3.12"
tox-target: py312

steps:
- uses: actions/checkout@v2
- name: Install poetry
shell: bash
run: pipx install poetry==${{ env.POETRY_VERSION }}

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
Expand All @@ -53,16 +68,21 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install poetry
shell: bash
run: pipx install poetry==${{ env.POETRY_VERSION }}

- uses: actions/setup-python@v1
with:
python-version: 3.8
python-version: ${{ env.DEFAULT_PY_VERSION }}

- name: Install Test Runner
run: |
python -m pip install --upgrade pip
pip install tox
- name: Coverage Create and Upload XML
run: |
tox -e lint && \
bash <(curl -s https://codecov.io/bash) -Z -v -f coverage.xml
- name: Upload Code Coverage
uses: codecov/codecov-action@v4
with:
files: ./coverage.xml
name: codecov
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -128,3 +128,6 @@ dmypy.json
# Pyre type checker
.pyre/
type_check/lineprecision.txt

# PyCharm Stuff
.idea/*
31 changes: 0 additions & 31 deletions .pre-commit-config.yaml

This file was deleted.

14 changes: 6 additions & 8 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,18 @@
cel-python
##########

.. image:: https://img.shields.io/pypi/v/cel-python.svg
:target: https://pypi.org/projects/cel-python/
:alt: PyPI: cel-python

.. image:: https://travis-ci.org/cloud-custodian/cel-python.svg?branch=master
:target: https://travis-ci.org/cloud-custodian/cel-python
:alt: Travis Build Status

.. image:: https://requires.io/github/cloud-custodian/cel-python/requirements.svg?branch=master
:target: https://requires.io/github/cloud-custodian/cel-python/requirements/?branch=master
:alt: Requirements Status
.. image:: https://github.com/cloud-custodian/cel-python/workflows/CI/badge.svg
:target: https://github.com/cloud-custodian/cel-python/actions
:alt: GitHub Actions Build Status

.. image:: https://img.shields.io/badge/license-Apache%202-blue.svg
:target: https://www.apache.org/licenses/LICENSE-2.0
:alt: Apache License


Pure Python implementation of Google Common Expression Language, https://opensource.google/projects/cel.

The Common Expression Language (CEL) implements common semantics for expression evaluation,
Expand Down
2 changes: 1 addition & 1 deletion docs/source/integration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,7 @@ The ``cel_program`` in the above example is an executable CEL program wrapped in
... ast = self.env.compile(object["expr"])
... self.prgm = self.env.program(ast, cel_functions)
... def __call__(self, resource):
... now = datetime.datetime.utcnow()
... now = datetime.datetime.now(tz=datetime.timezone.utc)
... activation = {"resource": celpy.json_to_cel(resource), "now": celpy.celtypes.TimestampType(now)}
... return bool(self.prgm.evaluate(activation))

Expand Down
Loading

0 comments on commit 411e068

Please sign in to comment.