-
-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Switch build-backend to hatchling and modernize a bit
- Loading branch information
Showing
15 changed files
with
108 additions
and
171 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -100,3 +100,6 @@ ENV/ | |
|
||
# mypy | ||
.mypy_cache/ | ||
|
||
# uv | ||
uv.lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
from ft.types import T_VOID | ||
from ft.functions import function_list | ||
from ft.termcolor import colored | ||
|
||
type_color = { | ||
"String": "yellow", | ||
"Path": "cyan", | ||
"Int": "blue", | ||
"Bool": "magenta", | ||
"Array": "red", | ||
"*": "white", | ||
"!": "red" | ||
} | ||
|
||
|
||
def with_color(typename): | ||
if typename in type_color: | ||
return colored(typename, type_color[typename]) | ||
|
||
return typename | ||
|
||
|
||
def main(): | ||
for name, fn in sorted(function_list.items()): | ||
type_in = fn.type_in | ||
type_out = fn.type_out | ||
|
||
if type_in is None: | ||
type_in = with_color("*") | ||
else: | ||
type_in = with_color(str(type_in)) | ||
|
||
if type_out is None: | ||
type_out = with_color("*") | ||
elif type_out == "returned": | ||
type_out = with_color("*") | ||
elif type_out == T_VOID: | ||
type_out = with_color("!") | ||
else: | ||
type_out = with_color(str(type_out)) | ||
|
||
arg_names = fn.inner_argspec.args[:-1] | ||
|
||
name_and_args = colored(name, "green") | ||
|
||
if len(arg_names) > 0: | ||
name_and_args += " " + " ".join(arg_names) | ||
|
||
print("{name_and_args:<28} :: {type_in:<15} → {type_out}".format( | ||
name_and_args=name_and_args, | ||
type_in=type_in, | ||
type_out=type_out)) | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
[build-system] | ||
requires = ["hatchling"] | ||
build-backend = "hatchling.build" | ||
|
||
[project] | ||
name = "shell-functools" | ||
version = "0.3.1" | ||
description = "A collection of functional programming tools for the shell." | ||
authors = [{ name = "David Peter", email = "mail@david-peter.de" }] | ||
urls = { Home = "https://github.com/sharkdp/shell-functools" } | ||
keywords = ["shell", "functional-programming", "filesystem", "string-manipulation", "command-line"] | ||
classifiers=[ | ||
"Development Status :: 4 - Beta", | ||
"License :: OSI Approved :: MIT License", | ||
"Programming Language :: Python", | ||
"Programming Language :: Python :: 3", | ||
"Programming Language :: Python :: 3 :: Only", | ||
"Programming Language :: Python :: 3.9", | ||
"Programming Language :: Python :: 3.10", | ||
"Programming Language :: Python :: 3.11", | ||
"Programming Language :: Python :: 3.12", | ||
"Programming Language :: Python :: 3.13", | ||
] | ||
readme = { file = "README.md", content-type = "text/markdown" } | ||
license = "MIT" | ||
requires-python = ">=3.9" | ||
|
||
[project.optional-dependencies] | ||
tests = [ | ||
"pytest", | ||
] | ||
|
||
[project.scripts] | ||
filter = "ft.commands.filter:Filter.main" | ||
foldl = "ft.commands.foldl:Foldl.main" | ||
foldl1 = "ft.commands.foldl1:Foldl1.main" | ||
ft-functions = "ft.commands.ft_functions:main" | ||
map = "ft.commands.map:Map.main" | ||
sort_by = "ft.commands.sort_by:SortBy.main" | ||
take_while = "ft.commands.take_while:TakeWhile.main" | ||
|
||
[tool.hatch.build.targets.wheel] | ||
packages = ["ft/ft"] |