![]() |
catkin_virtualenv repositorycatkin_virtualenv test_catkin_virtualenv test_catkin_virtualenv_inherited |
|
Repository Summary
Checkout URI | https://github.com/locusrobotics/catkin_virtualenv.git |
VCS Type | git |
VCS Version | master |
Last Updated | 2025-06-07 |
Dev Status | DEVELOPED |
CI status | No Continuous Integration |
Released | RELEASED |
Tags | No category tags. |
Contributing |
Help Wanted (0)
Good First Issues (0) Pull Requests to Review (0) |
Packages
Name | Version |
---|---|
catkin_virtualenv | 0.16.0 |
test_catkin_virtualenv | 0.16.0 |
test_catkin_virtualenv_inherited | 0.16.0 |
README
catkin_virtualenv
This package provides a mechanism to:
- export python
pip
requirements viapackage.xml
. - bundle a virtualenv within a catkin package, inheriting requirements from any dependencies.
- wrap python scripts and tests in a catkin package with a virtualenv loader.
- change which interpreter is used for executing scripts and tests (i.e. python2, python3, pypy, etc.)
At build time, CMake macros provided by this package will create a virtualenv inside the devel space, and create wrapper scripts for any Python scripts in the package. Both will be included in any associated bloom artifacts.
This library is GPL licensed due to the inclusion of dh_virtualenv.
Compatibility:
- Python 3.7+
- Ubuntu 20.04+, maybe others
- ROS Noetic, maybe others
-
catkin-tools
,colcon
,catkin_make_isolated
(i.e. ros_buildfarm), but notcatkin_make
For general help, please check the FAQ. Report bugs on the issue tracker.
Exporting python requirements
A package containing python modules with external pip
dependencies should define a requirements.txt
:
GitPython==2.1
psutil==5.2.2
Add an export to package.xml
:
<export>
<pip_requirements>requirements.txt</pip_requirements>
</export>
Make sure to install the requirements file in CMakeLists.txt
:
install(FILES requirements.txt
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION})
If a catkin package exports dependencies in a requirements.txt
file, any dependent catkin package that bundles a virtualenv (see below) will inherit those dependencies.
Bundling virtualenv
It’s possible to bundle all of a catkin package’s python requirements, as well as those of its catkin dependencies,
into a virtualenv. This process will also override the standard catkin_install_python
macro to wrap a virtualenv
loader around the specified python scripts.
Add an build dependency on catkin_virtualenv to package.xml
, as well as on any library packages you may want. Traditionally
<build_depend>catkin_virtualenv</build_depend>
<!-- In a catkin/python world, this would normally be an exec_depend. However, if `some_python_library` exports
requirements.in, it needs to be pulled in at build time as well -->
<depend>some_python_library</depend>
In CMakeLists.txt:
# Make sure to find-package `catkin_virtualenv`
find_package(catkin REQUIRED ... catkin_virtualenv ...)
# Generate the virtualenv
catkin_generate_virtualenv()
# Make sure your python executables are installed using `catkin_install_python`:
catkin_install_python(
PROGRAMS
scripts/do_python_things
DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION})
Departing from convention, scripts/do_python_things
should not be executable, and catkin build
will warn to that effect.
This package works by hijacking catkin_install_python
to generate new wrapper scripts into the devel and install space,
which bootstrap the virtualenv
. In addition, rosrun
gets confused if there’s two executable files with the same name.
Unit and integration tests will automatically pick up the virtualenv
as well. The only change is to add a dependency
from the test target to the virtualenv target:
```cmake if(CATKIN_ENABLE_TESTING)
# nosetests catkin_add_nosetests(test DEPENDENCIES ${PROJECT_NAME}_generate_virtualenv )
# rostests
File truncated at 100 lines see the full file
CONTRIBUTING
![]() |
catkin_virtualenv repositorycatkin_virtualenv test_catkin_virtualenv test_catkin_virtualenv_inherited |
|
Repository Summary
Checkout URI | https://github.com/locusrobotics/catkin_virtualenv.git |
VCS Type | git |
VCS Version | master |
Last Updated | 2025-06-07 |
Dev Status | DEVELOPED |
CI status | No Continuous Integration |
Released | RELEASED |
Tags | No category tags. |
Contributing |
Help Wanted (0)
Good First Issues (0) Pull Requests to Review (0) |
Packages
Name | Version |
---|---|
catkin_virtualenv | 0.16.0 |
test_catkin_virtualenv | 0.16.0 |
test_catkin_virtualenv_inherited | 0.16.0 |
README
catkin_virtualenv
This package provides a mechanism to:
- export python
pip
requirements viapackage.xml
. - bundle a virtualenv within a catkin package, inheriting requirements from any dependencies.
- wrap python scripts and tests in a catkin package with a virtualenv loader.
- change which interpreter is used for executing scripts and tests (i.e. python2, python3, pypy, etc.)
At build time, CMake macros provided by this package will create a virtualenv inside the devel space, and create wrapper scripts for any Python scripts in the package. Both will be included in any associated bloom artifacts.
This library is GPL licensed due to the inclusion of dh_virtualenv.
Compatibility:
- Python 3.7+
- Ubuntu 20.04+, maybe others
- ROS Noetic, maybe others
-
catkin-tools
,colcon
,catkin_make_isolated
(i.e. ros_buildfarm), but notcatkin_make
For general help, please check the FAQ. Report bugs on the issue tracker.
Exporting python requirements
A package containing python modules with external pip
dependencies should define a requirements.txt
:
GitPython==2.1
psutil==5.2.2
Add an export to package.xml
:
<export>
<pip_requirements>requirements.txt</pip_requirements>
</export>
Make sure to install the requirements file in CMakeLists.txt
:
install(FILES requirements.txt
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION})
If a catkin package exports dependencies in a requirements.txt
file, any dependent catkin package that bundles a virtualenv (see below) will inherit those dependencies.
Bundling virtualenv
It’s possible to bundle all of a catkin package’s python requirements, as well as those of its catkin dependencies,
into a virtualenv. This process will also override the standard catkin_install_python
macro to wrap a virtualenv
loader around the specified python scripts.
Add an build dependency on catkin_virtualenv to package.xml
, as well as on any library packages you may want. Traditionally
<build_depend>catkin_virtualenv</build_depend>
<!-- In a catkin/python world, this would normally be an exec_depend. However, if `some_python_library` exports
requirements.in, it needs to be pulled in at build time as well -->
<depend>some_python_library</depend>
In CMakeLists.txt:
# Make sure to find-package `catkin_virtualenv`
find_package(catkin REQUIRED ... catkin_virtualenv ...)
# Generate the virtualenv
catkin_generate_virtualenv()
# Make sure your python executables are installed using `catkin_install_python`:
catkin_install_python(
PROGRAMS
scripts/do_python_things
DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION})
Departing from convention, scripts/do_python_things
should not be executable, and catkin build
will warn to that effect.
This package works by hijacking catkin_install_python
to generate new wrapper scripts into the devel and install space,
which bootstrap the virtualenv
. In addition, rosrun
gets confused if there’s two executable files with the same name.
Unit and integration tests will automatically pick up the virtualenv
as well. The only change is to add a dependency
from the test target to the virtualenv target:
```cmake if(CATKIN_ENABLE_TESTING)
# nosetests catkin_add_nosetests(test DEPENDENCIES ${PROJECT_NAME}_generate_virtualenv )
# rostests
File truncated at 100 lines see the full file
CONTRIBUTING
![]() |
catkin_virtualenv repositorycatkin_virtualenv test_catkin_virtualenv test_catkin_virtualenv_inherited |
|
Repository Summary
Checkout URI | https://github.com/locusrobotics/catkin_virtualenv.git |
VCS Type | git |
VCS Version | master |
Last Updated | 2025-06-07 |
Dev Status | DEVELOPED |
CI status | No Continuous Integration |
Released | RELEASED |
Tags | No category tags. |
Contributing |
Help Wanted (0)
Good First Issues (0) Pull Requests to Review (0) |
Packages
Name | Version |
---|---|
catkin_virtualenv | 0.16.0 |
test_catkin_virtualenv | 0.16.0 |
test_catkin_virtualenv_inherited | 0.16.0 |
README
catkin_virtualenv
This package provides a mechanism to:
- export python
pip
requirements viapackage.xml
. - bundle a virtualenv within a catkin package, inheriting requirements from any dependencies.
- wrap python scripts and tests in a catkin package with a virtualenv loader.
- change which interpreter is used for executing scripts and tests (i.e. python2, python3, pypy, etc.)
At build time, CMake macros provided by this package will create a virtualenv inside the devel space, and create wrapper scripts for any Python scripts in the package. Both will be included in any associated bloom artifacts.
This library is GPL licensed due to the inclusion of dh_virtualenv.
Compatibility:
- Python 3.7+
- Ubuntu 20.04+, maybe others
- ROS Noetic, maybe others
-
catkin-tools
,colcon
,catkin_make_isolated
(i.e. ros_buildfarm), but notcatkin_make
For general help, please check the FAQ. Report bugs on the issue tracker.
Exporting python requirements
A package containing python modules with external pip
dependencies should define a requirements.txt
:
GitPython==2.1
psutil==5.2.2
Add an export to package.xml
:
<export>
<pip_requirements>requirements.txt</pip_requirements>
</export>
Make sure to install the requirements file in CMakeLists.txt
:
install(FILES requirements.txt
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION})
If a catkin package exports dependencies in a requirements.txt
file, any dependent catkin package that bundles a virtualenv (see below) will inherit those dependencies.
Bundling virtualenv
It’s possible to bundle all of a catkin package’s python requirements, as well as those of its catkin dependencies,
into a virtualenv. This process will also override the standard catkin_install_python
macro to wrap a virtualenv
loader around the specified python scripts.
Add an build dependency on catkin_virtualenv to package.xml
, as well as on any library packages you may want. Traditionally
<build_depend>catkin_virtualenv</build_depend>
<!-- In a catkin/python world, this would normally be an exec_depend. However, if `some_python_library` exports
requirements.in, it needs to be pulled in at build time as well -->
<depend>some_python_library</depend>
In CMakeLists.txt:
# Make sure to find-package `catkin_virtualenv`
find_package(catkin REQUIRED ... catkin_virtualenv ...)
# Generate the virtualenv
catkin_generate_virtualenv()
# Make sure your python executables are installed using `catkin_install_python`:
catkin_install_python(
PROGRAMS
scripts/do_python_things
DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION})
Departing from convention, scripts/do_python_things
should not be executable, and catkin build
will warn to that effect.
This package works by hijacking catkin_install_python
to generate new wrapper scripts into the devel and install space,
which bootstrap the virtualenv
. In addition, rosrun
gets confused if there’s two executable files with the same name.
Unit and integration tests will automatically pick up the virtualenv
as well. The only change is to add a dependency
from the test target to the virtualenv target:
```cmake if(CATKIN_ENABLE_TESTING)
# nosetests catkin_add_nosetests(test DEPENDENCIES ${PROJECT_NAME}_generate_virtualenv )
# rostests
File truncated at 100 lines see the full file