Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Engine Works

Under the hood of Alteryx: tips, tricks and how-tos.
cam_w
11 - Bolide

After Inspire 2018 in Anaheim, I was keen to start using the Python SDK. I was learning Python online at UCI, and the SDK seemed like a great way to level up in Alteryx. However, with many other important things to work on, I didn’t learn as much as I wanted to, and as Inspire 2019 approached I was still struggling with HTML SDK components in my custom tools.

 

Enter the (little) dragon, aka SnakePlane! If you haven’t already read the introduction and you want to build with Python on Alteryx, you should go do that. And if you want a tutorial, there’s a helpful step-by-step guide available to help you get started. So in the week before Inspire this year, I reached out for help and @SydneyF recommended that I sign up for BUILD2. It looked like just what I needed; spend some time working with the SDK tools.

 

Ideas are important

 

It’s important to be prepared; ask any scout! I am an avid reader of the Community forums, and one particular idea piqued my interest. So I mocked up some controls for the potential tool in an App using the Interface tools and Interface Designer.

 

interface designer.png

 

With this rudimentary preparation and a couple other ideas to which I could pivot if needed, I walked into the conference room in Nashville, not really knowing what to expect.

 

BUILD for good, or for ‘other’ good

 

This year, BUILD2 had five different tracks, including the Alteryx for Good track which was back for the second year. The other tracks had varying degrees of requirements and openness, including an Open track where the participants could build anything they wanted to build for Alteryx. So far, I was feeling good about my selection to build a tool for the community.

 

Socializing the project

 

Most of the tables in the room were packed, and discussion about the emerging projects was lively, bringing a pleasant excitement tinged hum. The SDK track section didn’t have as many participants as other tracks, and many of us came with projects to work on. In the end, I ended up working on my own, but I had picked a project that was manageable so I was still feeling okay about my choice.

 

My recommendation for future attendees is to build a diverse team in the lead up to Inspire and make room to pivot and expand when you arrive. There are good reasons to plan ahead, and also to expand when necessary.

 

Connect with the Alteryx team

 

There were several Alteryx team members in the room, and it was a prime opportunity to meet them face to face and discuss the SDK platform in more detail. Along with the Solution Center and UX Lab, BUILD2 was among the best opportunities I had this year to meet and discuss the Alteryx platform with folk who work on it every day.

 

Additionally, the Alteryx team provided support through the day when any of the teams had questions. I had a couple typos in my HTML file that was blocking progress for a while, and I got help to debug them faster than I could have done it myself.

 

Make it fun

 

Most importantly, I was committed to enjoy the experience in general. I wanted to have fun learning new SDK things, meeting new people, and building a fun tool. The competition was a way to do all of that, but also meant that I needed to submit something at the end of the day. Akin to a compressed college class!

 

For my project I picked a Python related name – Slither – to complement the fun SnakePlane name. And to go with a cool name, I searched for a free, and copyright free, icon to include in my YXI package. I feel good about the choice; it shouts ‘Slither’. Even if it has nothing whatsoever to do with the tool functionality.

 

icon.png

 

Include a sprinkle of functionality

 

Fun name and icon sourced, now I added in some Python code to make it useful. This is where I started to doubt my choice, because I hit the aforementioned errors in my HTML SDK widgets. It’s amazing how much time debugging can suck away from core development, but every lesson is valuable even the embarrassing ones!

 

Finally I was able to build the core functionality, and submitted the project by the deadline.

 

Lessons learned

 

Along the way I learned a lot about SnakePlane, but the first thing I’d like to share is actually about using the power of Python to your advantage. This was the first attempt at moving the GUI data name values from the OrderedDict (workflow_config) into the SimpleNamespace (user_data) for later use:

 

python1.png

 

And after working in SnakePlane for a while, it turned into this:

 

python2.png

 

The second thing is to read the tasks.py code, because the ‘build’ and ‘package’ invoke tasks have positional parameter options for reading from different ‘src’ locations, and packaging the code to different ‘package’ locations. This will be very helpful to me as I start to build a catalog of tools for our company.

 

python3.png

 

Next year in… New Orleans!

 

In many ways, I’d love to repeat the BUILD2 experience all over again at Inspire 2020. However, in some ways, it is too valuable to keep to myself. So I’ll be recommending the experience to my colleagues all 12 months until the ‘Big Easy’ starts welcoming us into its vibrant streets. Hopefully others feel the same, and the BUILD3 session (touch wood) sees growth for next year!

 

Thanks to the entire Alteryx team for a great session! And in particular to @Ozzie@SydneyF and @NeilR for looking at my errors! And to @JPKa for explaining SnakePlane in more detail!


DOWNLOAD THE SLITHER TOOL HERE.

Comments
JPKa
Alteryx Alumni (Retired)

@cam_w   

Just wanted to let you know:  

 

Snakeplane can now be installed with "pip install snakeplane", so you no longer need to have the folder sitting along with your code.  

 

Additionally, we uncovered a bug with how we were interfacing with Alteryx's C++ objects that was causing the tools built with it to run much slower than necessary.  We've fixed that, so you should see a radical improvement in performance, especially with larger datasets.  

cam_w
11 - Bolide

Thank you @JPKa !

cam_w
11 - Bolide

For others also making the change, I took the following steps:

 

  1. Activated the env and installed the new package:
    • .\env\Scripts\Activate.ps1
    • pip install snakeplane
  2. Froze the requirements to update .\env\requirements.txt:
    • inv freeze
  3. Modified the tasks.py file:
    • Commented the line calling copy_snakeplane() in the def build_tool_target_dir()
    • Removed the "snakeplane" list item from dirs_list in the def move_to_tools_folder()
  4. Rebuilt the packages to copy the requirements back to "%APPDATA%\Alteryx\Tools\"
    • inv build MyToolName
    • Note - I could have used the -u flag here to update the env requirements, which would have saved the following step.
  5. *** Not needed if you use the -u in the "inv build" command in step 3. In a command prompt window, activated the Virtual Environments in the "%APPDATA%\Alteryx\Tools\MyToolName\" directory and installed the new package:
    • .\Scripts\activate.bat
    • pip install snakeplane
  6. Confirmed that the "snakeplane" directory was removed from the "%APPDATA%\Alteryx\Tools\MyToolName\" directory.
  7. Tested the tool to make sure it was picking up the installed package:
    • inv debug MyToolName