Skip to content

Commit 6226daf

Browse files
authored
Merge pull request #362 from Peefy/polish-intro-docs
docs: polish intro documents
2 parents 26c68b5 + 7fdbb8d commit 6226daf

File tree

9 files changed

+233
-1087
lines changed

9 files changed

+233
-1087
lines changed

docs/community/release-policy/kcl.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,6 @@ The KCL project version release strategy is as follows:
2222
- Release Documentation: Detailed documentation, including release notes, update logs, API documentation, and usage guides, is provided during the release to help users understand and use the new version. In KCL, this documentation is maintained on the KCL website.
2323
- Version Compatibility: When releasing a new version, compatibility is maintained as much as possible to minimize the need for modifications and adaptations by users. Since KCL has not reached version 1 yet, there are no compatibility guarantees at the moment. The goal of KCL is to minimize major changes unless they provide significant benefits, such as solving problems in the target scenarios or improving the overall user experience. For features or changes that may introduce compatibility issues, appropriate prompts and solutions will be provided. Gradual upgrade guides or automated migration tools will be offered to help users smoothly transition to the new version.
2424

25-
## Release Components
26-
27-
![](/img/docs/community/release-policy/kcl-components.png)
28-
29-
For each version release, all related components of KCL depend on the same major version of the KCL core. The dependencies are organized in a tree structure and released and regression tested in a specific order until the release testing is completed, with efforts made to avoid triangular dependencies and prohibit circular dependencies.
30-
3125
## Lifecycle of a Feature
3226

3327
- Design and Documentation: Clearly answer the motivations, problems to be solved, and goals of the feature through issues. Define user requirements and user stories. Specify what the feature does, how it is implemented, its difficulty level, estimated time, dependencies, and testing requirements. (Tips: Split large designs into smaller ones, find a simple and sustainable solution through trade-offs and extensive research, and ensure scalability to adapt to future business or technical changes. Finalize the design through continuous discussions and design reviews).

docs/reference/lang/spec/modules.md

Lines changed: 1 addition & 280 deletions
Original file line numberDiff line numberDiff line change
@@ -84,286 +84,7 @@ Searching by location path should be supported by the kcl compiler, which needs
8484

8585
## Standard System Packages
8686

