arcpy in Visual Studio 2015

I wanted to switch from PyCharm to Visual Studio for my Python (more specific: arcpy) development, since we do a lot of developing in VS and I figured it would be nice to have a single development environment. I was pleasantly suprised that Python was available out-of-the-box after installing VS. But would it recognize my arcpy sitepackage (which was already present in my C:\Python27\ArcGISx6410.3 directory, since ArcGIS for Desktop is installed on my system).

Guess what? No, it didn’t.

But then I came across this blogpost. And it totally was applicable to my situation. So, if you think VS doesn’t understand arcpy, wait a few minutes after your first try… Thank you, Cindy Williams, for saving me a lot of frustration.

Look Ma, no squiggly lines!

Some more reading on arcpy in Visual Studio can be found here.

Advertisements

Distributing custom ArcGIS toolboxes using Python Modules

ArcGIS Python Toolbox Distribution folder structure

image: courtesy Esri

A colleague of mine (thanks Marc!) came across a very handy mechanism to distribute your ArcGIS Python toolboxes and script tools. You can build your own Python Distribution to encapsulate a custom Python module, accompanying toolboxes and helpfiles and distribute it to your audience, by utilizing the Python Distribution Utilities (Distutils). It also builds an installer (such as “mytool-1.0-win32.exe” for Windows), that will install your module in the site-packages directory.

If you include a subdirectory “esri” in your project (see screenshot), any toolboxes or script tools will appear in the Systems Toolboxes in ArcGIS for Desktop, which is also very convenient.

The mechanism is described in the ArcGIS Python Help (here). The help item neatly describes which steps to take and also which naming conventions apply.

Using an arcpy Python toolbox (.pyt) as a Print Service in ArcGIS for Server

A Python Toolbox

Python toolboxes in ArcGIS are great. They’re even better then regular Python script in Toolboxes. Let me explain why and show you how to use an Python toolbox in a Print Service in ArcGIS for Server.

Since many years now, when you do any geoprocessing in ArcGIS for Desktop, you are able to incorporate a script in an toolbox in ArcMap or ArcCatalog. This enables you to do some more customizing if compared to the “drag-and-drop” modelling in toolboxes.

Continue reading