New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

@typespec/http-client-python

Package Overview
Dependencies
Maintainers
2
Versions
106
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@typespec/http-client-python

TypeSpec emitter for Python SDKs

Source
npmnpm
Version
0.3.0
Version published
Weekly downloads
2.5K
-8.79%
Maintainers
2
Weekly downloads
 
Created
Source

TypeSpec Python Client Emitter

Getting started

Initialize TypeSpec Project

Follow TypeSpec Getting Started to initialize your TypeSpec project.

Make sure npx tsp compile . runs correctly.

Add @typespec/http-client-python to your project

Include @typespec/http-client-python in package.json:

 "dependencies": {
+      "@typespec/http-client-python": "latest"
  },

Run npm install to install the dependency.

Generate a Python client library

You can either specify @typespec/http-client-python on the commandline or through tspconfig.yaml.

Generate with --emit command

Run command npx tsp compile --emit @typespec/http-client-python <path-to-typespec-file>

e.g.

npx tsp compile main.tsp --emit @typespec/http-client-python

or

npx tsp compile client.tsp --emit @typespec/http-client-python

Generate with tspconfig.yaml

Add the following configuration in tspconfig.yaml:

emit:
  - "@typespec/http-client-python"
options:
  "@typespec/http-client-python":
+    package-dir: "contoso"
+    package-name: "contoso"

Run the command to generate your library:

npx tsp compile main.tsp

or

npx tsp compile client.tsp

Configure the generated library

You can further configure the generated client library using the emitter options provided through @typespec/http-client-python.

You can set options in the command line directly via --option @typespec/http-client-python.<optionName>=XXX, e.g. --option @typespec/http-client-python.package-name="contoso"

or

Modify tspconfig.yaml in the TypeSpec project to add emitter options under options/@typespec/http-client-python.

emit:
  - "@typespec/http-client-python"
options:
  "@typespec/http-client-python":
+    package-dir: "{package-dir}"
+    package-name: "contoso"

Supported emitter options

Common emitter configuration example:

emit:
  - "@typespec/http-client-python"
options:
  "@typespec/http-client-python":
    package-dir: "{package-dir}"
    package-name: "contoso"
OptionTypeDescription
package-versionstringSpecify the package version. Default version: 1.0.0b1.
package-namestringSpecify the package name.
package-dirstringSpecify the output directory for the package.
generate-packaging-filesbooleanIndicate if packaging files, such as setup.py, should be generated.
package-pprint-namestringSpecify the pretty print name for the package.
flavorstringRepresents the type of SDK that will be generated. By default, there will be no branding in the generated client library. Specify "azure" to generate an SDK following Azure guidelines.
company-namestringSpecify the company name to be inserted into licensing data. For "azure" flavor, the default value inserted is Microsoft.

Advanced emitter options

OptionTypeDescription
head-as-booleanbooleanGenerate head calls to return a boolean. Default: true.
packaging-files-dirstringPass in the path to a custom directory with SDK packaging files.
packaging-files-configobjectSpecify configuration options that will be passed directly into the packaging files specified by the packaging-files-dir option.
tracingbooleanOnly available for the "azure" flavor of SDKs, provide tracing support in the generated client library. Default: true.
debugbooleanEnable debugging.

Keywords

typespec

FAQs

Package last updated on 12 Oct 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts