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

Minimum python version #12

Open
delneg opened this issue Oct 26, 2021 · 6 comments
Open

Minimum python version #12

delneg opened this issue Oct 26, 2021 · 6 comments

Comments

@delneg
Copy link
Contributor

delneg commented Oct 26, 2021

What version will this be working starting from ?
I.e. in https://github.com/python/typeshed/blob/master/stdlib/uuid.pyi
there are separate type for version 3.7 and above and others. So, it's best to determine which this lib will support right away.

@dbrattli
Copy link
Collaborator

I think we should not target anything below 3.9. Not sure how we should version this going forwards? Not sure I want to end up with multiple branches targeting different Python versions, and publish multiple NuGets for each Python version. We should try to make things simple. But what to do with e.g methods and functions added in 3.10? Should we wait until we target 3.10 as the minimum version?

@delneg
Copy link
Contributor Author

delneg commented Oct 26, 2021

IMO it's best to have something like

@available(iOS 9.0, *)
func useStackView() {
    // use UIStackView
}    

and

if #available(iOS 9.0, *) {
  // use UIStackView
} else {
  // show sad face emoji
}

to determine different versions & generate types accordingly, if possible.

@hlizard
Copy link

hlizard commented Jul 21, 2022

@dbrattli

I think we can use coconut:
https://github.com/evhub/coconut/tree/develop
https://coconut.readthedocs.io/en/latest/HELP.html#introduction

"
Welcome to the tutorial for the Coconut Programming Language! Coconut is a variant of Python built for simple, elegant, Pythonic functional programming. But those are just words; what they mean in practice is that all valid Python 3 is valid Coconut but Coconut builds on top of Python a suite of simple, elegant utilities for functional programming.

Why use Coconut? Coconut is built to be useful. Coconut enhances the repertoire of Python programmers to include the tools of modern functional programming, in such a way that those tools are easy to use and immensely powerful; that is, Coconut does to functional programming what Python did to imperative programming. And Coconut code runs the same on any Python version, making the Python 2/3 split a thing of the past.

Specifically, Coconut adds to Python built-in, syntactical support for:

pattern-matching

algebraic data types

destructuring assignment

partial application

lazy lists

function composition

prettier lambdas

infix notation

pipeline-style programming

operator functions

tail call optimization

where statements

and much more!
"

@dbrattli
Copy link
Collaborator

@hlizard Coconut looks like a really nice project, but I don't think it's the right abstraction for Fable. Python 2 is out of the question anyways, and solving the Python 3 problem would only be replaced with a similar Coconut version problem.

@smoothdeveloper
Copy link

Just to add to the discussion, right now Fable python target compiles code that doesn't seem to load in python 3.9.7, providing this error message:

TypeError: 'ABCMeta' object is not subscriptable

Stemming from

from .types import FSharpRef, Record

As far as I could search, it is from an error related to type annotation in conjunction with the @DataClass attributes that are put in the fable.core standard library for python, and it seems to trip the 3.9.7 parser.

I don't know exactly in which release it starts to work, it does work on 3.11.2, and I vaguely remember seeing "fixed in 3.10" but I can't find the PEP nor the stackoverflow answer that pointed me there.

For this reason, I'd suggest not mentioning python 3.9 or bumping this to a higher version in the readme of this repository.

As for the bindings in this repository and which version of the python library to support, that seems to be a big can of worm, python seems to be evolving fast, some of my own code written few months back starts giving me deprecation warnings after doing a minor bump of the python version.

@dbrattli
Copy link
Collaborator

Yes, agree. Removing support for Python 3.9 in Fable. Will update the readme

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