Quantcast
Channel: Symantec Connect - Articles
Viewing all articles
Browse latest Browse all 1863

Exporting run configurations in Pycharm

$
0
0

Introduction

Python is great for rapid development and we use a lot of it. We also use Pycharm as an IDE and its pretty neat for python development. However its not as evolved as eclipse so sometimes when pycharm has to be used in a large enterprise shop where we need to branch between different generations of the code base it gets hard to maintain your configurations. 

General rule of thumb suggested by pycharm communities and elsewhere is to re-create your configurations again for the new pycharm environment you want to set up. 

This can be long and tedious. Goal of this article is to provide a quicker way to share configurations and potentially a way to autoamate config exports. We will take the example of sharing run configurations between different branches for this exercise. 

Approach

Every pycharm instance has a hidden .idea/ folder where it maintains all its configuration files and settings related to keep this dev environment running. 

So if you have your environment set up for Branch A (say) and want to copy over the same run configurations you had for branch A to Branch B (which may be a fairly new branch), you can follow the steps below: 

  • Open workspace.xml for branch A by navigating to the root folder where this pycharm instance was set up. An example location would be: /<path_to_local_branch_A_root_directory>/.idea/workspace.xml
  • Copy the entire component XML with name 'RunManager'  <component name="RunManager" selected="****"></component>. This contains all your run configuration setup for the older branch. 

    Screen Shot 2014-11-14 at 12.14.00 AM.png

  • Create a pycharm project by importing the code from Branch B. Navigate to the workspace.xml for this new branch. i.e. /<path_to_local_branch_B_root_directory>/.idea/workspace.xml
  • Replace the component with name 'RunManager' with the contents of the old branch's workspace.xml. 
  • Edit the path mappings if any in your changes made to the new workspace.xml file to ensure the paths are true with the new branch. E.g. Change instances of Branch_A references to Branch_B. 
  • Go to pycharm instance running on the new Branch - it will detect that the workspace.xml file has changed and will prompt you to reload the IDE. Click OK and see all your previous run configurations show up in your new pycharm instance for a different branch of the code. 

References


Viewing all articles
Browse latest Browse all 1863

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>