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
43 changes: 9 additions & 34 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v1

- uses: astral-sh/setup-uv@v6
with:
python-version: ${{ env.DEFAULT_PY_VERSION }}
- name: Linting
env:
RUFF_OUTPUT_FORMAT: github
run: |
pip install ruff
ruff check src

- run: uv run tox -e lint

Tests:
needs: Lint
Expand All @@ -41,48 +38,26 @@ jobs:

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
- uses: astral-sh/setup-uv@v6
with:
python-version: ${{ matrix.python-version }}

- name: Install Test Runner
run: |
python -m pip install --upgrade pip
pip install tox

- name: Install Deps
run: |
tox -e ${{ matrix.tox-target }} --notest

- name: Test
run: |
tox -e ${{ matrix.tox-target }}
- run: uv run tox -e ${{ matrix.tox-target }}

Coverage:
needs: Tests
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
- uses: astral-sh/setup-uv@v6
with:
python-version: ${{ env.DEFAULT_PY_VERSION }}

- name: Install Test Runner
run: |
python -m pip install --upgrade pip
pip install tox
- run: uv run tox -e lint

- name: Upload Code Coverage
uses: codecov/codecov-action@v4
- uses: codecov/codecov-action@v4
with:
files: ./coverage.xml
name: codecov
108 changes: 85 additions & 23 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,45 +13,107 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and limitations under the License.

# Tools require GO. Typically, the following kinds of setup is required.
# export PATH="/usr/local/go/bin:/usr/local/bin:$PATH"
# export GOPATH="~/go"
HELP_TEXT := ""
HELP_TEXT += "Available commands:\n"

.PHONY: help
help:
@echo $(HELP_TEXT)

HELP_TEXT += " build runs ``uv build`` to create a distribution kit\n"
.PHONY: build
build:
uv build

install-tools:
cd tools && docker pull golang && docker build -t mkgherkin .
HELP_TEXT += " build-all alias of build, conformance, and docs\n"
.PHONY: build-all
build-all:
$(MAKE) build
$(MAKE) conformance
$(MAKE) docs

test:
cd features && $(MAKE) all
tox run -e py312
HELP_TEXT += "\n"

test-all:
cd features && $(MAKE) all
tox run
HELP_TEXT += " test runs the Python 3.12 test environment to execute a quick test\n"
.PHONY: test
test: conformance
uv run tox run -e py312

HELP_TEXT += " test-all runs the full test suite\n"
.PHONY: test-all
test-all: conformance
uv run tox run

test-wip:
HELP_TEXT += " test-<env> runs tests for any of the available tox environments:\n"
HELP_TEXT += "\n$$(uv run tox list | awk '{ print " " $$0 }')\n"
.PHONY: test-%
test-%: conformance
uv run tox run -e $*

HELP_TEXT += "\n"

HELP_TEXT += " conformance generates conformance tests\n"
.PHONY: conformance
conformance:
cd features && $(MAKE) all
tox run -e wip

test-tools:
tox run -e tools
cd features && $(MAKE) scan
HELP_TEXT += " conf-clean cleans generated conformance tests\n"
.PHONY: conf-clean
conf-clean:
cd features && $(MAKE) clean

HELP_TEXT += "\n"

