Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

__init__.py is empty when uing colcon build and generate_parameter_library

Open
#255 0 comments 1 reaction 0 assignees View on GitHub

@MarqRazz is already working on this.

Since Oct 7, 2026.

  • #393 by @MarqRazz — open

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
python
Domain
build-system

Research direction

Start with the package's setup.py and trace what generate_parameter_module() does during a regular colcon build (without --symlink-install). Reproduce the issue using the steps in the report and inspect the installed my_package/__init__.py; the fix should preserve its contents in the installed package.

Written by the indexing model from the issue text.

Description

When building with colcon build instead of colcon build --symlink-install, the init.py in the install folder is empty, even if originally it was not. If it is done with symlink, no problems arise, as it uses the init.py directly from the src folder.

To reproduce the issue with ros2 jazzy:

  • create a package: ros2 pkg create --build-type ament_python --license Apache-2.0 my_package
  • add the following lines to __init__.py in ~/colcon_ws/src/my_package/my_package:
print("Hello World")
  • create a config folder and place a yaml in there (for the parameter library):
    config/my_package_parameters.yaml:
my_package: base_footprint_frame: type: string default_value: base_footprint description: 'The frame of the robot base' read_only: true
  • In the setup.py add the following:
import glob generate_parameter_module( "my_package_parameters", # python module name for parameter library "config/my_package_parameters.yaml", # path to input yaml file ) package_name = 'my_package' setup( name=package_name, version='0.0.0', packages=find_packages(exclude=['test']), data_files=[ ('share/ament_index/resource_index/packages', ['resource/' + package_name]), ('share/' + package_name, ['package.xml']), ("share/" + package_name + "/config", glob.glob("config/*.yaml")), ], install_requires=['setuptools'],
  • Now delete build install log directories first and then build with `colcon build --packages-select my_package
  • Then when doing cat install/my_package/lib/python3.12/site-packages/my_package/__init__.py, it should show an empty file. If we do not perform the generate_parameter_module() method, it is not empty.
Dominant language
Python
Stars
385
Forks
81
PR merge metrics
No merged PRs in 30d

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from PickNikRobotics/generate_parameter_library

All issues in PickNikRobotics/generate_parameter_library

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.