Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update build subcmd to accept paths #172

Merged
merged 2 commits into from
Oct 4, 2023
Merged

update build subcmd to accept paths #172

merged 2 commits into from
Oct 4, 2023

Conversation

shakfu
Copy link
Contributor

@shakfu shakfu commented Oct 3, 2023

Only __main__.py is modified in this PR.

Basically it adds the following features:

  • extensions can now be specified as <path> in addition to <name>=<path>
  • make adding extensions required
  • can change default prefix of <path> built extensions
  • more validation checks
usage: pydust build [-h] [-z ZIG_EXE] [-b BUILD_ZIG] [-m] [-a]
                         [-p PREFIX]
                         extensions [extensions ...]

positional arguments:
  extensions            space separated list of extension '<path>' or
                        '<name>=<path>' entries

options:
  -h, --help            show this help message and exit
  -z ZIG_EXE, --zig-exe ZIG_EXE
                        zig executable path (default: None)
  -b BUILD_ZIG, --build-zig BUILD_ZIG
                        build.zig file (default: build.zig)
  -m, --self-managed    self-managed mode (default: False)
  -a, --limited-api     use limited python c-api (default: True)
  -p PREFIX, --prefix PREFIX
                        prefix of built extension (default: )

So basically the following is enabled:

python -m pydust build 'fib/hello.zig' 'fib._fib=fib/fib.zig' 

In the above case, fib/hello.zig is mapped to the name fib.hello
if --prefix=_ then it is mapped to the name fib._hello

@robert3005
Copy link
Member

I think we can simplify the path munging with pathlib. For example it's simpler to get filename https://docs.python.org/3/library/pathlib.html#pathlib.PurePath.stem

@shakfu
Copy link
Contributor Author

shakfu commented Oct 4, 2023

I think we can simplify the path munging with pathlib. For example it's simpler to get filename https://docs.python.org/3/library/pathlib.html#pathlib.PurePath.stem

Agreed.

@robert3005 robert3005 merged commit 92c8ed9 into spiraldb:develop Oct 4, 2023
1 check passed
@shakfu
Copy link
Contributor Author

shakfu commented Oct 4, 2023

@robert3005

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants