Skip to content

Commit

Permalink
Update packaging examples
Browse files Browse the repository at this point in the history
- pyproject.toml needs to be listed first, as it is the standard
- fix inconsistency in the project.entry-points section of
  pyproject.toml
  • Loading branch information
beeankha committed Aug 19, 2022
1 parent 53db476 commit 5aac33f
Showing 1 changed file with 20 additions and 26 deletions.
46 changes: 20 additions & 26 deletions cep-4.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,34 +39,10 @@ def conda_subcommands():
...
```

### Entry point namespace utilizing a `setup.py` file

Below is an example of an entry point namespace for the custom plugin function, decorated with the plugin hook shown above:

_setup.py_
```python
from setuptools import setup

setup(
name="my-conda-plugin",
install_requires="conda",
entry_points={"conda": ["my-conda-plugin = my_plugin"]},
py_modules=["my_plugin"],
)
```

### Packaging via a `pyproject.toml` file


Below is a different packaging example that configures `setuptools` using a `pyproject.toml` file:

_setup.py_
```python
import setuptools

if __name__ == "__main__":
setuptools.setup()
```
Below is an example that configures `setuptools` using a `pyproject.toml` file (note that the `setup.py` file is optional if a `pyproject.toml` file is defined):

_pyproject.toml_
```toml
Expand All @@ -76,12 +52,30 @@ build-backend = "setuptools.build_meta"

[project]
name = "my-conda-plugin"
version = "1.0.0"
description = "My conda plugin"
requires-python = ">=3.7"
dependencies = ["conda"]

[project.entry-points."conda"]
my-conda-plugin = "my_plugin.module:function"
my-conda-plugin = "my_plugin"
```


### Packaging via a `setup.py` file

Below is an example of an entry point namespace for the custom plugin function, decorated with the plugin hook shown in the "Hook" section above:

_setup.py_
```python
from setuptools import setup

setup(
name="my-conda-plugin",
install_requires="conda",
entry_points={"conda": ["my-conda-plugin = my_plugin"]},
py_modules=["my_plugin"],
)
```


Expand Down

0 comments on commit 5aac33f

Please sign in to comment.