Many os methods allow you to specify the file descriptor dir_fd of a folder and provide a file path relative to that folder. The example I stumbled on is os.symlink(source_path, target_path, *, dir_fd=None), where I wanted the symlink to be relative. Without providing dir_fd, my symlink appears with an absolute path or relative to the cwd.
How do I obtain such a file descriptor? I cannot use the builtin open() on a directory (else I could get a file descriptor from the resulting file object).