phisql 1.2.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- phisql/__init__.py +58 -0
- phisql/__main__.py +21 -0
- phisql/_data/schema/1.2.0/schema.json +2042 -0
- phisql/_data/spec/v1.0/catalog/entity-types.yaml +200 -0
- phisql/_data/spec/v1.0/catalog/findings.yaml +107 -0
- phisql/_data/spec/v1.0/catalog/keywords.yaml +94 -0
- phisql/_data/spec/v1.0/catalog/policy.yaml +58 -0
- phisql/_data/spec/v1.0/catalog/predicates.yaml +44 -0
- phisql/_data/spec/v1.0/catalog/sources.yaml +75 -0
- phisql/_data/spec/v1.0/catalog/strategies.yaml +155 -0
- phisql/_data/spec/v1.0/catalog/validators.yaml +105 -0
- phisql/_generated/PhiSQLLexer.py +485 -0
- phisql/_generated/PhiSQLListener.py +498 -0
- phisql/_generated/PhiSQLParser.py +4302 -0
- phisql/_generated/PhiSQLVisitor.py +283 -0
- phisql/_generated/__init__.py +23 -0
- phisql/_paths.py +80 -0
- phisql/ast.py +220 -0
- phisql/catalog.py +146 -0
- phisql/cli.py +94 -0
- phisql/compiler.py +580 -0
- phisql/errors.py +26 -0
- phisql/parser.py +300 -0
- phisql/phisql.py +34 -0
- phisql/policy_schema.py +86 -0
- phisql-1.2.0.dist-info/METADATA +210 -0
- phisql-1.2.0.dist-info/RECORD +31 -0
- phisql-1.2.0.dist-info/WHEEL +5 -0
- phisql-1.2.0.dist-info/entry_points.txt +2 -0
- phisql-1.2.0.dist-info/licenses/LICENSE +190 -0
- phisql-1.2.0.dist-info/top_level.txt +1 -0
phisql/__init__.py
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# Copyright 2026 Philterd, LLC.
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
"""
|
|
15
|
+
PhiSQL reference implementation (Python).
|
|
16
|
+
|
|
17
|
+
The parser is generated from ``spec/v1.0/grammar/PhiSQL.g4`` with ANTLR (see
|
|
18
|
+
``phisql._generated``) and the compiler is driven by the catalog files under
|
|
19
|
+
``spec/v1.0/catalog/``. This package is a sibling of the Java reference
|
|
20
|
+
implementation and produces the same Phileas JSON output.
|
|
21
|
+
|
|
22
|
+
Quick start::
|
|
23
|
+
|
|
24
|
+
from phisql import Compiler
|
|
25
|
+
|
|
26
|
+
result = Compiler().compile("POLICY ssn_only; REDACT SSN WITH MASK;")
|
|
27
|
+
print(result.policy_name()) # "ssn_only"
|
|
28
|
+
print(result.to_json_string()) # Phileas JSON policy
|
|
29
|
+
"""
|
|
30
|
+
|
|
31
|
+
from .catalog import Catalog
|
|
32
|
+
from .compiler import Compiler, CompileResult
|
|
33
|
+
from .errors import CompileException, ParseException
|
|
34
|
+
from .phisql import parse
|
|
35
|
+
from .policy_schema import (
|
|
36
|
+
SUPPORTED_SCHEMA_VERSION,
|
|
37
|
+
PolicySchema,
|
|
38
|
+
get_schema,
|
|
39
|
+
get_schema_dict,
|
|
40
|
+
get_supported_schema_version,
|
|
41
|
+
)
|
|
42
|
+
|
|
43
|
+
__version__ = "1.2.0"
|
|
44
|
+
|
|
45
|
+
__all__ = [
|
|
46
|
+
"Catalog",
|
|
47
|
+
"Compiler",
|
|
48
|
+
"CompileResult",
|
|
49
|
+
"CompileException",
|
|
50
|
+
"ParseException",
|
|
51
|
+
"parse",
|
|
52
|
+
"PolicySchema",
|
|
53
|
+
"get_schema",
|
|
54
|
+
"get_schema_dict",
|
|
55
|
+
"get_supported_schema_version",
|
|
56
|
+
"SUPPORTED_SCHEMA_VERSION",
|
|
57
|
+
"__version__",
|
|
58
|
+
]
|
phisql/__main__.py
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# Copyright 2026 Philterd, LLC.
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
"""Enables ``python -m phisql <file.phisql>``."""
|
|
15
|
+
|
|
16
|
+
import sys
|
|
17
|
+
|
|
18
|
+
from .cli import main
|
|
19
|
+
|
|
20
|
+
if __name__ == "__main__":
|
|
21
|
+
sys.exit(main())
|