<commit_before>
# How to create a kpt package

A kpt package is just a set of yaml files stored in a git repo. This allows producers of kpt 
packages to create or generate yaml files any way they want using the tool of their choice. 
Once a package is ready, publishing it simply involves pushing it to git and tag it using semver 
versioning. It is possible to have multiple packages in a single repo and it is possible to nest 
packages.

```
$ git clone <repo url> # or create a new repo
$ cd repository
$ mkdir wordpress
$ kpt pkg init wordpress --tag kpt.dev/app=wordpress --description "kpt wordpress package"
# add wordpress manifests to the folder
$ git add .
$ git commit -m "Add wordpress package"
$ git tag v0.1.0
$ git push
```

## Customize a package

kpt provides several commands that can be helpful during the process of creating
and updating kpt packages.

To list all the resources in your package, use `kpt cfg tree wordpress`.\
To show the manifests for all the resources in the package, use `kpt cfg cat wordpress`

To make it easy for consumers to customize the package, it is possible to
add setters:\
`$ kpt cfg create-setter wordpress image 5.3.2-php7.2-apache --type "string" --field "image"`\
This makes it possible for consumers to easily customize a package. 

It is also possible to list all the available setters in a package:\
`$ kpt cfg list-setters wordpress`<commit_msg>Use a real manifest in the examples to make them easier to follow<commit_after>
# How to create a kpt package

A kpt package is just a set of yaml files stored in a git repo. This allows producers of kpt 
packages to create or generate yaml files any way they want using the tool of their choice. 
Once a package is ready, publishing it simply involves pushing it to git and tag it using semver 
versioning. It is possible to have multiple packages in a single repo and it is possible to nest 
packages.

```
$ git clone <repo url> # or create a new repo
$ cd repository
$ mkdir nginx
$ kpt pkg init nginx --tag kpt.dev/app=nginx --description "kpt nginx package"
$ curl https://raw.githubusercontent.com/kubernetes/website/master/content/en/examples/controllers/nginx-deployment.yaml --output nginx/nginx-deployment.yaml
$ git add .
$ git commit -m "Add nginx package"
$ git tag v0.1.0
$ git push
```

## Customize a package

kpt provides several commands that can be helpful during the process of creating
and updating kpt packages.

To list all the resources in your package, use `kpt cfg tree nginx`.\
To show the manifests for all the resources in the package, use `kpt cfg cat nginx`

To make it easy for consumers to customize the package, it is possible to
add setters:\
`$ kpt cfg create-setter nginx image nginx:1.7.9 --type "string" --field "image"`\
This makes it possible for consumers to easily customize a package. 

It is also possible to list all the available setters in a package:\
`$ kpt cfg list-setters nginx`
{'fraction_non_alphanumeric': 0.06130790190735695, 'fraction_numerical': 0.004768392370572207, 'mean_word_length': 3.9031719532554257, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3103466', 'n_tokens_mistral': 842, 'n_tokens_neox': 807, 'n_words': 461}