Skip to main content

Migration tooling from Google App Engine (webapp2, ndb) to python-cdd supported (FastAPI, SQLalchemy).

Project description

cdd-python-gae

Python version range Python implementation License Linting, testing, coverage, and release Tested OSs, others may work Documentation coverage codecov black Imports: isort PyPi: release

Migration tooling from Google App Engine (webapp2, ndb) to python-cdd supported (FastAPI, SQLalchemy).

Public SDK works with filenames, source code, and even in memory constructs (e.g., as imported into your REPL). CLI available also.

Install package

PyPi

pip install python-cdd-gae

Master

pip install -r https://raw.githubusercontent.com/offscale/cdd-python-gae/master/requirements.txt
pip install https://api.github.com/repos/offscale/cdd-python-gae/zipball#egg=cdd

Goal

Migrate from Google App Engine to cloud-independent runtime (e.g., vanilla CPython 3.11 with SQLite).

Relation to other projects

This was created independent of cdd-python project for two reasons:

  1. Unidirectional;
  2. Relevant to fewer people.

SDK example (REPL)

To create a class from tf.keras.optimizers.Adam:

>>> from cdd.source_transformer import to_code

>>> from cdd import emit, parse

Approach

Traverse the AST for ndb and webapp2.

Advantages

Disadvantages

Alternatives

Minor other use-cases this facilitates

CLI for this project

$ python -m cdd_gae --help

usage: python -m cdd_gae [-h] [--version]
                         {ndb2sqlalchemy,webapp2_to_fastapi} ...

Migration tooling from Google App Engine (webapp2, ndb) to python-cdd
supported (FastAPI, SQLalchemy).

positional arguments:
  {ndb2sqlalchemy,webapp2_to_fastapi}
    ndb2sqlalchemy      Parse NDB emit SQLalchemy
    webapp2_to_fastapi  Parse WebApp2 emit FastAPI

options:
  -h, --help            show this help message and exit
  --version             show program's version number and exit

ndb2sqlalchemy (webapp2_to_fastapi takes same args)

$ python -m cdd_gae ndb2sqlalchemy --help

usage: python -m cdd_gae ndb2sqlalchemy [-h] -i INPUT_FILE -o OUTPUT_FILE
                                        [--dry-run]

options:
  -h, --help            show this help message and exit
  -i INPUT_FILE, --input-file INPUT_FILE
                        Python file to parse NDB `class`es out of
  -o OUTPUT_FILE, --output-file OUTPUT_FILE
                        Empty file to generate SQLalchemy classes to
  --dry-run             Show what would be created; don't actually write to
                        the filesystem.

webapp2_to_fastapi (ndb2sqlalchemy takes same args)

$ python -m cdd_gae webapp2_to_fastapi --help

usage: python -m cdd_gae webapp2_to_fastapi [-h] -i INPUT_FILE -o OUTPUT_FILE
                                            [--dry-run]

options:
  -h, --help            show this help message and exit
  -i INPUT_FILE, --input-file INPUT_FILE
                        Python file to parse WebApp2 `class`es out of
  -o OUTPUT_FILE, --output-file OUTPUT_FILE
                        Empty file to generate FastAPI functions to
  --dry-run             Show what would be created; don't actually write to
                        the filesystem.

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

python-cdd-gae-0.0.7.tar.gz (21.5 kB view hashes)

Uploaded Source

Built Distribution

python_cdd_gae-0.0.7-py3-none-any.whl (27.4 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page