-
Notifications
You must be signed in to change notification settings - Fork 24
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
Transpile license-expression into javascript - Python3-only #19
Conversation
@all3fox could it therefore make sense to move or fork your transcrypt fork with patches as an org-level repo too? |
Yes, maybe it is worth to just move my all3fox/Transcrypt to nexB/Transcrypt and give me some modification rights? |
@all3fox sure, let's do this tomorrow |
This get transcrypt instead directly from a wheel path.... but this also requires mypy? now by default |
Thanks for help, I've added PyYAML and
Transcrypt works but for some reason does not pick up
|
if it helps temporarily to rename |
Ok, at this point
does not do the trick. That's weird but a more reliable workaround is to manually install required branch of |
that works too. |
As I've mentioned on gitter, the Right now I am facing an
I've seen this error at this exact step before in While I was figuring out the cause for a |
Signed-off-by: Aleksandr Lisianoi <[email protected]>
Transcrypt does not make wheels by default and does not instantly accept all the changes, so instead of just building a wheel from qquick/Transcrypt master, this wheel comes from all3fox/Transcrypt vendored branch. Refs: https://github.com/all3fox/Transcrypt/tree/vendored Signed-off-by: Aleksandr Lisianoi <[email protected]>
Signed-off-by: Philippe Ombredanne <[email protected]>
* also make a specifc transpile config to use with Python 3 only * to configure make sure you default python is 3.6 (for instance with pyenv local 3.6.1) and then run: ./configure etc/conf/dev/transpile to select the extra config for transpile. This will not run by default and will not run on Python2 Signed-off-by: Philippe Ombredanne <[email protected]>
Signed-off-by: Aleksandr Lisianoi <[email protected]>
It is an adapted version of a similar script from boolean.py Signed-off-by: Aleksandr Lisianoi <[email protected]>
Signed-off-by: Aleksandr Lisianoi <[email protected]>
Signed-off-by: Aleksandr Lisianoi <[email protected]>
Signed-off-by: Aleksandr Lisianoi <[email protected]>
Transcrypt used to *sometimes* rely on os.getcwd() to get path to the project. That does not always work and it is better to use utils.commandArgs.source all the time. Signed-off-by: Aleksandr Lisianoi <[email protected]>
Signed-off-by: Aleksandr Lisianoi <[email protected]>
Note: copy.copy and copy.deepcopy are good candidates to be implemented in Transcrypt because they could just delegate the work to .__copy__() and .__deepcopy__() methods on the target objects respectively. Signed-off-by: Aleksandr Lisianoi <[email protected]>
1. Transcrypt does not support functools 2. @total_ordering is not really necessary for LicenseSymbols and others Signed-off-by: Aleksandr Lisianoi <[email protected]>
1. Transcrypt does not support it 2. license_expression does not use it Signed-off-by: Aleksandr Lisianoi <[email protected]>
Signed-off-by: Aleksandr Lisianoi <[email protected]>
Some classes in _pyahocorasick relied on OrderedDict for as_dict which used an OrderedDict purely for the __repr__, so make them use just dict. Python 3.6 even has an implementation detail that the built-in dict behaves like an OrderedDict, so all tests pass there. Alternative is to bring OrderedDict from collections.py and _collections_abc.py which still would not transpile with Transcrypt because it uses decorators heavily. Signed-off-by: Aleksandr Lisianoi <[email protected]>
In both single and multiple inheritance cases just drop the arguments. Let's see if Transcrypt will cope with multiple inheritance. Signed-off-by: Aleksandr Lisianoi <[email protected]>
Signed-off-by: Aleksandr Lisianoi <[email protected]>
Error was "nil = object(): object is not a function" Signed-off-by: Aleksandr Lisianoi <[email protected]>
Signed-off-by: Aleksandr Lisianoi <[email protected]>
Transcrypt needs a class instance to be able to call a class method Signed-off-by: Aleksandr Lisianoi <[email protected]>
Signed-off-by: Aleksandr Lisianoi <[email protected]>
When transpiled to javascript, deleting elements from a list does not change the length of the list there. This leads to eventual "index out of range" behavior. So, avoid the del keyword altogether. Signed-off-by: Aleksandr Lisianoi <[email protected]>
Without this calling ./bin/py.test for some reason starts looking for yaml, which is not installed, and then fails. Signed-off-by: Aleksandr Lisianoi <[email protected]>
Signed-off-by: Aleksandr Lisianoi <[email protected]>
Signed-off-by: Aleksandr Lisianoi <[email protected]>
In Python before 3.6 this conversion does not take place automatically Signed-off-by: Aleksandr Lisianoi <[email protected]>
Signed-off-by: Aleksandr Lisianoi <[email protected]>
Signed-off-by: Aleksandr Lisianoi <[email protected]>
Signed-off-by: Aleksandr Lisianoi <[email protected]>
Signed-off-by: Aleksandr Lisianoi <[email protected]>
Signed-off-by: Aleksandr Lisianoi <[email protected]>
The licenses are predefined and not, and are both an alias and not. Signed-off-by: Aleksandr Lisianoi <[email protected]>
Signed-off-by: Aleksandr Lisianoi <[email protected]>
If your key function returns a "complicated" object (an array, etc.) then you should be prepared that Javascript will use vanilla comparison operators on that object. Since more often than not objects in Javascript are compared as Unicode code points, you should really know what you are doing. On the other hand, numbers will be compared as numbers. Signed-off-by: Aleksandr Lisianoi <[email protected]>
Signed-off-by: Aleksandr Lisianoi <[email protected]>
Also, throw in some parenthesis Signed-off-by: Aleksandr Lisianoi <[email protected]>
Since 'or' is also a logical operator, it is important that LicenseSymbol's supersede it and treat as part of a symbol Signed-off-by: Aleksandr Lisianoi <[email protected]>
This tells Transcrypt to define __init__ function (named after the main entry point of license_expression) on the window object. Without this flag Transcrypt will defined __init__ function on the module.exports object, which works for node. Signed-off-by: Aleksandr Lisianoi <[email protected]>
Transcrypt chokes if you use named arguments and decide to skip a couple in between. Example: if the function has three arguments and you just use the first and the third (even if named), Transcrypt will incorrectly assign your third (named) argument into the second in javascript. Note: Transcrypt has a `-k` switch that enables extended keyword argument support. However, this switch does not play nicely with the `-e 6` switch (EcmaScrypt 6 support) and the problem is unclear: it may be Transcrypt's fault or not. Fact: AND_class.__bool__ instanceof Function is true but calling AND_class.__bool__() throws an excpetion. Refs: https://stackoverflow.com/questions/42064466/instanceof-using-es6-class-inheritance-chain-doesnt-work Instead, just avoid skipping keyword arguments. Signed-off-by: Aleksandr Lisianoi <[email protected]>
Transcrypt will transpile your classmethod only if an instance of a class is explicitly created to call that classmethod. It does not support calling classmethod on a class itself. Signed-off-by: Aleksandr Lisianoi <[email protected]>
Transcrypt will transpile your classmethod only if an instance of a class is explicitly created to call that classmethod. It does not support calling classmethod on a class itself. Signed-off-by: Aleksandr Lisianoi <[email protected]>
Signed-off-by: Aleksandr Lisianoi <[email protected]>
I just rebased your branch and pushed this as |
For reference, this depends on bastikr/boolean.py#72 |
This is a long running PR that will capture progress on transpiling
license-expression
into javascript with Transcrypt. The very first problem was to bundle a vendored version of Transcrypt as a development dependency: a) Transcrypt does not build wheels by default and b) not all changes that are required have been accepted (and they are not instantly accepted, it takes a while).So, I am bundling a custom wheel with the changes that I need with the first commit. Next order of business: where to put the transpilation script (
boolean.py
currently hasetc/transpile.py
as the script that powers transpilation).Update: relevant
license-expression
issue about online tool: #18