


An VS Code extension to copy python dotted paths to the clipboard.
Would you like to get the python path, e.g. when running unittest?
When thecopy python path
command is executed, it copies the python dotted path to the clipboard. It also works with context menus.

You can now also copy the full dotted path of symbols imported in your Python file. Just place your cursor on an imported symbol and run the command:
fromml_service.lms.models.course_builderimportCreateCourseQuizRequestdefgenerate_quiz_view(request:Request)->Response:data=CreateCourseQuizRequest(**json.loads(request.body))# Place cursor here and run the command# Will copy: ml_service.lms.models.course_builder.CreateCourseQuizRequest
Similarly, running the "Copy python import statement" command on an imported symbol will generate the appropriate import statement:
from ml_service.lms.models.course_builder import CreateCourseQuizRequest
If you want to add the workspace folder name to the beginning of the dotted path, add the following setting to setting.json.
{ "copyPythonPath.addModuleRootName": true // default false}
If you want to omit a specific root path from the dotted path (e.g., if your path isroot.app.folder1.classFoo
and you want to omitroot.app
), add the following setting:
{ "copyPythonPath.omitRootPath": "root.app" // default empty string}
- This extension works only with python3 files.
MIT
Contributions are welcome 🎉
We accept contributions via Pull Requests.