# Punica Python

## Overview

Punica Python is a dApp development command line tool which has (almost) everything you need to start developing your dApp based on Ontology network.

There are a few technical requirements before we start. Please install the following:

* [Python 3.7](https://www.python.org/downloads/release/python-370/)
* [Git](https://git-scm.com/)

Then, execute the following command to install your tool:

```
$ pip install punica
```

## Quickstart

To use most Punica commands, you need to run them against an existing Punica project. So the first step is to create a Punica project.

```
$ punica
Usage: punica [OPTIONS] COMMAND [ARGS]...

Options:
  -p, --project PATH  Specify a punica project directory.
  -v, --version       Show the version and exit.
  -h, --help          Show this message and exit.

Commands:
  compile  Compile the specified contracts to avm and...
  deploy   Deploys the specified contracts to specified...
  init     Initialize new and empty Ontology DApp...
  invoke   Invoke the function list in default-config or...
  node     Ontology Blockchain private net in test mode.
  scpm     Smart contract package manager，support...
  smartx   Ontology smart contract IDE,SmartX...
  test     Unit test with specified smart contract
  tool     Data format conversion tool
  unbox    Download a Punica Box, a pre-built Ontology...
  wallet   Manager your ontid, account, asset.
```

You can create a bare Punica project with no smart contracts included, use `punica init` command.

Once this operation is completed, you'll now have a project structure with the following items:

* `contracts/`: Directory for Ontology smart contracts.
* `src/`: Directory for DApp source file.
* `test/`: Directory for test files for testing your application and contracts.
* `wallet/`: Directory for save Ontology wallet file.

## Creating Project

To use most Punica commands, you need to run them against an existing Punica project. So the first step is to create a Punica project.

### **Create New Project**

You can create a bare Punica project with no smart contracts included, use `punica init` command.

Once this operation is completed, you'll now have a project structure with the following items:

* `contracts/`: Directory for Ontology smart contracts.
* `src/`: Directory for DApp source file.
* `test/`: Directory for test files for testing your application and contracts.
* `wallet/`: Directory for save Ontology wallet file.

```
punica init --help
Usage: punica init [OPTIONS]

  Initialize new and empty Ontology DApp project.

Options:
  -h, --help  Show this message and exit.
```

{% hint style="info" %}
If you not run Punica CLI in you project root directory, you need to use `-p` or `--project` option to specify your DApp project's path.
{% endhint %}

### **Creating Box Project**

You can create a bare project template, but for those just getting started, you can use Punica Boxes, which are example applications and project templates.

We'll use the [ontology-tutorialtoken box](https://github.com/wdx7266/ontology-tutorialtoken), which creates a OEP4 token that can be transferred between accounts:

* Create a new directory for your Punica project:

```
mkdir tutorialtoken
cd tutorialtoken
```

* Download ("unbox") the MetaCoin box:

```
punica unbox tutorialtoken
```

```
punica unbox --help
Usage: punica unbox [OPTIONS] BOX_NAME

  Download a Punica Box, a pre-built Ontology DApp project.

Options:
  -h, --help  Show this message and exit.
```

{% hint style="info" %}
You can use the `punica unbox <box-name>` command to download any of the other Punica Boxes.
{% endhint %}

{% hint style="info" %}
If you not run punica cli in you project root directory, you need to use `-p` or `--project` option to specify your DApp project's path.
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://punica.gitbook.io/docs/punica-python.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
