Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,22 @@ jobs:
- name: Check F# code
run: dotnet fantomas . --check --verbosity d

- name: Set up Python 3.13
uses: actions/setup-python@v7
with:
python-version: "3.13"

- name: Set up uv
uses: astral-sh/setup-uv@v7
with:
enable-cache: true

- name: Check Python imports and exports
run: uv run --frozen ruff check --select I,RUF022,RUF068 src/fable-library-py

- name: Check Python formatting
run: uv run --frozen ruff format --check src/fable-library-py

# Verify that Fable.sln can be restored
# See: https://github.com/fable-compiler/Fable/issues/3687
restore-project:
Expand Down
10 changes: 5 additions & 5 deletions src/fable-library-py/fable_library/array_.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@
"UInt64ArrayCons",
"add_in_place",
"add_range_in_place",
"all_pairs",
"append",
"average",
"average_by",
Expand All @@ -211,6 +212,7 @@
"create",
"empty",
"equals_with",
"exactly_one",
"exists",
"exists2",
"exists_offset",
Expand Down Expand Up @@ -261,8 +263,6 @@
"partition",
"permute",
"pick",
"reduce",
"reduce_back",
"random_choice",
"random_choice_by",
"random_choice_with",
Expand All @@ -278,6 +278,8 @@
"random_shuffle_in_place_by",
"random_shuffle_in_place_with",
"random_shuffle_with",
"reduce",
"reduce_back",
"remove_all_in_place",
"remove_at",
"remove_in_place",
Expand All @@ -301,8 +303,6 @@
"split_into",
"sum",
"sum_by",
"all_pairs",
"exactly_one",
"tail",
"take",
"take_while",
Expand All @@ -320,8 +320,8 @@
"unzip",
"unzip3",
"update_at",
"windowed",
"where",
"windowed",
"zero_create",
"zip",
"zip3",
Expand Down
20 changes: 20 additions & 0 deletions src/fable-library-py/fable_library/async_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -456,3 +456,23 @@ def Zero(self) -> Async[None]:


singleton = AsyncBuilder()


__all__ = [
"AnonymousAsyncContext",
"Async",
"AsyncBuilder",
"CancellationCallbackError",
"CancellationToken",
"Continuations",
"IAsyncContext",
"OperationCanceledError",
"ScheduledItem",
"TaskCanceledError",
"Trampoline",
"empty_continuation",
"protected_bind",
"protected_cont",
"protected_return",
"singleton",
]
1 change: 0 additions & 1 deletion src/fable-library-py/fable_library/char.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,6 @@ def parse(input: str) -> str:
"is_number",
"is_punctuation",
"is_separator",
"is_separator",
"is_surrogate",
"is_surrogate_pair",
"is_symbol",
Expand Down
5 changes: 4 additions & 1 deletion src/fable-library-py/fable_library/core/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
from math import copysign as _copysign, fmod as _fmod, inf as _inf, nan as _nan
from math import copysign as _copysign
from math import fmod as _fmod
from math import inf as _inf
from math import nan as _nan
from typing import Literal, SupportsFloat, SupportsInt

