* feat(rpc): safe for python api
* refactor: use enum for smt query type
* Update cryptol-remote-api/python/cryptol/__init__.py
Co-authored-by: Ryan Scott <ryan.gl.scott@gmail.com>
* Update cryptol-remote-api/python/cryptol/__init__.py
Co-authored-by: Ryan Scott <ryan.gl.scott@gmail.com>
Co-authored-by: Ryan Scott <ryan.gl.scott@gmail.com>
Now, a single solver instance is used for the entire server.
Questions/TODO:
1. Will this cause problems with concurrent clients?
2. There doesn't seem to be any way to do cleanup actions when
the server is shut down, so the solver will not be shut down
gracefully. Is this a problem?
This upgrades `mypy` to version `0.812`. This is primarily motivated by a need
to work around python-poetry/poetry#3094, which currently happens if you try to
include the SAW Python bindings in a `poetry` project as a `develop`
dependency. For the most part, this is a matter of adjusting version bounds.
In a handful of cases, we are able to remove `type: ignore` comments due to
`mypy-0.8` being smarter than `mypy-0.7`.
A handful of tweaks needed to make `cryptol-remote-api`'s Python code
`mypy`-clean:
* `__del__` needs an explicit `-> None` return type.
* `BitVector` has no type annotations, so `type: ignore` it.
While I was in town, I:
* Made sure that running `mypy` is a part of CI.
* Added a `pyproject.toml` file for running Python-related commands with
`poetry`, much like we have in `saw-remote-api`.
* Limitations:
Does not work in combination parameterized modules, as I am
about to redo how that works.
* General refeactorings:
* Namespaces:
- We have an explicit type for namespaces, see `Cryptol.Util.Ident`
- Display environments should now be aware of the namespace of the
name being displayed.
* Renamer:
- Factor out the renamer monad and error type into separate modules
- All name resultion is done through a single function `resolveName`
- The renamer now computes the dependencies between declarations,
orders things in dependency order, and checks for bad recursion.
* Typechecker: Redo checking of declarations (both top-level and local).
Previously we used a sort of CPS to add things in scope. Now we use
a state monad and add things to the state. We assume that the renamer
has been run, which means that declarations are ordered in dependency
order, and things have unique name, so we don't need to worry about
scoping too much.
* Change specific to nested modules:
- We have a new namespace for module names
- The interface file of a module contains the interfaces for nested modules
- Most of the changes related to nested modules in the renamer are
in `ModuleSystem.NamingEnv` and `ModuleSystem.Rename`
- There is some trickiness when resolving module names when importing
submodules (seed `processOpen` and `openLoop`)
- There are some changes to the representation of modules in the typechecked
syntax, in particular:
- During type-checking we "flatten" nested module declarations into
a single big declaration. Hopefully, this means that passes after
the type checker don't need to worry about nested modules
- There is a new field containing the interfaces of the nested modules,
this is needed so that when we import the module we know we have the
nested structure
- Declarations in functor/parameterzied modules do not appear in the
flattened list of declarations. Instead thouse modules are collected
in a separate field, and the plan is that they would be used from
there when we implmenet functor instantiation.