-
Notifications
You must be signed in to change notification settings - Fork 204
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
new example: ctypes #441
new example: ctypes #441
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your PR. I mentioned some small improvements.
examples/ctypes-factorial/pixi.toml
Outdated
|
||
[tasks] | ||
compile = {cmd = "gcc -shared -o src/factorial.so -fPIC src/factorial.c"} | ||
factorial = {cmd = "python src/factorial.py $1 $2", depends_on = "compile"} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
factorial = {cmd = "python src/factorial.py $1 $2", depends_on = "compile"} | |
factorial = {cmd = "python src/factorial.py, depends_on = "compile"} |
We're not yet supporting numbered arguments but everything you would add to pixi run factorial xxx
would be send to that task so in this case you wouldn't need them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! It's worth calling out in README. Is there documentation I could reference? I wasn't able to find this in Pixi or Deno docs, so I just gave it a try, it worked, and I assumed that the $1 $2
was necessary
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added it to the new docs PR : bf0c0c0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great! I'll wrap it up later this week. Thanks for your input!
examples/ctypes-factorial/pixi.toml
Outdated
platforms = ["linux-64"] | ||
|
||
[tasks] | ||
compile = {cmd = "gcc -shared -o src/factorial.so -fPIC src/factorial.c"} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We try to include a start
task in all our maybe it could be nice to add a factorial call but with some pre filled values. We do this to avoid user to have to read the README before they can test it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not remove the engine
argument and make it print both runs in the same output. This makes it easy to get a quick overview.
platforms Co-authored-by: Ruben Arts <ruben@prefix.dev>
@ruben-arts would you mind dropping Windows from this one? I'd rather not get into it at this time. |
He funnily enough, I just got a Windows machine for testing these type of pixi problems. The trick here is to run This worked for me. |
I decided to keep the engine argument to showcase task dependencies and passing arguments between tasks and the underlying scripts. They play along really well! No Mac handy to try to make it work there. I understand gcc would probably not work. |
I got it to work by adding these two: [target.osx-arm64.tasks]
compile = {cmd = "clang -shared -o src/factorial.so src/factorial.c"}
[target.osx-arm64.dependencies]
clang-16 = "*" |
So should [dependencies]
python = "3.12.0.*"
loguru = "0.7.2.*"
[target.win-64.dependencies]
m2w64-gcc = "5.3.0.*"
[target.linux-64.dependencies]
gcc = "13.2.0.*"
[target.osx-64.dependencies]
clang-16 = "*"
[target.osx-arm64.dependencies]
clang-16 = "*"
[tasks]
compile = {cmd = "gcc -shared -o src/factorial.so src/factorial.c"}
factorial = { cmd = "python src/factorial.py -e python"}
start = { cmd = [
"python",
"src/factorial.py",
"12345678",
";",
"python",
"src/factorial.py",
"12345678",
"-e",
"python",
], depends_on = "compile" }
[target.osx.tasks]
compile = {cmd = "clang -shared -o src/factorial.so src/factorial.c"}
[target.osx-arm64.tasks]
compile = {cmd = "clang -shared -o src/factorial.so src/factorial.c"} will pixi know to use |
Yes that would work @liquidcarbon |
The lockfile is not uptodate 😄 |
Thank you @liquidcarbon another good example!! |
Thanks for your help! |
#436