from ._core import (
Expand Down
8 changes: 8 additions & 0 deletions src/fable-library-py/fable_library/diagnostics.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,11 @@ def frequency() -> int:

def get_timestamp() -> int64:
return int64(time.perf_counter_ns())


__all__ = [
"StopWatch",
"TimerError",
"frequency",
"get_timestamp",
]
22 changes: 22 additions & 0 deletions src/fable-library-py/fable_library/event.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,3 +217,25 @@ def create_event[T](
remove_handler: Callable[[DotNetDelegate[T]], None],
) -> IEvent[T]:
return AnonymousEvent[T](add_handler, remove_handler)


__all__ = [
"AnonymousEvent",
"Delegate",
"DotNetDelegate",
"Event",
"EventDelegate",
"IDelegateEvent",
"IEvent",
"IEvent_2",
"add",
"choose",
"create_event",
"filter",
"map",
"merge",
"pairwise",
"partition",
"scan",
"split",
]
13 changes: 13 additions & 0 deletions src/fable-library-py/fable_library/exception_bases.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,16 @@ class MemoryErrorBase(ExceptionBase, MemoryError):

class TimeoutErrorBase(ExceptionBase, TimeoutError):
"""A timeout error with .NET message and inner-exception support."""


__all__ = [
"ExceptionBase",
"IndexErrorBase",
"MemoryErrorBase",
"NotImplementedErrorBase",
"OverflowErrorBase",
"RuntimeErrorBase",
"TimeoutErrorBase",
"ValueErrorBase",
"ZeroDivisionErrorBase",
]
21 changes: 21 additions & 0 deletions src/fable-library-py/fable_library/file.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,3 +107,24 @@ def replace(source_file_name: str, destination_file_name: str, destination_backu
with open(destination_backup_file_name, "wb") as f:
f.write(data)
os.replace(source_file_name, destination_file_name)


__all__ = [
"copy",
"delete",
"exists",
"move",
"read_all_bytes",
"read_all_bytes_async",
"read_all_lines",
"read_all_lines_async",
"read_all_text",
"read_all_text_async",
"replace",
"write_all_bytes",
"write_all_bytes_async",
"write_all_lines",
"write_all_lines_async",
"write_all_text",
"write_all_text_async",
]
25 changes: 0 additions & 25 deletions src/fable-library-py/fable_library/long.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,54 +304,29 @@ def to_string(x: int64 | uint64) -> str:
"from_value",
"get_range",
"max",
"max",
"min",
"min",
"op_addition",
"op_addition",
"op_bitwise_and",
"op_bitwise_and",
"op_bitwise_or",
"op_bitwise_or",
"op_division",
"op_division",
"op_equality",
"op_equality",
"op_exclusive_or",
"op_exclusive_or",
"op_greater_than",
"op_greater_than",
"op_greater_than_or_equal",
"op_greater_than_or_equal",
"op_inequality",
"op_inequality",
"op_left_shift",
"op_left_shift",
"op_less_than",
"op_less_than",
"op_less_than_or_equal",
"op_less_than_or_equal",
"op_logical_not",
"op_logical_not",
"op_modulus",
"op_modulus",
"op_multiply",
"op_multiply",
"op_right_shift",
"op_right_shift",
"op_subtraction",
"op_subtraction",
"op_unary_negation",
"op_unary_negation",
"op_unary_plus",
"op_unary_plus",
"parse",
"parse",
"sign",
"sign",
"to_number",
"to_string",
"to_string",
"try_parse",
"try_parse",
]
28 changes: 28 additions & 0 deletions src/fable-library-py/fable_library/map_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,3 +272,31 @@ def assign(key: str, case_rule: CaseRules, value: Any):
fail(kv_pair)

return obj


__all__ = [
"CaseRules",
"add_to_dict",
"add_to_set",
"change_case",
"contains_in_set",
"contains_value",
"copy_to_array_from_set",
"dashify",
"except_with_set",
"get_item_from_dict",
"intersect_with_set",
"is_proper_subset_of_set",
"is_proper_superset_of_set",
"is_subset_of_set",
"is_superset_of_set",
"key_value_list",
"make_dict",
"overlaps_with_set",
"remove_from_dict",
"remove_from_set",
"set_equals_set",
"symmetric_except_with_set",
"try_get_value",
"union_with_set",
]
19 changes: 19 additions & 0 deletions src/fable-library-py/fable_library/observable.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,3 +216,22 @@ def split[T, U, V](
choose(lambda v: Choice_tryValueIfChoice1Of2(splitter(v)), source),
choose(lambda v: Choice_tryValueIfChoice2Of2(splitter(v)), source),
)


__all__ = [
"IObservable",
"IObserver",
"Observable",
"Observer",
"add",
"choose",
"filter",
"map",
"merge",
"pairwise",
"partition",
"protect",
"scan",
"split",
"subscribe",
]
28 changes: 28 additions & 0 deletions src/fable-library-py/fable_library/protocols.py
Original file line number Diff line number Diff line change
Expand Up @@ -442,3 +442,31 @@ def keys(self, __unit: Unit = None) -> Iterable[K]:
def __getitem__(self, key: K, /) -> V:
"""Get the value for a key."""
...


__all__ = [
"HashCode",
"ICollection",
"IComparable",
"IComparable_1",
"IComparer",
"IComparer_1",
"IDictionary_2",
"IDisposable",
"IEnumerable",
"IEnumerable_1",
"IEnumerator",
"IEqualityComparer",
"IEqualityComparer_1",
"IEquatable",
"IGenericAdder",
"IGenericAverager",
"IReadOnlyCollection_1",
"IReadOnlyDictionary",
"IReadOnlyDictionary_2",
"IReadOnlySet_1",
"ISet",
"IStructuralComparable",
"IStructuralEquatable",
"SupportsLessThan",
]
Loading
Loading