Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: python support, validated with quickstart #159

Merged
merged 44 commits into from
Mar 21, 2024
Merged

Conversation

jianzs
Copy link
Contributor

@jianzs jianzs commented Mar 21, 2024

1. Does this PR affect any open issues?(Y/N) and add issue references (e.g. "fix #123", "re #123".):

2. What is the scope of this PR (e.g. component or file name):

  • CLI
  • Pyright Deducer
  • SDKs

3. Provide a description of the PR(e.g. more details, effects, motivations or doc link):

  • Affects user behaviors
  • Contains syntax changes
  • Contains variable changes
  • Contains experimental features
  • Performance regression: Consumes more CPU
  • Performance regression: Consumes more Memory
  • Other

We created a deducer using Pyright. It can automatically analyze the dependent packages for each section of business logic, and the adapter includes them in the zip archive for publishing on AWS Lambda. Currently, Pluto supports simple Python projects. Users can use the pluto command to create and deploy Python projects. However, if the project relies on packages with different distribution packages on various platforms, or if the archive size after zipping exceeds the AWS limit of 50 MB, it will fail. For more details, you can find in the PRs related to the issue #146 .

4. Are there any breaking changes?(Y/N) and describe the breaking changes(e.g. more details, motivations or doc link):

  • N
  • Y

5. Are there test cases for these changes?(Y/N) select and add more details, references or doc links:

  • Unit test
  • Integration test
  • Benchmark (add benchmark stats below)
  • Manual test (add detailed scripts or steps below)
  • Other

jianzs and others added 30 commits March 4, 2024 11:27
…o 'pluto-client', publish the initial 'pluto-base' pypi package
- add serveral resource types to the python client sdk, including Router, KVStore, Queue, SageMaker
- add utils, resource base type, platform type, provisioning type to the python base sdk
…l, clarify the meaning of the `ge_resource_id` parameters, and format all Python code
feat(sdk): initialize the python version of both client sdk and base sdk
Incorporated pyright code into the pyright deducer and adjusted several aspects to meet our requirements, including:
- remove the `tests` directory
- add the `vscode-languageserver-protocol` package to the `package.json` file
- add `"declaration": true,` to the `tsconfig.json` file
- change the target and lib in the `tsconfig.json` file to `es2022` and `es2022` respectively
- change the outDir in the `tsconfig.json` file to `./dist`
- keep only `src` in the `include` array of the `tsconfig.json` file, removing everything else.
- remove the `test` command from the `package.json` file.

When the deducer is published, it will come packaged with the pyright-internal package.
feat(deducer): initialize the deducer which is based on the pyright
feat(deducer): support searching all call nodes related to the specific types' direct usage
feat(deducer): support evaluating the values of literal types and direct calls to data class constructors
…ponding to the caller of a special method call
feat(deducer): support searching for the constructor call node corresponding to the caller of a special method call
… readability

- change `ClosureExtractor` to `CodeExtractor` and rename methods in this class
feat(deducer): support extracting codes for the arguments of the infrastructure api calls
- Add an ability to CodeExtractor to find the client APIs called and accessed captured properties within a code segment.
- Support deducing a Python file to obtain an architecture reference.
feat(deducer): streamline the entire deduction process
…on file and copying them to the designated directory
feat(deducer): support finding nested dependent modules within a python file and copying them to the designated directory
jianzs and others added 13 commits March 19, 2024 11:44
feat: support python workflow, validating with the quickstart
feat(deducer): support working without `extraPaths`
…ass member

The issue arises due to the class node and its members being at the same scope level. We can't verify whether the variables within a class member are located within the class scope.
…racting codes and evaluating values

Dictionaries can be used as custom arguments in the constructor call, including user-defined environment variables.
enhance: support more types when deducing, and fix bugs

- Fix a bug that the local variables within a class's member are incorrectly identified as needing extraction. This issue arises because the class node and its members are at the same scope level. We cannot confirm whether the variables within a class member are located within the class scope.
- Fix a bug in dumping the Pluto project configuration to a configuration file, where it incorrectly includes some information that should not be included, such as the state attribute of the stack.
- Add support for dictionaries, lists, and tuples types when extracting codes and evaluating values. This feature is useful when users need to add custom configurations to infrastructure resources, such as environment variables.
- Include the dist-info directory of Python packages when extracting dependencies.
@jianzs jianzs added enhancement New feature or request deducer Deducer generator Generator adapter Adapter sdk Client SDK and Infra SDK cli command-line interface labels Mar 21, 2024
Copy link

changeset-bot bot commented Mar 21, 2024

🦋 Changeset detected

Latest commit: 1c3c5fa

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 10 packages
Name Type
@plutolang/pyright-deducer Minor
@plutolang/graphviz-generator Minor
@plutolang/static-generator Minor
@plutolang/pulumi-adapter Minor
@plutolang/static-deducer Minor
@plutolang/pluto-infra Minor
@plutolang/pluto Minor
@plutolang/base Minor
@plutolang/cli Minor
@plutolang/simulator-adapter Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@jianzs jianzs merged commit 5800457 into main Mar 21, 2024
2 checks passed
@jianzs jianzs deleted the feat-support-python branch April 17, 2024 14:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
adapter Adapter cli command-line interface deducer Deducer enhancement New feature or request generator Generator sdk Client SDK and Infra SDK
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support Python
2 participants