-
-
Notifications
You must be signed in to change notification settings - Fork 33
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
Cleanup Sheer Amount of Options To Set Nim Compile Switches #60
Comments
Hi @Pebaz how are you? I definitely agree that we should simplify how the compilation tags are handled. If you have some vague idea about how to better it, I will be more than welcome to implement it. Oh and happy new year 🎈🎈🎈 |
Removing switches.py should be fairly quick |
I don't think users should directly edit this file.
I think it should be the default behaviour.
Removing it from the next release just involves removing the warnings.
I think the better option would be to pass
|
I can spend some time this weekend on that. |
Hi @SekouDiaoNlp! Happy New Year to you as well! I'm doing great! Just enjoying the new year as things start to pick back up after the holidays. You?
I agree. I mentioned that as an option as it came up in this issue (#59) and it seemed to help them out I think. I have given the cleanup some thought and I don't think we can cleanup the switches without restricting what users can do. Personally, I think that is actually a good thing because Nimporter was actually designed from a Python programmer's perspective (new to Nim) so that they wouldn't have to enter all the command line switches and whatnot. However, most of the Nim users are pretty handy with CLI switches since they come from the C world so advanced use cases should definitely be supported. My thoughts:
import nimporter
import single_module # No customization (uses default CLI flags (probably DEFAULT_CLI_ARGS))
other_module = nimporter.nimport(
"other_module",
[
"-d:release",
"-d:danger",
"--opt:speed",
"..."
],
# Optional:
# ignore_cache=True
) In summary:
Definitely let me know what you think and we can revise this to something better! 🙂 |
Furthermore, I here's one more idea that might simplify the code a bit:
What do you think? |
Definitely a great idea |
I think you have thought about it a lot. I will see what I can whip out during the weekend. Let me know if you have more suggestions. |
This is definitely a great idea and might greatly simplify the workflow! |
Hi @Pebaz how are you, I have been playing lately with multiple implementations of removing switches and think for Python users it is the right decision. Also always generated a |
Hi @SekouDiaoNlp, I'm doing great! I agree, I also have been experimenting on another branch and am working towards what I believe to be Nimporter 2.0.0, but as of yet I haven't gotten it to work correctly. It will most likely take me a while yet to get it up and running as my availability is really in flux right now but if it works, it will be lots of breaking changes to users (hence 2.0.0 version bump). However, we still need a deprecation path for existing users. If you can refactor Nimporter to not use switches on the current 1.x version, I'll continue to work toward trying to get this experimental Nimporter version to work. We can then release your refactor with the deprecated switches removed and then work towards ironing out whatever needs to be fixed on the Nimporter 2.0.0 experiment (if it is still worth keeping by then lol). |
That sounds like a good plan! I will remove switches.py and streamline the specification of flags while keeping the structure mostly the same. |
Fantastic, I'll keep this thread updated as well! |
Great, I should have free time Thursday evening and the whole weekend starting Wednesday. I will handle removing switches.py and streamline the rest. Enjoy your day. |
@SekouDiaoNlp Just an update on my progress with the Nimporter 2.0.0 experiment. I have verified it to work! Now all I need to do is finish testing and polish it off! I'm hoping to have a release candidate for you to test soon (as to what "soon" means in this context I have no idea 😆). How are things going with removing the switches? From what I found out about the Nimporter 2.0.0 design, a lot of the headache around switches largely will go away. I can go into more details once I've got more to show lol but essentially if you want, we might be able to just keep the switches in there and just migrate users onto Nimporter 2.0.0. I'm not actually sure which one would be preferable to Nimporter's user base: incremental adoption or just touch the code once. 🤷 |
@SekouDiaoNlp Have you had a chance to take a look at the Release Candidate for Nimporter 2.0.0? |
All items have been addressed in work towards v2.0.0. |
One of the main things that needs to happen is to have hopefully 1 place to set Nim compile args. This should probably be in the form of directly setting
nimporter.NimCompiler.NIM_CLI_ARGS
but any better ideas are definitely appreciated.Here are the ways that compile options can be configured:
nimporter.NimCompiler.NIM_CLI_ARGS
*.nim.cfg
*.nims
switches.py
(deprecated, needs to be officially removed)danger=True
flag inbuild_nim_extensions()
These use cases need to be kept in mind with any new designs:
Some random todo items would also be nice during this major update:
switches.py
supportThe text was updated successfully, but these errors were encountered: