Running arbitrary Python in CircleCI 2.0

In CircleCI 2.0 you can define the shell at the exector level or the individual command level. Here is how you can utilize that to run any arbitrary Python in a single run command:

- run:
    shell: /usr/bin/python
    command: |
      import os
      print(os.environ)

Running this will print all the environment variables present in the Python shell to stdout.

If you're more comfortable with Python than bash, feel free to write your CircleCI config in Python.