Skip to content
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

python version compatibilty #31

Open
indexofrefraction opened this issue May 24, 2021 · 9 comments
Open

python version compatibilty #31

indexofrefraction opened this issue May 24, 2021 · 9 comments

Comments

@indexofrefraction
Copy link

hi,
i tried this to minify code that needs to run on python 2.7 and python 3.7
sadly print() gets translated to print if minifying is run on 2.7 which breaks compatibilty
exec(...) gets minified to: exec ... also triggering errors on 3.x

it would be nice if there was a compatibilty mode not downgrading all code to 2.x standard
best, index

@dflook
Copy link
Owner

dflook commented May 25, 2021

If you run python-minifier using python 3.7, the output will be compatible with 3.7
Do you have any problems running the 3.7 minified code on 2.7?

@indexofrefraction
Copy link
Author

indexofrefraction commented May 25, 2021

i'd have to test if 3.7 minified code works on 2.7, that would be a workaround.
but for me ideally minification would work from both python versions with results working on both versions, too.
hence the idea of a compat mode without syntax changes. (the code itself works on both versions)

@dflook
Copy link
Owner

dflook commented May 25, 2021

Python-minifier relies on the running interpreter for parsing, so it won't have greater compat than python itself.
If there is any code that works on a lower version than it's being minified with but breaks after being minified, that might be worth a compatability mode.

On that note, did you from __future__ import print_function in the code where print() is transformed to print? That would be a bug

@rochacbruno
Copy link

Is 3.10 support on the roadmap?

@dflook
Copy link
Owner

dflook commented Oct 6, 2021

@rochacbruno Yes. It's been implemented, but must be validated against the release version. If all goes well it will be released today 🤞.

@rochacbruno
Copy link

thanks @dflook I am bumping https://GitHub.com/rochacbruno/dynaconf to run CI on 3.10 and looks like the missing package is minify, we use it for our vendoring script.

Thanks

@dflook
Copy link
Owner

dflook commented Oct 6, 2021

@rochacbruno python-minifier 2.5.0 is now available on PyPI with Python3.10 support

@rochacbruno
Copy link

Thanks @dflook now dynaconf install test on 3.10 is passing :)

https://github.com/rochacbruno/dynaconf/runs/3816321083?check_suite_focus=true

@WebReflection
Copy link

WebReflection commented Aug 7, 2024

is there any reason for that <3.12 as Python version requirement? I am on Python 3.12.4 which is latest stable and it'd be unfortunate to need to downgrade latest stable for this lovely module, thanks.


edit never mind, I've seen this only now #94

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants