Script Providers for Git¶
Git is a free and opensource distributed version control system designed to handle everything from small to very large projects with speed and efficiency.
Git is easy to learn and has a tiny footprint with lightning fast performance. It outclasses SCM tools like Subversion, CVS, Perforce, and ClearCase with features like cheap local branching, convenient staging areas, and multiple workflows.
The script manager supports using Python scripts (.py) stored in Git repositories, running, and debugging the scripts. Currently the script manager supports the two platforms Azure DevOps and GitHub.
The most obvious, classic distinction between the two platforms is that Azure DevOps is geared for closed source projects while GitHub is focused on open source.
Script providers are configured in the Edit Provider(s) Connections(s) context menu of the root node.
Connection strings for GitHub and DevOps contains an URL to the Git repository as well as an API key created in either GitHub or DevOps.
Once a script provider has been configured, a new root node is shown in the script explorer, showing all scripts and files in the repository.
For Python files (*.py
), the functions of the python file will be shown
as child nodes of the Python file node.
Note that only functions with a function description and author are shown in the script explorer.
Scripts repositories in the Git script providers are read-only, but can be executed and debugged using the debugging capabilities of the script manager.
The Git repositories will show and use the files in the master branch. This means that showing specified branches are not possible.
View History¶
The script explorer supports showing the version control Git history.
Select 'View History' from the file or function context menu, to see the file commit history.
GitHub¶
At a high level, GitHub is a website and cloud-based service that helps developers store and manage their code, as well as track and control changes to their code.
Version-Controlling Your Python Projects with Git and GitHub. Using a version control system (VCS) is crucial for any software development project. These systems allow developers to track changes to the project's codebase over time, removing the need to keep multiple copies of the project folder.
Connection strings for GitHub repositories must contain the following information, separated by semi colons.
https://api.github.com;84C7F1CC-2103-40A3-9360-2F2B5EC0B584;DHI;MIKE-OPERATIONS;IronPython;TestScriptIntegration
-
URL (currently not used)
The GitHub project URL (reserved for future versions). The URL are found on the GitHub website, clicking the repository of interest. -
API Key
An API key is used an access token instead of logging in using username and password.
Create an API key (GHP token) by logging in at the GitHub web site, go to settings, in the left side bar, select Developer Settings, go to Personal access tokens and select 'Generate new token'.
As a minimum, the API key should have project read access.
-
Organization Name
The organization account is a shared account used as a shared container for the work done. -
Repository
Specify the name of the GitHub repository to use and show in the script explorer. Note that the master branch will always be used. -
Script Type (Optional)
Specify the type of script files CPython or IronPython as a 5^th^ parameter. By default, scripts are considered IronPython scripts. -
Branch name (Optional)
Specify the name of the branch to use for the provider. If no branch is specified, the default branch is used (master).
Azure DevOps¶
Azure DevOps is used for planning and collaborating on code development and building and deploying applications. Compared to GitHub, Azure DevOps tends to be more preferred by enterprises and cloud enablement initiatives. Like GitHub, it offers both public and private repositories.
Connection strings for Azure DevOps repositories must contain the following information, separated by semi colons.
E.g. https://dhigroup.visualstudio.com/MIKE;0E60248D-7BE4-43BB-83ED-3C2CFFD94196;mike-operations;CPython;2021
-
URL
The Azure DevOps organization/project URL e.g.https://dhigroup.visualstudio.com/<organization/project>
. The URL are found on the Azure DevOps website when a project has been selected. -
API Key
An API key is used an access token instead of logging in using username and password.
Create an API key by logging in at the Azure DevOps web site and select User Settings and select 'Personal access tokens'. -
Repository
Specify the name of the Azure DevOps repository to use and show in the script explorer. Note that the master branch will always be used. -
Script Type (Optional)
Specify the type of script files CPython or IronPython as a 4th parameter. By default, scripts are considered IronPython scripts. -
Branch name (Optional)
Specify the name of the branch to use for the provider. If no branch is specified, the default branch is used (master).