Metadata-Version: 2.1
Name: nitric
Version: 1.2.1
Summary: The Nitric SDK for Python 3
Home-page: https://github.com/nitrictech/python-sdk
Author: Nitric
Author-email: team@nitric.io
Classifier: Programming Language :: Python :: 3
Classifier: Operating System :: OS Independent
Requires-Python: >=3.11
Description-Content-Type: text/markdown
Requires-Dist: asyncio
Requires-Dist: protobuf==4.23.3
Requires-Dist: betterproto==2.0.0b6
Requires-Dist: opentelemetry-api
Requires-Dist: opentelemetry-sdk
Requires-Dist: opentelemetry-exporter-otlp-proto-grpc
Requires-Dist: opentelemetry-instrumentation-grpc
Provides-Extra: dev
Requires-Dist: tox==3.20.1; extra == "dev"
Requires-Dist: twine==3.2.0; extra == "dev"
Requires-Dist: pytest==7.3.2; extra == "dev"
Requires-Dist: pytest-cov==4.1.0; extra == "dev"
Requires-Dist: pre-commit==2.12.0; extra == "dev"
Requires-Dist: black==22.3; extra == "dev"
Requires-Dist: flake8==3.9.1; extra == "dev"
Requires-Dist: flake8; extra == "dev"
Requires-Dist: flake8-bugbear; extra == "dev"
Requires-Dist: flake8-comprehensions; extra == "dev"
Requires-Dist: flake8-string-format; extra == "dev"
Requires-Dist: pydocstyle==6.0.0; extra == "dev"
Requires-Dist: pip-licenses==3.3.1; extra == "dev"
Requires-Dist: licenseheaders==0.8.8; extra == "dev"
Requires-Dist: pdoc3==0.9.2; extra == "dev"
Requires-Dist: markupsafe==2.0.1; extra == "dev"
Requires-Dist: betterproto[compiler]==2.0.0b6; extra == "dev"
Requires-Dist: grpcio-tools==1.62.0; extra == "dev"
Requires-Dist: mypy==1.3.0; extra == "dev"

<p align="center">
  <a href="https://nitric.io">
    <img src="docs/assets/nitric-logo.svg" width="120" alt="Nitric Logo"/>
  </a>
</p>

<h2 align="center">
  Build <a href="https://nitric.io">nitric</a> applications with Python
</h2>

<p align="center">
  <a href="https://actions-badge.atrox.dev/nitrictech/python-sdk/goto?ref=main"><img alt="Build Status" src="https://img.shields.io/endpoint.svg?url=https%3A%2F%2Factions-badge.atrox.dev%2Fnitrictech%2Fpython-sdk%2Fbadge%3Fref%3Dmain&style=for-the-badge" /></a>
  <a href="https://codecov.io/gh/nitrictech/python-sdk">
    <img alt="Codecov" src="https://img.shields.io/codecov/c/gh/nitrictech/python-sdk?style=for-the-badge&token=SBFRNSZ4ZF">
  </a>
  <a href="https://pypi.org/project/nitric">
    <img alt="Version" src="https://img.shields.io/pypi/v/nitric?style=for-the-badge">
  </a>
  <a href="https://pypi.org/project/nitric">
    <img alt="Downloads/week" src="https://img.shields.io/pypi/dw/nitric?style=for-the-badge">
  </a>
  <a href="https://nitric.io/chat"><img alt="Discord" src="https://img.shields.io/discord/955259353043173427?label=discord&style=for-the-badge"></a>
</p>

The Python SDK supports the use of the [Nitric](https://nitric.io) framework with Python 3.11+. For more information check out the main [Nitric repo](https://github.com/nitrictech/nitric).

Python SDKs provide an infrastructure-from-code style that lets you define resources in code. You can also write the functions that support the logic behind APIs, subscribers and schedules.

You can request the type of access you need to resources such as publishing for topics, without dealing directly with IAM or policy documents.

- Reference Documentation: https://nitric.io/docs/reference/python
- Guides: https://nitric.io/docs/guides/python

## Usage

### Starting a new project

Install the [Nitric CLI](https://nitric.io/docs/getting-started/installation), then generate your project:

```bash
nitric new hello-world py-starter
```

### Add to an existing project

First of all, you need to install the library:

**pip**

```bash
pip3 install nitric
```

**pipenv**

```
pipenv install nitric
```

Then you're able to import the library and create cloud resources:

```python
from nitric.resources import api, bucket
from nitric.application import Nitric
from nitric.context import HttpContext

publicApi = api("public")
uploads = bucket("uploads").allow("write")

@publicApi.get("/upload")
async def upload(ctx: HttpContext):
    photo = uploads.file("images/photo.jpg")

    url = await photo.upload_url()

    ctx.res.body = {"url": url}

Nitric.run()
```

## Learn more

Learn more by checking out the [Nitric documentation](https://nitric.io/docs).

## Get in touch:

- Join us on [Discord](https://nitric.io/chat)

- Ask questions in [GitHub discussions](https://github.com/nitrictech/nitric/discussions)

- Find us on [Twitter](https://twitter.com/nitric_io)

- Send us an [email](mailto:maintainers@nitric.io)