HELP_TEXT += " docs generates HTML documentation\n"
.PHONY: docs
docs: $(wildcard docs/source/*.rst)
PYTHONPATH=src python -m doctest docs/source/*.rst
export PYTHONPATH=$(PWD)/src:$(PWD)/tools && cd docs && $(MAKE) html
$(MAKE) docs-lint
cd docs && $(MAKE) html

HELP_TEXT += " docs-clean lints documentation sources\n"
.PHONY: docs-lint
docs-lint:
uv run python -m doctest docs/source/*.rst

HELP_TEXT += " docs-clean cleans generated HTML documentation\n"
.PHONY: docs-clean
docs-clean:
cd docs && $(MAKE) clean

HELP_TEXT += "\n"

HELP_TEXT += " lint runs code coverage, type hint checking, and other lint checks\n"
HELP_TEXT += " (alias of test-lint)\n"
.PHONY: lint
lint:
tox run -e lint
uv run tox run -e lint

HELP_TEXT += "\n"

HELP_TEXT += " format runs code formatting\n"
.PHONY: format
format:
uv run ruff format src tools

HELP_TEXT += " coverage generates code coverage reports\n"
.PHONY: coverage
coverage:
coverage report -m
uv run tox run -e coverage

HELP_TEXT += " clean cleans all content ignored by git\n"
.PHONY: clean
clean:
rm -rf .tox .Python bin include lib pip-selfcheck.json
git clean -Xfd

HELP_TEXT += " clean-all alias of clean, conformance-clean, and docs-clean\n"
.PHONY: clean-all
clean-all:
$(MAKE) clean
$(MAKE) test-clean
$(MAKE) docs-clean

HELP_TEXT += " benchmarks runs performance benchmarks\n"
.PHONY: benchmarks
benchmarks:
PYTHONPATH=src python benches/large_resource_set.py TagAssetBenchmark
PYTHONPATH=src python benches/complex_expression.py
PYTHONPATH=src uv run python benches/large_resource_set.py TagAssetBenchmark
PYTHONPATH=src uv run python benches/complex_expression.py
6 changes: 5 additions & 1 deletion docs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@
# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SPHINXBUILD ?= uv run sphinx-build
SOURCEDIR = source
BUILDDIR = build

export GRAPHVIZ_DOT ?= $(shell which dot)

# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
Expand All @@ -20,4 +22,6 @@ help:
# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@which java || (>&2 echo "Building docs requires java" ; exit 1)
@which dot || (>&2 echo "Building docs requires graphviz (specifically, the dot executable)" ; exit 1)
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
Binary file modified docs/build/doctrees/api.doctree
Binary file not shown.
Binary file modified docs/build/doctrees/c7n_functions.doctree
Binary file not shown.
Binary file modified docs/build/doctrees/cli.doctree
Binary file not shown.
Binary file modified docs/build/doctrees/configuration.doctree
Binary file not shown.
Binary file modified docs/build/doctrees/environment.pickle
Binary file not shown.
Binary file modified docs/build/doctrees/index.doctree
Binary file not shown.
Binary file modified docs/build/doctrees/installation.doctree
Binary file not shown.
Binary file modified docs/build/doctrees/integration.doctree
Binary file not shown.
Binary file modified docs/build/doctrees/structure.doctree
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/build/html/.buildinfo
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Sphinx build info version 1
# This file records the configuration used when building these files. When it is not found, a full rebuild will be done.
config: 3f3e9d6f3a661b200fa79b5036f419ce
config: da3100d0b8694a80ddf5225b78156ac2
tags: 645f666f9bcd5a90fca523b33c5a78b7
4 changes: 0 additions & 4 deletions docs/build/html/.buildinfo.bak

This file was deleted.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions docs/build/html/_modules/celpy/__init__.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>celpy.__init__ &#8212; CEL in Python documentation</title>
<link rel="stylesheet" type="text/css" href="../../_static/pygments.css?v=5ecbeea2" />
<link rel="stylesheet" type="text/css" href="../../_static/basic.css?v=b08954a9" />
<link rel="stylesheet" type="text/css" href="../../_static/basic.css?v=686e5160" />
<link rel="stylesheet" type="text/css" href="../../_static/alabaster.css?v=27fed22d" />
<script src="../../_static/documentation_options.js?v=5929fcd5"></script>
<script src="../../_static/doctools.js?v=9bcbadda"></script>
Expand Down Expand Up @@ -497,7 +497,7 @@ <h3>Related Topics</h3>
&#169;2020, CapitalOne.

|
Powered by <a href="https://www.sphinx-doc.org/">Sphinx 8.2.3</a>
Powered by <a href="https://www.sphinx-doc.org/">Sphinx 8.1.3</a>
&amp; <a href="https://alabaster.readthedocs.io">Alabaster 1.0.0</a>

</div>
Expand Down
16 changes: 9 additions & 7 deletions docs/build/html/_modules/celpy/__main__.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>celpy.__main__ &#8212; CEL in Python documentation</title>
<link rel="stylesheet" type="text/css" href="../../_static/pygments.css?v=5ecbeea2" />
<link rel="stylesheet" type="text/css" href="../../_static/basic.css?v=b08954a9" />
<link rel="stylesheet" type="text/css" href="../../_static/basic.css?v=686e5160" />
<link rel="stylesheet" type="text/css" href="../../_static/alabaster.css?v=27fed22d" />
<script src="../../_static/documentation_options.js?v=5929fcd5"></script>
<script src="../../_static/doctools.js?v=9bcbadda"></script>
Expand Down Expand Up @@ -68,9 +68,9 @@ <h1>Source code for celpy.__main__</h1><div class="highlight"><pre>
<span class="kn">from</span><span class="w"> </span><span class="nn">typing</span><span class="w"> </span><span class="kn">import</span> <span class="n">Any</span><span class="p">,</span> <span class="n">Callable</span><span class="p">,</span> <span class="n">Dict</span><span class="p">,</span> <span class="n">List</span><span class="p">,</span> <span class="n">Optional</span><span class="p">,</span> <span class="n">Tuple</span><span class="p">,</span> <span class="n">Union</span><span class="p">,</span> <span class="n">cast</span>

<span class="k">try</span><span class="p">:</span>
<span class="kn">import</span><span class="w"> </span><span class="nn">tomllib</span>
<span class="kn">import</span><span class="w"> </span><span class="nn">tomllib</span> <span class="c1"># type: ignore [import-not-found, unused-ignore]</span>
<span class="k">except</span> <span class="ne">ImportError</span><span class="p">:</span> <span class="c1"># pragma: no cover</span>
<span class="kn">import</span><span class="w"> </span><span class="nn">tomli</span><span class="w"> </span><span class="k">as</span><span class="w"> </span><span class="nn">tomllib</span> <span class="c1"># type: ignore [no-redef]</span>
<span class="kn">import</span><span class="w"> </span><span class="nn">tomli</span><span class="w"> </span><span class="k">as</span><span class="w"> </span><span class="nn">tomllib</span> <span class="c1"># type: ignore [no-redef, import-not-found, unused-import, unused-ignore]</span>

<span class="kn">from</span><span class="w"> </span><span class="nn">celpy</span><span class="w"> </span><span class="kn">import</span> <span class="n">Environment</span><span class="p">,</span> <span class="n">Runner</span><span class="p">,</span> <span class="n">celtypes</span>
<span class="kn">from</span><span class="w"> </span><span class="nn">celpy.adapter</span><span class="w"> </span><span class="kn">import</span> <span class="n">CELJSONDecoder</span><span class="p">,</span> <span class="n">CELJSONEncoder</span>
Expand Down Expand Up @@ -328,13 +328,15 @@ <h1>Source code for celpy.__main__</h1><div class="highlight"><pre>
<span class="k">try</span><span class="p">:</span>
<span class="n">extra</span> <span class="o">=</span> <span class="p">{</span>
<span class="s2">&quot;st_birthtime&quot;</span><span class="p">:</span> <span class="n">celtypes</span><span class="o">.</span><span class="n">TimestampType</span><span class="p">(</span>
<span class="n">datetime</span><span class="o">.</span><span class="n">datetime</span><span class="o">.</span><span class="n">fromtimestamp</span><span class="p">(</span><span class="n">status</span><span class="o">.</span><span class="n">st_birthtime</span><span class="p">)</span>
<span class="n">datetime</span><span class="o">.</span><span class="n">datetime</span><span class="o">.</span><span class="n">fromtimestamp</span><span class="p">(</span>
<span class="n">status</span><span class="o">.</span><span class="n">st_birthtime</span> <span class="c1"># type:ignore [attr-defined, unused-ignore]</span>
<span class="p">)</span>
<span class="p">),</span>
<span class="s2">&quot;st_blksize&quot;</span><span class="p">:</span> <span class="n">celtypes</span><span class="o">.</span><span class="n">IntType</span><span class="p">(</span><span class="n">status</span><span class="o">.</span><span class="n">st_blksize</span><span class="p">),</span>
<span class="s2">&quot;st_blocks&quot;</span><span class="p">:</span> <span class="n">celtypes</span><span class="o">.</span><span class="n">IntType</span><span class="p">(</span><span class="n">status</span><span class="o">.</span><span class="n">st_blocks</span><span class="p">),</span>
<span class="s2">&quot;st_flags&quot;</span><span class="p">:</span> <span class="n">celtypes</span><span class="o">.</span><span class="n">IntType</span><span class="p">(</span><span class="n">status</span><span class="o">.</span><span class="n">st_flags</span><span class="p">),</span>
<span class="s2">&quot;st_flags&quot;</span><span class="p">:</span> <span class="n">celtypes</span><span class="o">.</span><span class="n">IntType</span><span class="p">(</span><span class="n">status</span><span class="o">.</span><span class="n">st_flags</span><span class="p">),</span> <span class="c1"># type: ignore [attr-defined, unused-ignore]</span>
<span class="s2">&quot;st_rdev&quot;</span><span class="p">:</span> <span class="n">celtypes</span><span class="o">.</span><span class="n">IntType</span><span class="p">(</span><span class="n">status</span><span class="o">.</span><span class="n">st_rdev</span><span class="p">),</span>
<span class="s2">&quot;st_gen&quot;</span><span class="p">:</span> <span class="n">celtypes</span><span class="o">.</span><span class="n">IntType</span><span class="p">(</span><span class="n">status</span><span class="o">.</span><span class="n">st_gen</span><span class="p">),</span>
<span class="s2">&quot;st_gen&quot;</span><span class="p">:</span> <span class="n">celtypes</span><span class="o">.</span><span class="n">IntType</span><span class="p">(</span><span class="n">status</span><span class="o">.</span><span class="n">st_gen</span><span class="p">),</span> <span class="c1"># type: ignore [attr-defined, unused-ignore]</span>
<span class="p">}</span>
<span class="k">except</span> <span class="ne">AttributeError</span><span class="p">:</span> <span class="c1"># pragma: no cover</span>
<span class="n">extra</span> <span class="o">=</span> <span class="p">{}</span>
Expand Down Expand Up @@ -680,7 +682,7 @@ <h3>Related Topics</h3>
&#169;2020, CapitalOne.

|
Powered by <a href="https://www.sphinx-doc.org/">Sphinx 8.2.3</a>
Powered by <a href="https://www.sphinx-doc.org/">Sphinx 8.1.3</a>
&amp; <a href="https://alabaster.readthedocs.io">Alabaster 1.0.0</a>

</div>
Expand Down
4 changes: 2 additions & 2 deletions docs/build/html/_modules/celpy/adapter.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>celpy.adapter &#8212; CEL in Python documentation</title>
<link rel="stylesheet" type="text/css" href="../../_static/pygments.css?v=5ecbeea2" />
<link rel="stylesheet" type="text/css" href="../../_static/basic.css?v=b08954a9" />
<link rel="stylesheet" type="text/css" href="../../_static/basic.css?v=686e5160" />
<link rel="stylesheet" type="text/css" href="../../_static/alabaster.css?v=27fed22d" />
<script src="../../_static/documentation_options.js?v=5929fcd5"></script>
<script src="../../_static/doctools.js?v=9bcbadda"></script>
Expand Down Expand Up @@ -279,7 +279,7 @@ <h3>Related Topics</h3>
&#169;2020, CapitalOne.

|
Powered by <a href="https://www.sphinx-doc.org/">Sphinx 8.2.3</a>
Powered by <a href="https://www.sphinx-doc.org/">Sphinx 8.1.3</a>
&amp; <a href="https://alabaster.readthedocs.io">Alabaster 1.0.0</a>

</div>
Expand Down
4 changes: 2 additions & 2 deletions docs/build/html/_modules/celpy/c7nlib.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>celpy.c7nlib &#8212; CEL in Python documentation</title>
<link rel="stylesheet" type="text/css" href="../../_static/pygments.css?v=5ecbeea2" />
<link rel="stylesheet" type="text/css" href="../../_static/basic.css?v=b08954a9" />
<link rel="stylesheet" type="text/css" href="../../_static/basic.css?v=686e5160" />
<link rel="stylesheet" type="text/css" href="../../_static/alabaster.css?v=27fed22d" />
<script src="../../_static/documentation_options.js?v=5929fcd5"></script>
<script src="../../_static/doctools.js?v=9bcbadda"></script>
Expand Down Expand Up @@ -1977,7 +1977,7 @@ <h3>Related Topics</h3>
&#169;2020, CapitalOne.

|
Powered by <a href="https://www.sphinx-doc.org/">Sphinx 8.2.3</a>
Powered by <a href="https://www.sphinx-doc.org/">Sphinx 8.1.3</a>
&amp; <a href="https://alabaster.readthedocs.io">Alabaster 1.0.0</a>

</div>
Expand Down
4 changes: 2 additions & 2 deletions docs/build/html/_modules/celpy/celparser.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>celpy.celparser &#8212; CEL in Python documentation</title>
<link rel="stylesheet" type="text/css" href="../../_static/pygments.css?v=5ecbeea2" />
<link rel="stylesheet" type="text/css" href="../../_static/basic.css?v=b08954a9" />
<link rel="stylesheet" type="text/css" href="../../_static/basic.css?v=686e5160" />
<link rel="stylesheet" type="text/css" href="../../_static/alabaster.css?v=27fed22d" />
<script src="../../_static/documentation_options.js?v=5929fcd5"></script>
<script src="../../_static/doctools.js?v=9bcbadda"></script>
Expand Down Expand Up @@ -647,7 +647,7 @@ <h3>Related Topics</h3>
&#169;2020, CapitalOne.

|
Powered by <a href="https://www.sphinx-doc.org/">Sphinx 8.2.3</a>
Powered by <a href="https://www.sphinx-doc.org/">Sphinx 8.1.3</a>
&amp; <a href="https://alabaster.readthedocs.io">Alabaster 1.0.0</a>

</div>
Expand Down
Loading
Loading