I think I solved these two questions, thanks to Brian's comment on symlinks and general guidance by Matt. Appreciate.
TLDR: I wanted to have an ansible collection dir to be located anywhere, not following a particular dir structure, and satisfy the following requirements:
1. ansible-playbook should load the collection that is under development without doing galaxy-install. Similar to `pip install -e` mode.
2. Internal Import paths in my collection should use the full paths and resolve by the IDE.
To do that, I did the following:
1. create an ansible skeleton dir at ~/somedir/collection
2. create a temp dir that satisfies the collection's path structure: mkdir -p /tmp/somedir
3. create a symlink to the path where you develop the collection: ln -s "$(pwd)" /tmp/somedir/ansible_collections/<namespace>/<collection_name>
3. Put in ansible.cfg the following
[defaults]
collections_paths = /tmp/somedir
4. this will make ansible to use the collection without requiring an installation step5. To make python import paths resolve, I created an .env file in the collection's root dir stating
6. This will make the python interpreter pick up import paths like: from ansible_collections.<namespace>.<coll_name>