Metadata-Version: 2.1
Name: poetry-plugin-pycopy
Version: 1.0.6
Summary: Copy fields from pyproject.toml to source directory
License: unlicense.org
Author: Daniel Fajt
Author-email: daniel29se@gmail.com
Requires-Python: >=3.7,<4.0
Classifier: License :: OSI Approved :: The Unlicense (Unlicense)
Classifier: License :: Other/Proprietary License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3
Requires-Dist: poetry (>=1.2.2,<2.0.0)
Description-Content-Type: text/markdown

# poetry-plugin-pycopy

<!--- These are examples. See https://shields.io for others or to customize this set of shields. You might want to include dependencies, project status and licence info here --->
![GitHub repo size](https://img.shields.io/github/repo-size/danielfajt/poetry-plugin-pycopy)
![GitHub contributors](https://img.shields.io/github/contributors/danielfajt/poetry-plugin-pycopy)
![GitHub stars](https://img.shields.io/github/stars/danielfajt/poetry-plugin-pycopy?style=social)
![GitHub forks](https://img.shields.io/github/forks/danielfajt/poetry-plugin-pycopy?style=social)
![Twitter Follow](https://img.shields.io/twitter/follow/danielfajt?style=social)

This plugin adds command `pycopy` to Poetry which will copy information from `pyproject.toml` to `source` directory. 

The goal is to have `pyproject.toml` as a single source of truth for app version, name, description etc. and to have these values available during a program runtime.

## Use case
FastAPI app in which you want to show application name or version in API docs.


## Installation

From Pypi:
```
$ poetry self add poetry-plugin-pycopy
```

## Usage

```
$ poetry pycopy
```

## Plugin configuration in `pyproject.toml`

```
[tool.poetry-plugin-pycopy]
keys = ["name", "version", "description"]
dest_dir = "<some_package_name>"
dest_file = "__init__.py"
```
- `keys` list tells which fields should by copied from `[tool.poetry]`
- `dest_dir` is package/module root
- `dest_file` is the name of an output file

Plugin also runs with `$poetry version` command automatically. So when you use version bump, e.g.: `$poetry version patch` the plugin will copy the new version value into the output file.

## Output file example
The `dest_file` is set to `__init__.py`. Thus the plugin will create or replace that file with current values for a given `keys`. For example:

```
pyproject_toml = {
    "name": "test-venv-1",
    "version": "0.1.0",
    "description": "dsa",
}
```

-> https://unlicense.org/
