Compile Nim Extensions for Python On Import!
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 [bundle|build]
NIMPORTER_INSTRUMENT
is in environment, compile output is printed for debuggingI 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:
setup.py
are slightly differentI 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! 🚀
*.nim.cfg
and *.nims
files to specify compiler flags. + Amended the README see #52 by @SekouDiaoNlp in https://github.com/Pebaz/nimporter/pull/55
switches.py
in favor of *.nim.cfg
and *.nims
Full Changelog: https://github.com/Pebaz/nimporter/compare/v1.0.4...v1.1.0
Fixes:
#37 #40
New Features:
exclude_dirs
argument in build_nim_extensions()
was not being fully utilized.New Features:
New Features
nimporter compile
which improves workflows related to compiling all Nim sources without running the application or bundling an application into a Zip archive without using a setup.py
.Bug Fixes
MANIFEST.in
not being deleted on nimporter clean
if it resided in project rootAfter 2 months of hard work, I am proud to announce the release of Nimporter version 1.0.0! I have now implemented all of features necessary to consider Nimporter complete but will continue to provide bug fixes and small enhancements as they become necessary. The greatest feature in this release is the ability to distribute libraries using Nim code without requiring the end user to install a Nim compiler. Here is a list of the new features introduced in this version:
pip install nimporter
..nimble
dependencies are now officially supported.There is now no excuse not to make your Python code more performant using Nim. All of the hard work has been done for you: simply plop a Nim source file into your project,
import nimporter
, and then directly import your Nim code. You can now think of Nimporter as Cython for Nim, but seamless.
Furthermore, none of your end users have to install a Nim compiler (or a C compiler for that matter). Distribution is 1 extra line of code.
Using Nim with Python now involves the same effort as writing pure Python.
Welcome to Nimporter 1.0.0.
importlib.util
as noted here.importlib.util.source_hash()
introduced in Python 3.7+.IGNORE_CACHE
parameter that forces the rebuild of any Nim file while set.