https://github.com/yeuk0/pybuilder-archetype-api
External plugin for PyBuilder to generate a web service project structure
https://github.com/yeuk0/pybuilder-archetype-api
api-rest archetype flask-api gunicorn-with-flask-rest-api plugin pybuilder pybuilder-plugin python template
Last synced: 3 months ago
JSON representation
External plugin for PyBuilder to generate a web service project structure
- Host: GitHub
- URL: https://github.com/yeuk0/pybuilder-archetype-api
- Owner: yeuk0
- License: apache-2.0
- Created: 2020-03-23T17:39:28.000Z (about 6 years ago)
- Default Branch: main
- Last Pushed: 2023-05-01T21:22:01.000Z (almost 3 years ago)
- Last Synced: 2025-08-31T18:09:10.585Z (8 months ago)
- Topics: api-rest, archetype, flask-api, gunicorn-with-flask-rest-api, plugin, pybuilder, pybuilder-plugin, python, template
- Language: Python
- Homepage:
- Size: 17.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# PyBuilder Archetype API Plugin
This plugin generates a structure for a project that requieres endpoints (APIs or web services). This plugin needs
[pybuilder_archetype_base](https://github.com/yeuk0/pybuilder-archetype-base) due to its dependancy with one of its
tasks (`create_archetype_api`).
In the following diagram there is every directory and file created during `create_archetype_api` execution (take note
that `create_archetype_base` task will add more packages and directories -check its `README.md` file for more
information):
```text
src
└── package_name
├── api # For every script related with the web services
| ├── __init__.py
| └── api_example.py
├── config
| ├── __init__.py
| └── constants.py
├── __init__.py
├── gunicorn_config.py # Gunicorn launching configuration
├── main.py # Script with Flask app
└── wsgi.py # WSGI file for server launch
requirements.txt
```
Content from `requirements.txt` and `constants.py` files will be added to the currently existing ones, trying to keep
the values set by other plugins.
## How to use pybuilder_archetype_api
> **NOTICE**: This plugin only works on Windows due to its dependency with pybuilder_archetype_base PyBuilder plugin.
Using this plugin in other OS shall not work properly. Multi-platform support soon.
Add plugin dependencies to your `build.py` (it requires [pybuilder_archetype_base](https://github.com/yeuk0/pybuilder-archetype-base) and [pybuilder_pycharm_workspace](https://github.com/yeuk0/pybuilder-pycharm-workspace)
to work properly):
```python
use_plugin('pypi:pybuilder_pycharm_workspace')
use_plugin('pypi:pybuilder_archetype_base')
use_plugin('pypi:pybuilder_archetype_api')
```
Configure the plugin within your `init` function:
```python
@init
def initialise(project):
project.set_property('project_base_path', project_path)
```
This will tell the plugin which is the project location in the filesystem. `project_base_path` property value should
be always the same.
Launch the task with:
```console
(venv) C:\Users\foo\PycharmProjects\bar> pyb create_archetype_api
```
### `build.py` file recommended
Check [pybuilder_archetype_base `build.py` recommendation](https://github.com/yeuk0/pybuilder-archetype-base#buildpy-file-recommended).
## Properties
Plugin has next properties with provided defaults
| Name | Type | Default Value | Description |
| --- | --- | --- | --- |
| project_base_path | Path | None | Project's path in filesystem (same as `build.py` file). Mandatory |