Setuptools
Entrypoints
Entrypoints are a way to specify components in your package to the rest of the python space, so they can be dynamically discovered. So this enables:
- Console scripts (command line tools): executable commands.
setuptools
generates binaries in your Python environment’sbin
, so they can be run. - Plugins
- Custom Extensions
Example setup.py
:
1
2
3
4
5
6
7
8
9
10
11
12
13
from setuptools import setup, find_packages
setup(
name='your_package_name',
version='0.0.1',
packages=find_packages(),
install_requires=['setuptools'],
entry_points={
'console_scripts': [
'your_command = your_package.module:function',
],
# Other entry point groups can be defined here
},
)
- In ROS2, the most commonly used entrypoints are console scripts.