- Create a virtual-env on the server hosting your TeamCity installation.
- Install teamcity-messages in your virtual-env.
- Create a new project in TeamCity. See this page for more details.
- Setup your VCS root(s). This may not be the best approach, but for dependent Python projects, I create VCS roots for every dependent projects so that all dependencies are satisfied within the project. You may have to define VCS roots in a parent TeamCity project if they are shared among several dependent projects.
- Create a build configuration.
- Attach relevant VCS roots in the "Version Control Settings" page.
- Create a new build step with "Command Line" as the runner type.
- Enter the script content so that you invoke your virtual-env's nosetests.exe.

- Add a new trigger in the Triggers page.

- You can manually schedule a build now or wait for TeamCity to build automatically.
Wednesday, February 17, 2016
Continuous integration with Python on TeamCity
Here is how we can configure TeamCity 9.1.3 (build 37176) to perform continuous integration on Python 2 projects. I assume that you have already installed Python 2 (2.6 and above), virtual-env, TeamCity, and have access to your code in a version control system. Unit tests written in Nose seem to work well in TeamCity.
Thursday, February 4, 2016
Setting up a Python development environment for ArcGIS
- Download PyCharm IDE.
- Install PyCharm IDE.
- Start PyCharm IDE.
- Create New Project. If you have existing interpreters, choose the one that was installed by ArcGIS.

- Open File-Settings (or Ctrl+Alt+S).
- Click on Project Interpreter.

- Click on the gear icon (near the top right corner of the window).
- Select "Create VirtualEnv". This will give you a separate Python environment for each project.
- Give the virtual environment a name and location.
- Check "Inherit global site-packages".

- Click OK to clear the Settings windows.
- Go to the Project window.
- Right-click on "MyFirstArcpyProject".
- Select New-Python File.

- Call the new Python file "ExtractSpatialData.py".
- Go to your ArcMap or ArcCatalog's geoprocessing results frame.
- Right-click on the operation that you want to reuse.

- Click on "Copy As Python Snippet".
- Go to the PyCharm window.
- Paste the clipboard contents in ExtractSpatialData.py.
- Go to the top of the file.
- Add the line "import arcpy".
- Add the line "arcpy.env.workspace = <path to your datasets>".

- Run ExtractSpatialData.py (Ctrl+Shift+F10).
Instead of setting arcpy.env.workspace, you can also use the full path name to your input, clip, and output feature classes. If you are using extensions such as spatial analysis, you will need to checkout the license, e.g. arcpy.CheckOutExtension("Spatial"). See checkoutextension for more details.
Subscribe to:
Comments (Atom)