87-
KCL supports a few standard system modules. The following is the full list of these standard system modules:
88-
89-
<table>
90-
<tr>
91-
<td><b>Package</b></td>
92-
<td><b>Member</b></td>
93-
</tr>
94-
<tr>
95-
<td rowspan="4">datetime</td>
96-
<td>today</td>
97-
</tr>
98-
<tr><td>now</td></tr>
99-
<tr><td>ticks</td></tr>
100-
<tr><td>date</td></tr>
101-
<tr>
102-
<td rowspan="16">math</td>
103-
<td>ceil</td>
104-
</tr>
105-
<tr><td>exp</td></tr>
106-
<tr><td>expm1</td></tr>
107-
<tr><td>factorial</td></tr>
108-
<tr><td>floor</td></tr>
109-
<tr><td>gcd</td></tr>
110-
<tr><td>isfinite</td></tr>
111-
<tr><td>isinf</td></tr>
112-
<tr><td>isnan</td></tr>
113-
<tr><td>log</td></tr>
114-
<tr><td>log1p</td></tr>
115-
<tr><td>log2</td></tr>
116-
<tr><td>log10</td></tr>
117-
<tr><td>modf</td></tr>
118-
<tr><td>pow</td></tr>
119-
<tr><td>sqrt</td></tr>
120-
<tr>
121-
<td rowspan="6">regex</td>
122-
<td>replace</td>
123-
</tr>
124-
<tr><td>match</td></tr>
125-
<tr><td>compile</td></tr>
126-
<tr><td>findall</td></tr>
127-
<tr><td>search</td></tr>
128-
<tr><td>split</td></tr>
129-
<tr>
130-
<td rowspan="27">units</td>
131-
<td>n</td>
132-
</tr>
133-
<tr><td>u</td></tr>
134-
<tr><td>m</td></tr>
135-
<tr><td>k</td></tr>
136-
<tr><td>K</td></tr>
137-
<tr><td>M</td></tr>
138-
<tr><td>G</td></tr>
139-
<tr><td>T</td></tr>
140-
<tr><td>P</td></tr>
141-
<tr><td>Ki</td></tr>
142-
<tr><td>Mi</td></tr>
143-
<tr><td>Gi</td></tr>
144-
<tr><td>Ti</td></tr>
145-
<tr><td>Pi</td></tr>
146-
<tr><td>to_n</td></tr>
147-
<tr><td>to_u</td></tr>
148-
<tr><td>to_m</td></tr>
149-
<tr><td>to_K</td></tr>
150-
<tr><td>to_M</td></tr>
151-
<tr><td>to_G</td></tr>
152-
<tr><td>to_T</td></tr>
153-
<tr><td>to_P</td></tr>
154-
<tr><td>to_Ki</td></tr>
155-
<tr><td>to_Mi</td></tr>
156-
<tr><td>to_Gi</td></tr>
157-
<tr><td>to_Ti</td></tr>
158-
<tr><td>to_Pi</td></tr>
159-
<tr>
160-
<td rowspan="3">json</td>
161-
<td>encode</td>
162-
</tr>
163-
<tr><td>decode</td></tr>
164-
<tr><td>dump_to_file</td></tr>
165-
<tr>
166-
<td rowspan="3">yaml</td>
167-
<td>encode</td>
168-
</tr>
169-
<tr><td>decode</td></tr>
170-
<tr><td>dump_to_file</td></tr>
171-
<tr>
172-
<td rowspan="16">net</td>
173-
<td>split_host_port</td>
174-
</tr>
175-
<tr><td>join_host_port</td></tr>
176-
<tr><td>fqdn</td></tr>
177-
<tr><td>parse_IP</td></tr>
178-
<tr><td>to_IP4</td></tr>
179-
<tr><td>to_IP16</td></tr>
180-
<tr><td>IP_string</td></tr>
181-
<tr><td>is_IPv4</td></tr>
182-
<tr><td>is_IP</td></tr>
183-
<tr><td>is_loopback_IP</td></tr>
184-
<tr><td>is_multicast_IP</td></tr>
185-
<tr><td>is_interface_local_multicast_IP</td></tr>
186-
<tr><td>is_link_local_multicast_IP</td></tr>
187-
<tr><td>is_link_local_unicast_IP</td></tr>
188-
<tr><td>is_global_unicast_IP</td></tr>
189-
<tr><td>is_unspecified_IP</td></tr>
190-
<tr>
191-
<td rowspan="2">base64</td>
192-
<td>encode</td>
193-
</tr>
194-
<tr><td>decode</td></tr>
195-
<tr>
196-
<td rowspan="6">crypto</td>
197-
<td>md5</td>
198-
</tr>
199-
<tr><td>sha1</td></tr>
200-
<tr><td>sha224</td></tr>
201-
<tr><td>sha256</td></tr>
202-
<tr><td>sha384</td></tr>
203-
<tr><td>sha512</td></tr>
204-
</table>
205-
206-
- datetime
207-
- ticks() -> float
208-
Return the current time in seconds since the Epoch. Fractions of a second may be present if the system clock provides them.
209-
- date() -> str
210-
return the `%Y-%m-%d %H:%M:%S` format date.
211-
- now() -> str
212-
return the local time. e.g. `'Sat Jun 06 16:26:11 1998'`
213-
- today() -> str
214-
return the `%Y-%m-%d %H:%M:%S.%{ticks}` format date.
215-
- math
216-
- ceil(x) -> int
217-
Return the ceiling of x as an Integral. This is the smallest integer >= x.
218-
- factorial(x) -> int
219-
Return x!. Raise a error if x is negative or non-integral.
220-
- floor(x) -> int
221-
Return the floor of x as an Integral. This is the largest integer <= x.
222-
- gcd(a: int, b: int) -> int
223-
Return the greatest common divisor of x and y
224-
- isfinite(x) -> bool
225-
Return True if x is neither an infinity nor a NaN, and False otherwise.
226-
- isinf(x) -> bool
227-
Return True if x is a positive or negative infinity, and False otherwise.
228-
- isnan(x) -> bool
229-
Return True if x is a NaN (not a number), and False otherwise.
230-
- modf(x) -> Listfloat, float]
231-
Return the fractional and integer parts of x. Both results carry the sign of x and are floats.
232-
- exp(x) -> float
233-
Return e raised to the power of x.
234-
- expm1(x) -> float
235-
Return exp(x)-1. This function avoids the loss of precision involved in the direct evaluation of exp(x)-1 for small x.
236-
- log(x, base=2.71828182845904523536028747135266250) -> float
237-
Return the logarithm of x to the base e.
238-
- log1p(x) -> float
239-
Return the natural logarithm of 1+x (base e). The result is computed in a way which is accurate for x near zero.
240-
- log2(x) -> float
241-
Return the base 2 logarithm of x.
242-
- log10(x) -> float
243-
Return the base 10 logarithm of x.
244-
- pow(x, y) -> float
245-
Return x\*\*y (x to the power of y).
246-
- sqrt(x) -> float
247-
Return the square root of x.
248-
- regex
249-
- replace(string: str, pattern: str, replace: str, count=0) -> str
250-
Return the string obtained by replacing the leftmost non-overlapping occurrences of the pattern in string by the replacement.
251-
- match(string: str, pattern: str) -> bool
252-
Try to apply the pattern at the start of the string, returning a bool value True if any match was found, or False if no match was found.
253-
- compile(pattern: str) -> bool
254-
Compile a regular expression pattern, returning a bool value denoting whether the pattern is valid.
255-
- findall(string: str, pattern: str) -> List[str]
256-
Return a list of all non-overlapping matches in the string.
257-
- search(string: str, pattern: str) -> bool
258-
Scan through string looking for a match to the pattern, returning a bool value True if any match was found, or False if no match was found.
259-
- split(string: str, pattern: str, maxsplit=0) -> List[str]
260-
Scan through string looking for a match to the pattern, returning a Match object, or None if no match was found.
261-
- units
262-
- Unit constants
263-
- Fixed point: `n`, `u`, `m`, `k`, `K`, `G`, `T` and `P`.
264-
- Power of 2: `Ki`, `Mi`, `Gi`, `Ti` and `Pi`.
265-
- Functions
266-
- to_n(num: int) -> str
267-
Int literal to string with `n` suffix
268-
- to_u(num: int) -> str
269-
Int literal to string with `u` suffix
270-
- to_m(num: int) -> str
271-
Int literal to string with `m` suffix
272-
- to_K(num: int) -> str
273-
Int literal to string with `K` suffix
274-
- to_M(num: int) -> str
275-
Int literal to string with `M` suffix
276-
- to_G(num: int) -> str
277-
Int literal to string with `G` suffix
278-
- to_T(num: int) -> str
279-
Int literal to string with `T` suffix
280-
- to_P(num: int) -> str
281-
Int literal to string with `P` suffix
282-
- to_Ki(num: int) -> str
283-
Int literal to string with `Ki` suffix
284-
- to_Mi(num: int) -> str
285-
Int literal to string with `Mi` suffix
286-
- to_Gi(num: int) -> str
287-
Int literal to string with `Gi` suffix
288-
- to_Ti(num: int) -> str
289-
Int literal to string with `Ti` suffix
290-
- to_Pi(num: int) -> str
291-
Int literal to string with `Pi` suffix
292-
- json
293-
- encode(data: any, sort_keys: bool = False, indent: int = None, ignore_private: bool = False, ignore_none: bool = False) -> str
294-
Serialize a KCL object `data` to a JSON formatted str.
295-
- decode(value: str) -> any
296-
Deserialize `value` (a string instance containing a JSON document) to a KCL object.
297-
- dump_to_file(data: any, filename: str, ignore_private: bool = False, ignore_none: bool = False) -> None
298-
Serialize a KCL object `data` to a JSON formatted str and write it into the file `filename`.
299-
- validate(data: any) -> bool
300-
Validate whether the given string is a valid JSON.
301-
- yaml
302-
- encode(data: any, sort_keys: bool = False, ignore_private: bool = False, ignore_none: bool = False) -> str
303-
Serialize a KCL object `data` to a YAML formatted str.
304-
- encode_all(data: [any], sort_keys: bool = False, ignore_private: bool = False, ignore_none: bool = False) -> str
305-
Serialize a sequence of KCL objects into a YAML stream str.
306-
- decode(value: str) -> any
307-
Deserialize `value` (a string instance containing a YAML document) to a KCL object.
308-
- decode_all(value: str) -> [any]
309-
- dump_to_file(data: any, filename: str, ignore_private: bool = False, ignore_none: bool = False) -> None
310-
Serialize a KCL object `data` to a YAML formatted str and write it into the file `filename`.
311-
Parse all YAML documents in a stream and produce corresponding KCL objects.
312-
- validate(value: str) -> str
313-
Validate whether the given string is a valid YAML or YAML stream document.
314-
- net
315-
- split_host_port(ip_end_point: str) -> List[str]
316-
Split the 'host' and 'port' from the ip end point.
317-
- join_host_port(host, port) -> str
318-
Merge the 'host' and 'port'.
319-
- fqdn(name: str = '') -> str
320-
Return Fully Qualified Domain Name (FQDN).
321-
- parse_IP(ip) -> str
322-
Parse 'ip' to a real IP address
323-
- to_IP4(ip) -> str
324-
Get the IP4 form of 'ip'.
325-
- to_IP16(ip) -> int
326-
Get the IP16 form of 'ip'.
327-
- IP_string(ip: str | int) -> str
328-
Get the IP string.
329-
- is_IPv4(ip: str) -> bool
330-
Whether 'ip' is a IPv4 one.
331-
- is_IP(ip: str) -> bool
332-
Whether ip is a valid ip address.
333-
- is_loopback_IP(ip: str) -> bool
334-
Whether 'ip' is a loopback one.
335-
- is_multicast_IP(ip: str) -> bool
336-
Whether 'ip' is a multicast one.
337-
- is_interface_local_multicast_IP(ip: str) -> bool
338-
Whether 'ip' is a interface, local and multicast one.
339-
- is_link_local_multicast_IP(ip: str) -> bool
340-
Whether 'ip' is a link local and multicast one.
341-
- is_link_local_unicast_IP(ip: str) -> bool
342-
Whether 'ip' is a link local and unicast one.
343-
- is_global_unicast_IP(ip: str) -> bool
344-
Whether 'ip' is a global and unicast one.
345-
- is_unspecified_IP(ip: str) -> bool
346-
Whether 'ip' is a unspecified one.
347-
- base64
348-
- encode(value: str, encoding: str = "utf-8") -> str
349-
Encode the string `value` using the codec registered for encoding.
350-
- decode(value: str, encoding: str = "utf-8") -> str
351-
Decode the string `value` using the codec registered for encoding.
352-
- crypto
353-
- md5(value: str, encoding: str = "utf-8") -> str
354-
Encrypt the string `value` using `MD5` and the codec registered for encoding.
355-
- sha1(value: str, encoding: str = "utf-8") -> str
356-
Encrypt the string `value` using `SHA1` and the codec registered for encoding.
357-
- sha224(value: str, encoding: str = "utf-8") -> str
358-
Encrypt the string `value` using `SHA224` and the codec registered for encoding.
359-
- sha256(value: str, encoding: str = "utf-8") -> str
360-
Encrypt the string `value` using `SHA256` and the codec registered for encoding.
361-
- sha384(value: str, encoding: str = "utf-8") -> str
362-
Encrypt the string `value` using `SHA384` and the codec registered for encoding.
363-
- sha512(value: str, encoding: str = "utf-8") -> str
364-
Encrypt the string `value` using `SHA512` and the codec registered for encoding.
365-
- manifests
366-
- `yaml_stream(values: [any], opts: {str:} = {sort_keys = False, ignore_private = True, ignore_none = False, sep = "---"}`. This function is used to serialize the KCL object list into YAML output with the `---` separator
87+
KCL supports a few standard system modules. [Here](docs/reference/model/overview) is the full list of these standard system modules.
36788

36889
### The Built-in System Package
36990

0 commit comments

Comments
 (0)