Moving away from NodeJS to a pure python solution for assets
This is a modal window.
The media could not be loaded, either because the server or network failed or because the format is not supported.
Formal Metadata
Title |
| |
Title of Series | ||
Part Number | 65 | |
Number of Parts | 169 | |
Author | ||
License | CC Attribution - NonCommercial - ShareAlike 3.0 Unported: You are free to use, adapt and copy, distribute and transmit the work or content in adapted or unchanged form for any legal and non-commercial purpose as long as the work is attributed to the author in the manner specified by the author or licensor and the work or content is shared also in adapted form only under the conditions of this | |
Identifiers | 10.5446/21085 (DOI) | |
Publisher | ||
Release Date | ||
Language |
Content Metadata
Subject Area | ||
Genre | ||
Abstract |
|
00:00
Surjective functionSoftware as a serviceLecture/Conference
00:37
SpiralTranslation (relic)ResultantComputer animation
01:10
Exterior algebraFormal languageProgrammer (hardware)Integrated development environmentAreaDifferent (Kate Ryan album)Data managementLecture/ConferenceComputer animation
01:48
Mobile appState of matterEvent horizonBeat (acoustics)Integrated development environmentData managementDifferent (Kate Ryan album)Video gameRenewal theorySoftware frameworkWeb pageProjective planeWeb 2.0Plug-in (computing)Computer animation
02:28
Right angleGoodness of fitInsertion lossState of matterCartesian coordinate systemPlug-in (computing)Lecture/Conference
02:57
Mobile appState of matterEvent horizonBeat (acoustics)Menu (computing)CodeSystem callGame controllerMereologyData managementFormal languageFront and back endsProjective planeSet (mathematics)Computer animation
03:29
Set (mathematics)Grand Unified TheoryTask (computing)Software testingProjective planePhysical systemInterpreter (computing)Software testingSet (mathematics)Goodness of fitMereologyFront and back endsComputer fileLecture/ConferenceComputer animation
04:06
Internet service providerProcess (computing)AutomationGoodness of fitSet (mathematics)Task (computing)Office suiteData managementSound effectDistribution (mathematics)Order (biology)Integrated development environmentSoftware developerCASE <Informatik>Virtual machineDampingContinuous integrationComplex (psychology)Object (grammar)Scripting languageLecture/ConferenceComputer animation
05:08
CASE <Informatik>Different (Kate Ryan album)MereologyClient (computing)Functional (mathematics)Front and back endsIntegrated development environmentServer (computing)PasswordBridging (networking)Physical systemDebuggerComplex (psychology)Lecture/Conference
06:13
Medical imagingComplex (psychology)Software frameworkGoodness of fitDifferent (Kate Ryan album)CASE <Informatik>Stack (abstract data type)Computer animation
06:57
Distribution (mathematics)World Wide Web ConsortiumSoftware frameworkCache (computing)Transformation (genetics)TrailVelocityMereologyInterface (computing)Computer fileCache (computing)DebuggerWeb 2.0Computer animation
07:30
CompilerMedical imagingScaling (geometry)Computer fileACIDCartesian coordinate systemVelocitySoftware frameworkTransformation (genetics)Software as a serviceWeb 2.0Formal languageLecture/Conference
09:05
Distribution (mathematics)World Wide Web ConsortiumSoftware frameworkCache (computing)Transformation (genetics)TrailCASE <Informatik>Software frameworkFormal languageResultantGoogolCache (computing)Cartesian coordinate systemComputer animation
09:37
Link (knot theory)Web browserComputer fileCASE <Informatik>ResultantBranch (computer science)Revision controlCache (computing)Formal languageMultiplication signFood energyPolygon meshMathematicsHash functionFiber bundleWeb 2.0Uniform resource locatorLecture/Conference
10:28
Digital filterFiber bundleFunction (mathematics)Content (media)Point (geometry)Content (media)Student's t-testCASE <Informatik>Line (geometry)Fiber bundleComputer fileSingle-precision floating-point formatIntegrated development environmentError messageWebsiteField (computer science)Dot productXML
11:38
Source codeField (computer science)Computer fileData managementInheritance (object-oriented programming)Physical systemLecture/Conference
12:04
Cloud computingDigital filterFiber bundleFunction (mathematics)Content (media)CASE <Informatik>MereologyForm (programming)Computer fileView (database)Physical systemSource codeFiber bundleTransformation (genetics)ResultantFilter <Stochastik>XML
12:32
ResultantComputer fileEndliche ModelltheorieSingle-precision floating-point formatCASE <Informatik>Dot productProfil (magazine)Field (computer science)Arithmetic meanLecture/Conference
12:58
Digital filterFiber bundleFunction (mathematics)Cloud computingScripting languagePiLink (knot theory)Data typeTouchscreenSineLibrary (computing)Content (media)Web 2.0DivisorTheorySingle-precision floating-point formatPhysical lawConfiguration spaceIntegrated development environmentAsynchronous Transfer ModeService (economics)Object (grammar)Fiber bundleCartesian coordinate systemLoop (music)Link (knot theory)Computer animation
14:22
PiScripting languageLink (knot theory)Fiber bundleTouchscreenData typeJava appletCompilerExecution unitAsynchronous Transfer ModeProduct (business)Loop (music)Scripting languageUniform resource locatorLevel (video gaming)Sampling (statistics)Boss CorporationWeb 2.0WordComplex numberTemplate (C++)Conjugacy classCASE <Informatik>Computer fileWeb browserFormal languageCodeLecture/ConferenceXML
15:45
Digital filterData managementPoint (geometry)Advanced Encryption StandardMedical imagingMereologyIntegrated development environmentFormal languageCovering spaceServer (computing)Web applicationComputer fileWeb crawlerVideo gameVariety (linguistics)Data managementView (database)Interpreter (computing)Computer animation
16:52
CompilerIntegrated development environmentDistribution (mathematics)Computer programmingProcess (computing)Lecture/Conference
17:23
World Wide Web ConsortiumCompilerDigital filterGame theoryVideo gameImage resolutionWeb crawlerComputer fileAverageLibrary (computing)Cellular automatonIntegrated development environmentBuildingInstallation artComputer animation
18:10
LiquidLetterpress printingScripting languageVarianceBinary codeForcing (mathematics)View (database)Web-DesignerCompilation albumCompilerProcess (computing)TheoryComputer fileFormal languageInformation securityReal numberInstallation artSoftware bugFunctional (mathematics)Lecture/ConferenceXML
19:35
Social classType theoryDeclarative programmingPlanningCartesian coordinate systemFunctional (mathematics)Web applicationReal numberLecture/Conference
20:10
Function (mathematics)VarianceScripting languageData typeLetterpress printingString (computer science)PrototypeSocial classDigital filterWorld Wide Web ConsortiumContent (media)Field (computer science)ResultantMereologySystem callFreewareComputer fileStudent's t-testType theoryFilter <Stochastik>Computer animation
20:43
Scripting languageData typeWorld Wide Web ConsortiumDigital filterFunction (mathematics)Content (media)Data Encryption StandardAsynchronous Transfer ModeInstallation artCASE <Informatik>Point (geometry)Student's t-testComputer programmingFiber bundleTheoremType theoryData managementPoint cloudMobile appLecture/ConferenceComputer animation
21:39
Data Encryption StandardVertex (graph theory)Installation artRevision controlDirectory serviceWeb 2.0Integrated development environmentWeb applicationLecture/ConferenceComputer animation
22:23
1 (number)DialectData managementCartesian coordinate systemRevision controlCASE <Informatik>Lecture/Conference
23:00
Data Encryption StandardAsynchronous Transfer ModeInstallation artCASE <Informatik>Revision controlInstallation artSoftwareMereologyImage resolutionIndependence (probability theory)Inversion (music)CollisionComputer animation
24:05
Server (computing)Artistic renderingCodeVarianceFunction (mathematics)VolumenvisualisierungDivision (mathematics)Revision controlFunctional (mathematics)Markup languageSummierbarkeitPropagatorFlow separationServer (computing)Client (computing)CodeSpherical capConnectivity (graph theory)Template (C++)VolumenvisualisierungFluid staticsMereologyIsomorphieklasseWeb pageWeb applicationScripting languageXML
25:23
Interpreter (computing)CodeFunction (mathematics)Web pageCodeReal numberResultantServer (computing)Library (computing)Process (computing)Axiom of choiceParticle systemObject (grammar)Functional (mathematics)QuicksortNumberCASE <Informatik>Memory managementSystem callMessage passingLecture/ConferenceComputer animation
26:40
CodeSemiconductor memoryMemory managementEvoluteMessage passingObject (grammar)Process (computing)Trigonometric functionsImage resolutionPointer (computer programming)Lecture/Conference
27:24
Element (mathematics)CodeProduct (business)MathematicsWeb applicationSequelCuboidCycle (graph theory)Crash (computing)Lecture/Conference
28:31
FreewareComa BerenicesFreewareSoftware bugOpen sourceRevision controlComputer animation
28:58
CodeLecture/ConferenceComputer animation
29:23
Variety (linguistics)Lecture/ConferenceComputer animation
29:57
CompilerProjective planeServer (computing)Web 2.0MereologyRegulärer Ausdruck <Textverarbeitung>Standard deviationComputer fileCodeBoss CorporationWebsiteComputer animationLecture/Conference
31:16
Interpreter (computing)State of matterFunctional (mathematics)Library (computing)Mathematical singularitySingle-precision floating-point formatForm (programming)Multiplication signImage resolutionMathematicsComplex (psychology)Lecture/Conference
Transcript: English(auto-generated)
00:00
We've got our next talk from Alessandro Molina, who will be telling us about moving away from Node.js and onto Python. If you could all welcome him, there will be a chance for questions at the end. Thank you. Okay, thank you. First I would like to start by telling you why I decided to have this talk.
00:27
Because I know that probably many of you are already using a solution to transform and manage their assets. Probably you have been using it with SaaS for months here, I don't know. And probably in that solution Node.js is involved in many ways, at
00:44
least around the tools that perform the translation or the transpilers themselves or whatever. But I know that many people approach the solution that they are using today for the reason that they don't know there are other ways to do that.
01:02
Most people have been doing that that way. If you look on Google or wherever how to do that, the first result is probably how to do that with Node.js. And so people have been approaching that kind of solution mostly because that's the way you are meant to do it.
01:22
There are actually very good alternatives that can solve also the problem of having to cope with two different languages. I know for sure that anyone in this room is a Python programmer, but I'm not sure that everyone in this room also is as proficient with JavaScript or Node.js or whatever.
01:43
So having to maintain two different environments with their dependencies, different tools, different package managers and install both of them on your at least development environment if not even on the production environment is not always what you want to do.
02:01
So let's talk about something that probably happened in the life of every one of us, which is that you've been able to start your project using Python for everything. Your web framework is probably Python-based. You serve your API or even your web page through it. You are able to run it using a Python-based solution that you can write plug-ins for using Python.
02:26
So we can deploy it using supervisors. Whatever you're using, it's probably comfortable because you know you can go into the code and have a pretty good grasp of what's happening or write plug-ins for it and extend its behavior and so on.
02:45
You're probably also deploying it using a tool like Salt, Ansible or Docker Compose, which are in Python, too. And you probably monitor the state of your application using a tool like Sentry, Datadog, Backlash, which have all Python agents.
03:01
Some of them even have backend code written in Python and so on. So we are probably able to do everything we want by going into the Python code, messing with it, extending its behavior, doing whatever we want in our stuff. And that's only not true for the assets part because one day you probably go on holiday,
03:22
you come back and the frontend guy introduces a whole new language, a whole new dependency manager, a whole new set of things in the project which now need to be installed through NPM, through having a new interpreter on your system and things like that.
03:40
Which is not bad because Node.js actually has a really good set of tools for doing this. As a good set of transpilers, as most of them transpiled to JavaScript and are being written by the JavaScript community, have been written, of course, in Node.js itself. It has a good set of tools to automate testing of your JavaScript part and frontend part.
04:07
And it has a good set of tools to automate tasks, like, for example, which are actually made to do the job and provide pipelines that transform your assets and things like that.
04:22
So the side effect of this is that while it's a great tool and has everything you usually need, you now need to have a package manager to manage the package managers. Because you need to be sure that the environment you are working on, you
04:40
will have both PIP or the primary, the wheels if you use the binary distribution. You need to make sure you have NPM to be able to set up the working environment from scratch, at least on your continuous integration or on the developer's machines and so on.
05:00
So you will need a tool that installs both of those. In more simple cases, it might be just an app get itself. In more complex cases, you might want to provide something like an Ansible script to actually deploy the working environment. Then you have two different places where you need to be sure to update your dependencies.
05:23
Because we will have the dependency for NPM and we will have the dependencies for PIP. And in the most simple case, two different people work on the two different parts of the system and they update each one their own dependencies. But in some cases, there might be features that cross through the bridge of the two parts and you might need
05:45
to be sure that to make the front end of the new functionality you added, you will need to add the dependency in both places and the client and server side dependency of your functionality and make sure that they get installed both.
06:02
Otherwise, your feature won't work as expected at all. So you will probably end up adding a third solution on top of all of these to actually manage this complexity. And there are many and so far there is not really a standard de facto to rely on.
06:22
I mean, you can probably try to achieve these by using Ansible for everything. You can probably try to achieve these by doing preconfigured images. You can actually try to solve the solution in many different problems. But it's actually a problem that you should not need to solve because it has been introduced for a purpose that
06:44
in most cases can be solved without introducing the new technology that is actually triggering our problem with different stacks and dependencies. And there are pretty good frameworks in Python to manage assets. One of them is actually web assets, which has been the one that I preferred over the long run because it provides a really simple interface.
07:09
You can configure it both through an API and through simple YAML files and it provides also the front end part of your assets. Whenever you need to use an asset, you can actually use it from by importing it from web assets.
07:26
So it will also take care of things like cache busting and things like that for you. So it can replace solutions like Grunt and Gulp in performing the transformation of your assets because much like them works as a pipeline.
07:44
So you get some kind of input, which is usually a file, and end up providing another output, which is usually a file itself, which would be the file transpiled, your CSS converted, or your images are scaled and things like that.
08:02
And the advantage of using this approach is that if you need something, if you need support for scaling images, if you need support for compiling less, if you need support for SaaS or whatever, you just track the dependency in your setup UI because the last compiler for web assets is just a Python package like web assets itself.
08:24
So if you need less, you don't have to remember that you have a step to run before your application. So you don't have to remember that you need to perform npm install, you don't have to remember that you need to run Grunt. You can actually make everything automatic through Python by having your application that when it's installed, it will install the support for
08:45
less, and when it starts, it will automatically compile the assets without having to actually provide yourself a solution to do that. And it actually works with any WSGI framework, so you can even use it as a middleware around
09:04
your framework, which doesn't care about the language and the framework you are using, and allows you to manage your assets independently for the framework, even if you use plain WSGI application without the framework at all.
09:20
And as I told you, it's actually providing HTML side API to inject the resources, which is good because in many other cases, when you inject the resource, you generate it through maybe Grunt or Google. You will have to provide the solution for things like cache busting yourself, so in case the results change, in case you update the CSS
09:48
file, you want the browser to load the new updated version and not keep using the old one just because the browser has it in cache. And usually this is something you might need to provide yourself, maybe by adding a time stamp to all the
10:02
URLs or things like that, but web assets does it for you, so when it generates a mesh of your resource, and whenever the resource changes, the hash will change, and so the new resource will have a totally different URL, and as you inject them to an API, it will inject the latest URL every time you run your template language.
10:26
And the way you define your resources in web assets is actually through bundles, so a bundle is actually any kind of resource. You can even be a bundle made of just one single thing if you need to translate,
10:42
like, your single CSS file from SAS to CSS, you can create a bundle with single file inside. And the bundle is defined as something that has a name. In this case, we have two bundles, style and JSO,
11:01
and each bundle might have a filter, which for the first case is CSS utils, which is used to minify the CSS. And we'll have an output, which in this case, for simplicity, is just a file encoded,
11:20
so everything inside the bundle will be minified and squashed into that style dot CSS file. And actually, you can have content, which can even be a bundle itself, because you can see a point where we have a content subentry, which has SCSS files inside, and provides a different filter, which is libsas, which is used to convert SCSS to CSS, of course.
11:51
And libsas itself is a Python package, so you can actually just add it to your setup UI and everything managed through your package manager.
12:03
So what happens is when our system will need the style bundle, it will actually end up compiling, performing all the transformation for the nested bundles. Like in this case, it will start by transpiling all the SAS files to CSS files, and then it will perform the upper
12:26
part, which in this case is the CSS filters on all the files we specified and on the result of the previous bundle. And we will end up with a single style dot CSS file, which inside has all the CSS files, all our SCSS files transpiled by libsas, and the result is the minified too.
12:47
And the same happens for jsall, which actually in this case applies to the jsmin filter, which as you can imagine, performs minification of JavaScript. And it will get all these files, and it will squash them into dependencies dot js, and it will minify them, of course.
13:06
And to use them from your front-end, it's actually pretty simple, as WebAssets will provide you with an environment that has knowledge about all the bundles you created in the configuration, and you can just inject the resources through this environment.
13:26
In my example, the environment is owned by the global application object, which is that G object you see there. And what's happening is that I just create, I loop on all the resources of the style bundle and create a new link entry for each CSS resource.
13:53
You might be asking why I loop, as I actually definitely have the single bundle name style, so there should be only one.
14:02
And the reason why I loop is that actually if you run WebAssets in debug mode, you won't perform the minification and squashing anymore. So you can debug your resources separated, and then when you are sure that things work as you expect, you turn debug mode off, and you end up having a single resource.
14:20
So with this syntax, you are sure that everything works, both when you run in debug and production mode, so both when you have a single or multiple resources generated by WebAssets. And the same happens for the js-all bundle, because I just loop through all the URLs provided for the js-all bundle, and I inject the script back for that.
14:44
So in this case, the example we made using the Kajiki template engine, or the Genshi-1, the syntax is the same actually, but it works in any template language. If you look at the WebAssets site, you will find examples in Jinja and so on.
15:03
But we didn't really remove the problem totally, because still, for some more complex filters, we will need to have Node.js available. For example, if I want to convert my ES6 code to ES5 to JavaScript that the
15:22
browser is actually able to run, I will probably need to bring in something like Babel. And Babel actually is implemented in Node.js, so I will need to install Node.js and tell WebAssets where it can find the Babel executable file.
15:41
Which is actually not really good in my opinion, because I didn't really solve anything. If I need to have Node.js to perform the Babel, to run Babel, at that point it makes sense to just have Node.js for everything and don't have to actually have parts of my assets pipeline on one side and parts of my assets pipeline on the other side.
16:04
And that's the point of this talk actually. What I wanted to do is solve this problem, not having to rely on Node.js at all in my Python environment. And that's why I created DuckPy. And DuckPy is actually a replacement for Node.js in many ways.
16:24
It's specifically meant for assets management, so you won't be writing web application on top of DuckPy. It doesn't have the concept of any request. It doesn't have a server inside. It's just a JavaScript interpreter. We built in transpiler for the most common environments and most common languages and things like that.
16:47
So we can now just add DuckPy as a dependency of our setup file in our requirements. And we know that whenever we need something that relies on JavaScript, we just have DuckPy installed without having to have some external tool taking care of installing it and so on because it's just a Python package.
17:07
And there is a Python package which actually has no external dependencies. DuckPy itself comes self-contained and the only thing you will need is a C compiler because currently there is no binary distribution.
17:22
So mostly we'll support for Linux environment is totally clear how it should work in a reliable way. Currently, but the C dependency itself doesn't use any C library apart from libc. So as far as you have GCC installed, you don't need anything else to actually install and compile DuckPy.
17:43
So you just run PIP install and you will end up with DuckPy install the work. And the reason why I created it is that because I wasn't really satisfied with the other existing solutions. Because like PyExec.js, SpiderMonkey, V8 and so on for Python require external tools like V8 and SpiderMonkey.
18:06
And it's usually really hard to build those. I don't know if any one of you ever tried to build SpiderMonkey but it's something we spend like two days only trying to get the binary there. So it's not really easy to have them integrated in your install and build process.
18:26
And DuckPy is also specifically tailored for web development. So it means that most things you will need are probably built into DuckPy to make your assets pipeline in Python itself. A simple example is actually compiling CoffeeScript.
18:43
So I don't need to install anything because in DuckPy itself there is the CoffeeScript compiler built in. So I just import DuckPy, run the coffee compiler function and I get the JavaScript generated out of that CoffeeScript. And you should notice that this is not something that will have major problems or that might not be compatible and so on.
19:07
Because it's not a CoffeeScript compiler implemented in Python. It's actually the real CoffeeScript compiler in JavaScript itself that it's running on top of DuckPy. So whenever the CoffeeScript compiler is updated with a bug fix and you release new support for the language or whatever,
19:25
it will be just a matter of replacing a JavaScript file, maybe fixing two or three things inside that file. And then your release of DuckPy will have support for that without major issues. And the same applies for Babel. I can convert my ECMAScript 6 to plain JavaScript just by calling the Babel compile function.
19:47
And you see that I get out plain JavaScript out of my class declared in ECMAScript 6. And also for TypeScript. So you can actually create Angular 2 web application using DuckPy and no need for Node.js at all.
20:03
I actually did it for real. So you can declare your application, your class in TypeScript and compile it and you will get a compiled JavaScript out of it. And as I told you, AngularJS 2 perfectly works on top of DuckPy.
20:22
So this actually solved the problem of compiling and transpiling my most compulsive resources. For simple things, I can use WebAssets, which already provides all the features I need usually. And for more complex things, like transpiling TypeScript, ECMAScript and so on, I can rely on DuckPy, which provides the filters or WebAssets itself.
20:46
So I can just import from the DuckPy the filter for TypeScript, import from DuckPy the filter for Babel.js, register them into WebAssets, and from that point on, I will have support for TypeScript or Babel.js inside my bundles.
21:04
So in this case, you can see, for example, that I added a bunch of ECMAScript 6 files, which are compiled, minified into the JS app bundle. And that's declared by the fact that they use the Babel.js filter, which is provided by DuckPy.
21:24
And you don't only stop there. You don't even need npm anymore, because DuckPy is a package manager for npm.org built-in. So if you need to have JavaScript dependency in your Python program, you can just use duckpy.installjs package,
21:43
specify the name of the package, the version that you want to install, and if you want, it's optional, the directory where you want to install it. By default, it will install it inside the JS vendor directory of your web application, which is from the environment of WebAssets.
22:04
And it also will install any dependency of the package. So if your package, if your JavaScript package has dependencies itself, it will end up installing them all, too. And if you mix these with the setup tools, whichever setup requires function,
22:22
you can tell that your web application setup requires DuckPy and all the JavaScript dependency installed by setup tools itself. So when you do pip install mywebapp, you get all your Python and JavaScript dependency installed without the need of any external dependency manager. And the only thing you should notice is that DuckPy is not full of features as the npm original one.
22:48
So, for example, in case of a collision, in case two different packages requires two different versions of a package which collide, which are not supported one by the other, DuckPy currently will just take the newest one.
23:05
So it will take for granted that the newest one should work with both of them, but will not make more advanced things like filtering on the minor version and things like that. So, in some cases, if you only specify the high-level dependency, you might end up with co-lagging dependency installed.
23:26
But that's something you can solve by just specifying the precise version for each dependency you want to have. I plan to extend this behavior by providing full dependency resolution, collision and version resolutions
23:42
because the dependency resolution is already provided, but the collision part is not. But currently it has not been a major issue for me because I tend just to specify the precise version of each of my dependencies to make sure that the software is always reinstallable even in ten years from now.
24:02
And one really interesting thing is that DuckPy is compatible on Node.js also for the requirements of packages. So DuckPy provides a require function which is able to import Node.js packages. And that makes possible to use something like React to render your script from server-side code in Python.
24:26
So we can actually create an isomorphic web application in Python alone without the need to mess with Node.js anymore because we can just render the isomorphic part, the part that uses React, from our Python code
24:41
by using DuckPy.js compile and running then the render to static markup code which will render the React component to plain markup. Inject this markup into our template and never React from the client-side continue from the markup we generated.
25:07
Actually if you want client-side React to continue from the markup we created from the server you should be using render to string instead of render to static markup. But that doesn't matter, you just switch the function name and things work.
25:22
So you can provide the first version of your web page rendered from the server so the user sees the result instantly and then the client-side library kicks in and continues from there without any problem. Because we actually run the real React code from our server.
25:43
And not only that, if you need to export your Python code from Python of course and make it available inside JavaScript, as you can call JavaScript from Python we can actually call Python from JavaScript. We just use the export function feature of DuckPy and in this case we export the sorted function
26:07
which is built into Python and sorts whatever you throw at it and we export it as sort number. So inside JavaScript we will be able to call it using call Python sort numbers
26:21
and passing the numbers that should be sorted and we will get back as a result of course the sorted numbers. And also you don't have to care about references to the objects and memory management because there is a choice I made which is to pass everything by value.
26:43
So every value you pass back and forth from Python to JavaScript is actually copied. It's not the original object itself. This allows much simpler resolution of problems in memory management and references and you won't end up with leaking dangling pointers in Python
27:01
because some code in JavaScript is leaking memory which needs a Python object. Leaking memory in JavaScript is pretty easy sometimes. But that won't actually do anything to your Python code because the objects you pass back and forth are copies and not the original object.
27:25
So this actually did everything I needed. And I was really happy with DuckPy as a solution because I could actually manage all my dependencies from setup.py without the need to maintain NPM or an external tool that maintains both NPM and PIP.
27:42
And I could perform all the transpiling in Python so if I needed to add a feature or change something in my transpiler I could just mess up with Python code. And DuckPy actually has been a quite performing solution for me. I would say you should not use it on production
28:01
because there is a lot of C code. I mean, not on production. You should not use it in the live running web application. You should use it during the packaging of the web application because there is a lot of C code inside. I cannot guarantee that you won't crash with a segmentation fault while I'm doing 2,000 requests a second and things like that.
28:23
But for everything that is related to packaging and building the resources and so on, it always works without any problem for me so far. The bugs that I found are being solved pretty quickly and it has been like a few months that I've been using it without finding a new bug.
28:42
So if you want to try it, feel free to. DuckPy actually works for practically any used version of Python from 2.6 to 3.5. And if you find any bug, feel free to open an issue on GitHub because it's totally open source. It's fully tested.
29:01
I guarantee there is 100 coverage on all the DuckPy code and I have examples that ensure that all the transpilers are still working whenever I update the JavaScript side code of everything. And to use it, you just have to pre-install it and have fun with it. So thank you. If you have any questions.
29:36
So this is really awesome. Thanks very much for showing this up. Have you had any experience using it for things like Ember CLI,
29:44
which is more opinionated? No, never tried with Ember. I tried with Angular 2 and React only. Feel free to try it if you find any issues. Send me an email, I'll try to solve it.
30:03
Thanks very much. It's very cool to not have to run Node.js on my web server. So thank you for that. Do you know if your project will work with the less CSS compiler transpiler? It should.
30:20
I didn't try it on DuckPy itself because you have a less compiler for web assets. So I mostly use SaaS, but I know there is the less compiler for web assets itself, so it never came to my mind in my need. But it should be a matter of just loading the JS file of the less compiler,
30:41
running it with DuckPy, and see if it does what you expect. Usually it does. The only problem you might face is with regular expressions because DuckPy actually applies the JavaScript standard more tightly than Node.js. So some syntaxes that Node.js considers valid in regular expressions
31:00
and are actually not, DuckPy will tell you, hey, this is not valid. You need to escape this part of the regular expression. As far as it's a matter of fixing the two free regular expressions and the old code, we usually just work. Thank you very much. A semi-related question. Have you investigated at all the state of pure Python JavaScript interpreters?
31:29
I'm not saying it's an alternative. That's a complex question because, yes, I did like a year ago. I tried to use some of them, but I'm not sure, at least a year ago,
31:43
none of them could actually be so resilient to make sure that you throw a Node.js library to it and it will just work. For example, DuckPy has... I invested pretty much some time into providing a compatible support for required function
32:00
to make sure that the dependencies resolution and so on works exactly the same as Node.js. And so I did it. I did it some time ago, so it might be that the situation changed. Okay, yeah. Okay, I think that was our last question.
32:22
Yep. Thank you very much. Thank you. Thank you.