2015-12-19 14:52:17 +01:00
title: Publishing
---
summary: Explains how publishing of plugins works.
---
sort_key: 20
---
body:
Once you are happy with a plugin you can publish it so that other people
can use it. Publishing of plugins happens through the
2018-05-03 22:51:52 +02:00
[Python Package Index :ext](https://pypi.org/) and can be
2015-12-19 14:52:17 +01:00
automatically done with the help of the lektor shell command.
## Enhance your setup.py
Before you can go about publishing your plugin there needs to be at least
some information added about it to your `setup.py`. At least the keys
`name`, `version`, `author`, `author_email`, `url` and `description` need to be
set. Here is a basic example of doing this:
```python
from setuptools import setup
2018-05-03 22:51:52 +02:00
with open('README.md', encoding="utf8") as f:
readme = f.read()
2015-12-19 14:52:17 +01:00
setup(
name='lektor-your-plugin',
author='Your Name',
author_email='your.email@your.domain.invalid',
version='1.0',
url='http://github.com/youruser/lektor-yourplugin',
license='MIT',
packages=['lektor_your_plugin'],
description='Basic description goes here',
2018-05-03 22:51:52 +02:00
long_description=readme,
long_description_content_type='text/markdown',
classifiers=[
'Framework :: Lektor',
'Environment :: Plugins',
],
2015-12-19 14:52:17 +01:00
entry_points={
'lektor.plugins': [
'hello-world = lektor_hello_world:HelloWorldPlugin',
]
},
)
```
## Publishing
Once you augmented your `setup.py` you can go ahead with the publishing. First
you need to make sure you have a PyPI account. If you do not, you can
create one at [pypi.python.org :ext](https://pypi.python.org/pypi?%3Aaction=register_form).
Once you have done that, you can publish the plugin from the command line
with the `lektor` command:
```
$ cd path/to/your/plugin
$ lektor dev publish-plugin
```
When you use this for the first time it will prompt you for your login
credentials for `pypi`. Next time it will have remembered them.
2018-05-03 22:51:52 +02:00
## Listing on this site
We'd love to see your new plugin listed on [our plugins page :ref](/plugins). To do that, submit a pull request to [this repository](https://github.com/lektor/lektor-website) that adds your plugin as a sub-page of /plugins. To have your plugin page look it's best and be found more easily here and on [PyPI :ext](https://pypi.org/), please [fill out your setup.py :ext](https://packaging.python.org/tutorials/distributing-packages/) completely, including
2018-05-06 20:31:48 +02:00
* `author` and `author_email`
* `classifiers`, such as
2018-05-03 22:51:52 +02:00
* `Framework :: Lektor`
* `Environment :: Plugins`
2018-05-06 20:31:48 +02:00
* `keywords`
* `long_description` and `long_description_content_type`
* `project_urls` (optional)
* `url` to link to your repository
The `long_description` can be set to be your README file, and is especially important. Without it, your plugins page will look a little sparse.
2018-05-03 22:51:52 +02:00