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

DEPLOY: main.rye entry point as a standard ? #1

Open
gedw99 opened this issue Feb 20, 2024 · 10 comments
Open

DEPLOY: main.rye entry point as a standard ? #1

gedw99 opened this issue Feb 20, 2024 · 10 comments

Comments

@gedw99
Copy link

gedw99 commented Feb 20, 2024

Would it make sense to formalise that main.rye is the first thing it looks for if nothing is passed in ?

There is already one example using this at https://github.com/refaktor/rye-front/blob/main/examples/webview/lightray/main.rye

@refaktor
Copy link
Owner

Thank you, Gerard, for the proposal. I think it makes sense. The only problem I see is that rye executable is already overloaded with options that I tried or that I have in ideas for. But concretely current behavior is this:

  • ./rye starts rye shell
  • ./rye file.rye loads and executes rye file

Since we just made the first version of saving Rye shell state to a file, we need to make a quick way to reload shell state, this means something like ./rye -s shell_state.rye but it must enter shell after loading the file so it will need additional flag or command for that.

Rye shell is an important part of Rye, so I'm wouldn't want to require an additional flag to enter it, in case main.rye exists in current folder ... What do you think if we leave current options as above but I main.rye is ran if present if commands is: ./rye . - an dot would mean current folder in this case, so if there is main.rye in it it runs it?

Behavior would be similar to grep -r "something" . or find . -name "xy" ... if you would pass a folder instead of . it would also execute main.rye if it found it in that folder.

What is you opinion on this?

@refaktor
Copy link
Owner

I've implemented the . option. so now it's bin/rye . and it runs main.rye if it's in current folder or bin/rye examples/contextplay/. and it will run main.rye in that folder. It's not yet of rye-front (just Rye) since it's not yet in a tagged release, it will be in few days.

If you have any feedback let me know. Thanks for the proposal!

@refaktor refaktor closed this as completed Mar 4, 2024
@refaktor
Copy link
Owner

refaktor commented Mar 4, 2024

If this is not what you wanted or you think there is a better way please reopen issue. I am closing it for now.

@refaktor
Copy link
Owner

refaktor commented Apr 4, 2024

@gedw99 I've added your proposed main.rye functionality with dot "." argument in v0.0.18 ... you can see the CLI options here: https://www.reddit.com/r/ryelang/comments/1bv7bme/rye_cli_commands_and_flags_improved_and_help/

@gedw99
Copy link
Author

gedw99 commented Apr 4, 2024

@refaktor thanks for the "." option. It will do the job for now. I appreciate there change,

I need to spend more time with the syntax for now, in order to make useful suggestions.

@refaktor refaktor reopened this Apr 5, 2024
@refaktor
Copy link
Owner

refaktor commented Apr 5, 2024

@gedw99 I've been thinking about more secure options to run Rye yesterday (using signed scripts and apparmour) and it coincides with the need to add something like "do_main" build option and when Rye is build with this it will only run main.rye in current folder by default, like you asked. I've also been thinking about trying to make a test android app with rye and fyne and I imagine it would be simpler if no arguments would need to be passed.

So I'm reopening this issue and I will try to add this build option. One idea about Rye is that you build your own binary on per project basis, so you can have all the dependencies and other options that you need for that project. This "do_main" would also make most sense per specific project.

@refaktor
Copy link
Owner

@gedw99 do_main build flag was added to Rye, I will add it here too. If you build Rye with that only calling rye starts a main.rye in current folder.

@refaktor
Copy link
Owner

@gedw99 I've built a test Fyne Rye app for Android. I will be also adding "embed_main" build flag that will build a Rye which already embeds main.rye into the binary and runds it, because packaged app in apk can't really open other files inside apk.

@gedw99
Copy link
Author

gedw99 commented Apr 24, 2024

Wow this is really cool !!

thanks for there heads up. I will give it a try now

@refaktor
Copy link
Owner

This "embed_main" should be online in a week or two ... next week I'll be missing from work a few days.

@refaktor refaktor changed the title main.rye entry point as a standard ? DEPLOY: main.rye entry point as a standard ? Oct 9, 2024
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

No branches or pull requests

2 participants