Assette will soon restrict the use of the Python import statement in Data Blocks. Clients are advised not to use this feature in any Python Data Block. Instead, use Configuration Data Blocks, as illustrated in the CalculationEnv Configuration Data Block example. This ensures compliance with platform security and functionality guidelines.
Restricted Data Block Keywords & Built-in Functions #
Python keywords are core language constructs interpreted by the Python parser. These reserved words cannot be used as identifiers within your scripts. For detailed guidance on Python keywords, refer to the official Python documentation.
Similarly, Python built-in functions include a predefined set of utilities such as types, exceptions, constants, and commonly used functions. Refer to the official Python built-in functions documentation for more details.
Restricted Python Keywords #
| Keyword | Definition | 
|---|---|
| read | A system-defined function used to retrieve data from a Data Block. Learn more | 
| response | A system-defined dictionary-like object used to define final outputs of a Data Block. Keys correspond to elements in the presentation layer such as charts, tables, or text fields. | 
| params | A system-supplied object containing input parameters for the Data Block at runtime. These enable dynamic behavior based on report or dashboard configurations. | 
Prohibited Python Keywords #
| Keyword | Notes | 
|---|---|
| import | Prohibited. Use Configuration Data Blocks and declared Data Block dependencies instead. | 
| return | Has no operational effect. All Data Block output must be assigned through the response object in JSON format. | 
Supported Python Libraries #
The following Python libraries are whitelisted and supported within Assette. These libraries must be included through Configuration Data Blocks. For implementation examples, refer to the Calculation Environment Data Block.
| Python Library | Description | Documentation | 
|---|---|---|
| base64 | Encodes and decodes data using Base64 and other binary-to-text encoding schemes. | docs.python.org – base64 | 
| calendar | Allows formatting and manipulation of calendar-related functions. | docs.python.org – calendar | 
| collections | Implements specialized container datatypes like namedtuple, deque, Counter, etc. | docs.python.org – collections | 
| dateutil.easter | Computes the date of Easter Sunday for any given year. | dateutil.easter (GitHub) | 
| dateutil.parser | Parses dates from strings in multiple formats. | dateutil.parser (GitHub) | 
| dateutil.relativedelta | Provides relative date operations such as adding months or years to a date. | dateutil.relativedelta (GitHub) | 
| dateutil.rrule | Allows date recurrence rule evaluation as defined in RFC 2445. | dateutil.rrule (GitHub) | 
| datetime | Supplies classes for manipulating dates and times. | docs.python.org – datetime | 
| decimal | Implements fast correctly-rounded decimal floating point arithmetic. | docs.python.org – decimal | 
| functools | Provides higher-order functions that act on or return other functions. | docs.python.org – functools | 
| html.parser | A simple HTML and XHTML parser. | docs.python.org – html.parser | 
| json | Provides tools for parsing JSON strings and converting Python objects to JSON format. | docs.python.org – json | 
| locale | Provides access to POSIX locale databases and functionality. | docs.python.org – locale | 
| math | Provides mathematical functions like logarithms, trigonometry, factorial, etc. | docs.python.org – math | 
| matplotlib.pyplot | A MATLAB-style interface for creating static, interactive, and animated visualizations in Python. | matplotlib.org – pyplot | 
| numpy | A fundamental package for numerical computing with support for large, multi-dimensional arrays and matrices. | numpy.org | 
| pandas | A powerful data analysis and manipulation library built on top of NumPy. | pandas.pydata.org | 
| pygal | A Python SVG charting library that is highly customizable and interactive. | pygal.org | 
| pygal-maps-world | World map support plugin for pygal. | pygal-maps-world (GitHub) | 
| pytz | Enables timezone calculations and conversions. | pypi.org – pytz | 
| random | Implements pseudo-random number generators for various distributions. | docs.python.org – random | 
| re | Offers regular expression matching operations. | docs.python.org – re | 
| scipy | A Python library used for scientific and technical computing built on NumPy. | scipy.org | 
| textwrap3 | A third-party backport of Python 3’s textwrap module for text formatting. | pypi.org – textwrap3 | 
| time | Provides time-related functions. | docs.python.org – time | 
| typing | Supports type hints and static type checking. | docs.python.org – typing | 
If you require access to additional Python libraries that are not listed here, please contact Assette Client Service at clientservice@assette.com.