cylc / cylc-flow

Cylc: a workflow engine for cycling systems.
https://cylc.github.io
GNU General Public License v3.0
335 stars 94 forks source link

Documentation for task name allowed characters is slightly incorrect #6288

Open jfrost-mo opened 3 months ago

jfrost-mo commented 3 months ago

Description

The cylc.flow.unicode_rules.TaskNameValidator documentation states that workflows must start with an alphanumeric character, and contain only alphanumeric, -, +, %, and @ characters. However it can also contain _ characters, which is not documented.

Specifically this comes from using the \w regex class, which:

Matches Unicode word characters; this includes all Unicode alphanumeric characters (as defined by str.isalnum()), as well as the underscore (_).

This class also contains many characters outside the possibly expected [a-zA-Z0-9_], such as (U+2153 Vulgar Fraction One Third), though these are likely less frequently used in workflows than underscores.

>>> "⅓".isalnum()
True
>>> "日本".isalnum()
True

Expected Behaviour

Underscores should be contained in the documentation, probably also that other characters are supported, maybe by linking to the python isalnum str method. At least it should check that everyone is properly supporting Unicode.

oliver-sanders commented 2 months ago

See also https://github.com/cylc/cylc-flow/issues/6375

elliotfontaine commented 2 months ago

Currently, _ doesn't follow the same rule as -, +, % : it's allowed as the first character for task name.

elliotfontaine commented 2 months ago

For future reference, as this is undocumented (doesn't need to be):

⅓ 12 ³eçàÙ感µ:!.^$-+_()/ is a valid setting key.

Two consecutive spaces, or any of the following characters, are forbidden in setting key: #=%@§€£*±;?¿¡`'"°¶®🐍[]{}<>\

These lists are not comprehensive.

This isn't of much use, except for arbitrary settings in [[[meta]]] sections. Obviously, keys in a task [[[environment]]] are more strict (must be legit shell variable names).