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 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())