Skip to content

Nimporter Version v2.0.0rc

Pre-release
Pre-release
Compare
Choose a tag to compare
@Pebaz Pebaz released this 26 Mar 08:37
e1aaddf

Complete Rewrite of Nimporter Core Functionality

There have been a large number of inconsistencies corrected, flaws remedied, and conventions standardized upon in order to make this the best version of Nimporter ever!

Main Changes

  • Nimporter can now be used to distribute Source Distributions of libraries without requiring the user to have a Nim compiler installed! 🎉
  • New logo
  • Formalized why Nimporter chooses C compiler: when Importing, CC must match CC used to build Python. When Exporting, CC will either match the CC used to build Python (bdist_wheel) or will be one of many within a matrix of supported CCs (sdist)
  • Removed nimporter [bundle|build]
  • Nimporter is more formalized now. Extension Modules and Extension Libraries are first class notions now.
  • Hashing and Caching is now supported for Libs & Modules correctly!
  • Extension libraries must use structure defined in this cookiecutter template
  • If NIMPORTER_INSTRUMENT is in environment, compile output is printed for debugging
  • Added Semgrep in CI to scan for code patterns that could lead to security vulnerabilities

I believe everything in #60 has been addressed as it pertained to the rewrite.

@SekouDiaoNlp @juancarlospaco @Benjamin-Lee @retsyo @paul-nameless @Ivan1248 @philippeitis @WesleyYue If any of you happen to have time, can you test the new functionality of Nimporter on any of your projects by installing this v2.0.0rc release?

Let me know any pain points you encounter if you chose to refactor and maybe things can be polished off. Also, there are a few things that are different in this version:

  • Nim Extension Libraries have a specific folder structure (as noted in the new readme)
  • Only Nim Extension Libraries can customize compiler switches
  • Interactions with setup.py are slightly different
  • The C compiler is customized automatically by Nimporter to improve cross-platform distribution
  • More in the readme

I have a question regarding the utility of Python & Nim in regards to Nim binary dependencies. For instance, if some Nim code is using Raylib for example, would this work with a Binary Distribution? If so, I think I should update the readme to say that Source Distributions only support pure Nim code because of how they work now. Source Distributions precompile a bunch of different platform/architecture/CC combinations in order to allow users with those target triples to use their own CC to without having Nim installed. However, I think that this has some implications that may not be fully known at this time.

Let me know if there are any glaring bugs 🐞 and I'll work to fix them. I know this represents some breaking changes, but if Nimporter can gain the ability to allow Python users to install Source Distributions without installing a Nim compiler, that would be totally amazing! 🚀