uci-uav-forge / uavf

UAV Forge's ODCL repository.
MIT License
1 stars 1 forks source link

ROS package and python Package share a name #43

Closed rland93 closed 2 years ago

rland93 commented 2 years ago

Bummer, I really thought this wasn't going to be an issue, but here we are: it is.

When trying to import the uavf python package into ROS, we have a conflict, since the ROS package is called uavf. So doing

import uavf

imports the ROS package instead of the python package.

Going to rename the python package. It is now called uavfpy rather than uavf. That should help distinguish it as a python package.

rland93 commented 2 years ago

error on pip install:

pip install git+https://github.com/uci-uav-forge/uavf.git@43-ros-package-and-python-package-share-a-name 

produces

ERROR: Command errored out with exit status 1:
   command: /home/ms/.pyenv/versions/3.8.12/envs/trash/bin/python3.8 /home/ms/.pyenv/versions/3.8.12/envs/trash/lib/python3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py get_requires_for_build_wheel /tmp/tmpo1cp4jvy
       cwd: /tmp/pip-req-build-kqmlzebc
  Complete output (37 lines):
  Traceback (most recent call last):
    File "/home/ms/.pyenv/versions/3.8.12/envs/trash/lib/python3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 280, in <module>
      main()
    File "/home/ms/.pyenv/versions/3.8.12/envs/trash/lib/python3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 263, in main
      json_out['return_val'] = hook(**hook_input['kwargs'])
    File "/home/ms/.pyenv/versions/3.8.12/envs/trash/lib/python3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 114, in get_requires_for_build_wheel
      return hook(config_settings)
    File "/tmp/pip-build-env-v_flomjl/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 177, in get_requires_for_build_wheel
      return self._get_build_requires(
    File "/tmp/pip-build-env-v_flomjl/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 159, in _get_build_requires
      self.run_setup()
    File "/tmp/pip-build-env-v_flomjl/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 174, in run_setup                                                                                                               
      exec(compile(code, __file__, 'exec'), locals())                                                                
    File "setup.py", line 1, in <module>                                                                             
    File "/tmp/pip-build-env-v_flomjl/overlay/lib/python3.8/site-packages/setuptools/__init__.py", line 87, in setup 
      return distutils.core.setup(**attrs)                                                                           
    File "/tmp/pip-build-env-v_flomjl/overlay/lib/python3.8/site-packages/setuptools/_distutils/core.py", line 122, in setup                                                                                                              
      dist.parse_config_files()                                                                                      
    File "/tmp/pip-build-env-v_flomjl/overlay/lib/python3.8/site-packages/setuptools/dist.py", line 850, in parse_config_files                                                                                                            
      setupcfg.parse_configuration(                                                                                  
    File "/tmp/pip-build-env-v_flomjl/overlay/lib/python3.8/site-packages/setuptools/config/setupcfg.py", line 167, in parse_configuration                                                                                                
      meta.parse()
    File "/tmp/pip-build-env-v_flomjl/overlay/lib/python3.8/site-packages/setuptools/config/setupcfg.py", line 446, in parse
      section_parser_method(section_options)
    File "/tmp/pip-build-env-v_flomjl/overlay/lib/python3.8/site-packages/setuptools/config/setupcfg.py", line 417, in parse_section
      self[name] = value
    File "/tmp/pip-build-env-v_flomjl/overlay/lib/python3.8/site-packages/setuptools/config/setupcfg.py", line 238, in __setitem__
      value = parser(value)
    File "/tmp/pip-build-env-v_flomjl/overlay/lib/python3.8/site-packages/setuptools/config/setupcfg.py", line 552, in _parse_version
      return expand.version(self._parse_attr(value, self.package_dir, self.root_dir))
    File "/tmp/pip-build-env-v_flomjl/overlay/lib/python3.8/site-packages/setuptools/config/setupcfg.py", line 372, in _parse_attr
      return expand.read_attr(attr_desc, package_dir, root_dir)
    File "/tmp/pip-build-env-v_flomjl/overlay/lib/python3.8/site-packages/setuptools/config/expand.py", line 188, in read_attr
      spec = _find_spec(module_name, path)
    File "/tmp/pip-build-env-v_flomjl/overlay/lib/python3.8/site-packages/setuptools/config/expand.py", line 203, in _find_spec
      raise ModuleNotFoundError(module_name)
  ModuleNotFoundError: uavfpy
rland93 commented 2 years ago

OK, so as far as I can tell, it's not possible to have the directory containing the package differ from the package name as it is installed by setuptools.

Which leaves us in kind of a pickle. We have two options:

Rename the repository to uavfpy, and keep the ROS package name the same uavf.

This might be a little confusing, because we are running a ROS package from a directory called uavfpy? So a new user might be confused: is this a python package or a ros package... py is in the name!

Keep the repository to uavf, and rename the ROS package to something different uavf.

Leaning towards this, but it has some downside, which is that the name uavf is a little ambiguous.

I guess this is kind of the bummer about keeping ROS+python all in one repo.

Thoughts?

rland93 commented 2 years ago

React :+1: if you want to rename the repo to uavfpy and keep the ROS package and :eyes: if you want to keep the repo and rename the ROS package.

rland93 commented 2 years ago

for now, I'm going with rosuavf for the name of the ROS package.

rland93 commented 2 years ago

the more I think about this, the less renaming the repository to uavfpy makes sense to someone just coming into the project. Going to close this issue, we can re-open it if need be.

rland93 commented 2 years ago

Maybe we can actually resolve this. I'm not sure exactly how setuptools is configuring our package.

If we put a package, uavfpy, into src/, and then tell setuptools to find that package, what happens?

rland93 commented 2 years ago

OK, that turns out to have solved our issue.

We can rename both.

Keeping open until documentation is re-done.

rland93 commented 2 years ago

Resolved.