[kdev-python] [Bug 438206] Fails to build against Python 3.10

2022-11-23 Thread Jacek Szafarkiewicz
https://bugs.kde.org/show_bug.cgi?id=438206

Jacek Szafarkiewicz  changed:

   What|Removed |Added

 CC|sza...@linux.pl |

-- 
You are receiving this mail because:
You are watching all bug changes.

[kdev-python] [Bug 438206] Fails to build against Python 3.10

2022-11-22 Thread Thomas Bettler
https://bugs.kde.org/show_bug.cgi?id=438206

--- Comment #19 from Thomas Bettler  ---
great to know - THX a lot for all your work

-- 
You are receiving this mail because:
You are watching all bug changes.

[kdev-python] [Bug 438206] Fails to build against Python 3.10

2022-11-22 Thread Sven Brauch
https://bugs.kde.org/show_bug.cgi?id=438206

--- Comment #18 from Sven Brauch  ---
Master now also supports Python 3.11, where "supports" means "builds and runs
without crashing".

It's too late to get into Applications 22.12, but it will be in the next
release.

-- 
You are receiving this mail because:
You are watching all bug changes.

[kdev-python] [Bug 438206] Fails to build against Python 3.10

2022-11-20 Thread Sven Brauch
https://bugs.kde.org/show_bug.cgi?id=438206

--- Comment #17 from Sven Brauch  ---
Not just like that, but it shouldn't be a large effort to support it now. I
should be able to look into that sometime in the next few weeks, I think.

-- 
You are receiving this mail because:
You are watching all bug changes.

[kdev-python] [Bug 438206] Fails to build against Python 3.10

2022-11-20 Thread Thomas Bettler
https://bugs.kde.org/show_bug.cgi?id=438206

--- Comment #16 from Thomas Bettler  ---
@Sven do you know whether python 3.11 would work and could be enabled as well?

-- 
You are receiving this mail because:
You are watching all bug changes.

[kdev-python] [Bug 438206] Fails to build against Python 3.10

2022-11-06 Thread Sven Brauch
https://bugs.kde.org/show_bug.cgi?id=438206

Sven Brauch  changed:

   What|Removed |Added

 Status|CONFIRMED   |RESOLVED
 Resolution|--- |FIXED

--- Comment #15 from Sven Brauch  ---
Master now supports Python 3.10.

-- 
You are receiving this mail because:
You are watching all bug changes.

[kdev-python] [Bug 438206] Fails to build against Python 3.10

2022-07-30 Thread Alexander Kernozhitsky
https://bugs.kde.org/show_bug.cgi?id=438206

Alexander Kernozhitsky  changed:

   What|Removed |Added

 CC||sh200...@mail.ru

-- 
You are receiving this mail because:
You are watching all bug changes.

[kdev-python] [Bug 438206] Fails to build against Python 3.10

2022-05-04 Thread Andrew Shark
https://bugs.kde.org/show_bug.cgi?id=438206

Andrew Shark  changed:

   What|Removed |Added

 CC||ash...@linuxcomp.ru

-- 
You are receiving this mail because:
You are watching all bug changes.

[kdev-python] [Bug 438206] Fails to build against Python 3.10

2022-03-21 Thread Sven Brauch
https://bugs.kde.org/show_bug.cgi?id=438206

--- Comment #14 from Sven Brauch  ---
Let's move any discussion on this topic to
https://invent.kde.org/kdevelop/kdev-python/-/merge_requests/16.

-- 
You are receiving this mail because:
You are watching all bug changes.

[kdev-python] [Bug 438206] Fails to build against Python 3.10

2022-03-13 Thread Sven Brauch
https://bugs.kde.org/show_bug.cgi?id=438206

--- Comment #13 from Sven Brauch  ---
Hi, I've drafted a possible way forward in the "python310" branch in the
kdev-python repo. The AST is written to an XML stream from a tiny Python
program and read using QXmlStreamReader in C++. So far, only Module,
Assignment, Name and Constant AST nodes can be deserialized, so we can
basically parse programs of the form "a = 3" and nothing else ;)

But the whole structure is there, most of what's left is filling in all the 63
or so missing NodeReader<> template specializations for all the AST nodes, see
https://invent.kde.org/kdevelop/kdev-python/-/blob/python310/parser/astfromxml.cpp#L164

In addition, we need to deal with 1. error reporting (parse errors, plus
invalid XML issues), and 2. running the ast-to-xml Python code in-process, that
should make it reasonably fast. But I'm fairly certain that the most difficult
step is done.

-- 
You are receiving this mail because:
You are watching all bug changes.

[kdev-python] [Bug 438206] Fails to build against Python 3.10

2022-03-03 Thread Vladimir Yerilov
https://bugs.kde.org/show_bug.cgi?id=438206

Vladimir Yerilov  changed:

   What|Removed |Added

 CC||openmind...@gmail.com

-- 
You are receiving this mail because:
You are watching all bug changes.

[kdev-python] [Bug 438206] Fails to build against Python 3.10

2022-03-02 Thread Sven Brauch
https://bugs.kde.org/show_bug.cgi?id=438206

--- Comment #12 from Sven Brauch  ---
Any help is certainly very welcome. I am not very active on IRC currently, but
I definitely read and answer kdevelop-de...@kde.org.

In principle, the task is simple: in parser/ast.h we have our own data
structure for an AST, and that needs to be populated. The current way to do
that is based on a... let's say, "creative" domain-specific language which
describes how CPython's internal AST representation maps to ours from ast.h. C
code is generated from this DSL file. You could just as well write that C code
by hand -- it's not actually that much, a few hundred lines.

This doesn't work any more, because CPython's representation is gone.

There are certainly several different approaches to fix this, I think my
suggestion above is the most straightforward one since it doesn't structurally
change anything. Though, if one has to touch all this stuff *anyways*, it might
be worth evaluating other parser libraries which support also e.g. proper
incomplete parsing. I'd honestly opt for whatever the person doing it feels
most comfortable with.

I wouldn't discard approaches involving serializing/deserializing the AST (e.g.
to/from XML) because of performance concerns; XML stream
serialization/deserialization (i.e. if you avoid building a DOM) is extremely
fast, and I'm pretty sure that the impact is negligible compared to the
semantic analysis effort later on. The only thing I'd really try to avoid is
spawning a process for each parse job.

-- 
You are receiving this mail because:
You are watching all bug changes.

[kdev-python] [Bug 438206] Fails to build against Python 3.10

2022-03-02 Thread Francis Herne
https://bugs.kde.org/show_bug.cgi?id=438206

--- Comment #11 from Francis Herne  ---
To address the development comments:

It's great that you're interested in contributing to kdev-python. As you can
see it's kind of needed at the moment. Consider dropping by #kdevelop on Libera
IRC if you want to discuss it (ping FLHerne [me] or scummos [Sven]).

Tools/tests:
There are quite a lot of unit/end-to-end tests. Run `ninja test` (or `make
test`) after building kdev-python, or for more detailed output run the test
binaries individually (e.g. build/parser/tests/pyasttest ,
build/duchain/tests/pyduchaintest ).

parser/generated.h converts from CPython's AST structures to kdev-python's.
It's generated based on parser/python39.sdef by the script
conversionGenerator.py.

The script pythonpythonparser.py spits out the AST as an XML representation,
using the Python `ast` module API. In recent years it's been used only as a
tool for debugging and development. I believe it was once used in kdevelop
before it called into the C API instead, and could be resurrected as such to
implement Sven's suggestion. I'm not a big fan of this idea, I suspect
performance would suffer considerably.

-- 
You are receiving this mail because:
You are watching all bug changes.

[kdev-python] [Bug 438206] Fails to build against Python 3.10

2022-03-02 Thread Francis Herne
https://bugs.kde.org/show_bug.cgi?id=438206

--- Comment #10 from Francis Herne  ---
My own thinking is that it's probably easier to fork (or, so far as possible,
vendor in the most recent version of) CPython's parser code.

The amount of code involved is relatively small - see
https://github.com/python/typed_ast/tree/master/ast3 which is another fork.

(in the past I'd considered changing kdev-python to use that typed-ast library
instead of linking against the CPython parser, but it's now deprecated with the
features added to CPython upstream).

Sadly I haven't yet had time to work on this, but I hope to in a few weeks.
Right now I'm busy buying and moving onto a houseboat...

-- 
You are receiving this mail because:
You are watching all bug changes.

[kdev-python] [Bug 438206] Fails to build against Python 3.10

2022-03-02 Thread Øystein S . Haaland
https://bugs.kde.org/show_bug.cgi?id=438206

--- Comment #9 from Øystein S. Haaland  ---
(In reply to Sven Brauch from comment #7)
> Unfortunately Python completely removed the Parser module we were using from
> their public API, so there is no easy fix for this issue.
> 
> The most realistic option at this point is probably to write a Python
> snippet which uses the "ast" module to do the parsing (which is effectively
> exactly the same) and serializes the result somehow, e.g. into an XML or
> ProtocolBuffer stream. Then we can execute this snippet from C++ code (this
> works without creating a process using Python's C API) and deserialize it,
> giving us the same data structure as before.

Thanks a lot for sketching a possible route for implementing this!

I would be more than willing to put some effort into this if I had the time.
But maybe with some guidance it would still be possible to have some progress
every now and then.

The first part seem easy enough;  write the code that reads a file with python
code and loads it into the ast.

You mention a few ways serialization can be done. Are there any examples of
similar approaches already in the code base? Are there already places where
de-serialization is done with one of the formats mentioned (or other formats
for that matter)?

Any pointers for tools/tests in the repo that can be useful for working with
this would be much appreciated.

Btw. would it make things easier if one used cython or mypyc to compile the
python part to a c module?

Again, if there is any way I could fund this work more or less directly, I
would also be interested in hearing about that.

-- 
You are receiving this mail because:
You are watching all bug changes.

[kdev-python] [Bug 438206] Fails to build against Python 3.10

2022-03-01 Thread Sven Brauch
https://bugs.kde.org/show_bug.cgi?id=438206

--- Comment #8 from Sven Brauch  ---
>From an end-user perspective, you can use the KDevelop AppImage from our
website, which we can build against Python 3.9 until this issue is resolved
somehow. It will of course not support Python 3.10 syntax, so if you require
that, you are out of luck for now.

-- 
You are receiving this mail because:
You are watching all bug changes.

[kdev-python] [Bug 438206] Fails to build against Python 3.10

2022-03-01 Thread Sven Brauch
https://bugs.kde.org/show_bug.cgi?id=438206

Sven Brauch  changed:

   What|Removed |Added

 CC||m...@svenbrauch.de

--- Comment #7 from Sven Brauch  ---
Unfortunately Python completely removed the Parser module we were using from
their public API, so there is no easy fix for this issue.

The most realistic option at this point is probably to write a Python snippet
which uses the "ast" module to do the parsing (which is effectively exactly the
same) and serializes the result somehow, e.g. into an XML or ProtocolBuffer
stream. Then we can execute this snippet from C++ code (this works without
creating a process using Python's C API) and deserialize it, giving us the same
data structure as before.

-- 
You are receiving this mail because:
You are watching all bug changes.

[kdev-python] [Bug 438206] Fails to build against Python 3.10

2022-03-01 Thread Francis Herne
https://bugs.kde.org/show_bug.cgi?id=438206

Francis Herne  changed:

   What|Removed |Added

 CC||pierre.bour...@free.fr

--- Comment #6 from Francis Herne  ---
*** Bug 443167 has been marked as a duplicate of this bug. ***

-- 
You are receiving this mail because:
You are watching all bug changes.

[kdev-python] [Bug 438206] Fails to build against Python 3.10

2022-02-16 Thread Jacek Szafarkiewicz
https://bugs.kde.org/show_bug.cgi?id=438206

Jacek Szafarkiewicz  changed:

   What|Removed |Added

 CC||sza...@linux.pl

-- 
You are receiving this mail because:
You are watching all bug changes.

[kdev-python] [Bug 438206] Fails to build against Python 3.10

2021-12-21 Thread Øystein S . Haaland
https://bugs.kde.org/show_bug.cgi?id=438206

--- Comment #5 from Øystein S. Haaland  ---
(In reply to Luke Horwell from comment #4)
> (In reply to Øystein S. Haaland from comment #3)
> > I use kdevelop for python development in my day-to-day job. It seem now that
> > kdev-python has stopped working on arch, which I am currently using.
> 
> I use KDevelop on Arch nearly every day too. A workaround I found is to
> install Python 3.9 (`python39` in AUR) and install `kdevelop-python` (now in
> AUR). Syntax highlighting and parsing works again as before, and so far, it
> is processing modules installed in /usr/lib/python3.10 for auto-completion,
> etc. I imagine Python 3.10-specific syntax won't work (I haven't checked)
> but at least things can continue to work for Python <= 3.9 projects.

I too found the kdev-python AUR, installed that, and it seems to work as
before. On my setup, I have py3.9 installed, not 3.10 yet. So in principle, I
guess kdev-python should still have worked.

-- 
You are receiving this mail because:
You are watching all bug changes.

[kdev-python] [Bug 438206] Fails to build against Python 3.10

2021-12-21 Thread Luke Horwell
https://bugs.kde.org/show_bug.cgi?id=438206

--- Comment #4 from Luke Horwell  ---
(In reply to Øystein S. Haaland from comment #3)
> I use kdevelop for python development in my day-to-day job. It seem now that
> kdev-python has stopped working on arch, which I am currently using.

I use KDevelop on Arch nearly every day too. A workaround I found is to install
Python 3.9 (`python39` in AUR) and install `kdevelop-python` (now in AUR).
Syntax highlighting and parsing works again as before, and so far, it is
processing modules installed in /usr/lib/python3.10 for auto-completion, etc. I
imagine Python 3.10-specific syntax won't work (I haven't checked) but at least
things can continue to work for Python <= 3.9 projects.

-- 
You are receiving this mail because:
You are watching all bug changes.

[kdev-python] [Bug 438206] Fails to build against Python 3.10

2021-12-20 Thread Øystein S . Haaland
https://bugs.kde.org/show_bug.cgi?id=438206

Øystein S. Haaland  changed:

   What|Removed |Added

 CC||oystein.s.haal...@gmail.com

--- Comment #3 from Øystein S. Haaland  ---
Hei,

I use kdevelop for python development in my day-to-day job. It seem now that
kdev-python has stopped working on arch, which I am currently using. I might in
any case like to change distros, but it seems inevitable that this particular
python version change will become an issue down the road for other distros as
well.

Is there any way I could help out? If at all possible, I would really like to
fund someone directly to work on this. I don't think I would have time to
devote myself, in particular since I'm not very familiar with c++.

-- 
You are receiving this mail because:
You are watching all bug changes.

[kdev-python] [Bug 438206] Fails to build against Python 3.10

2021-12-14 Thread Luke Horwell
https://bugs.kde.org/show_bug.cgi?id=438206

Luke Horwell  changed:

   What|Removed |Added

 CC||c...@horwell.me

--- Comment #2 from Luke Horwell  ---
A heads up that Arch Linux is now affected with their recent rebuild to Python
3.10.1. The package was removed from their repositories:

https://pkgbuild.com/~foutrelis/failed-py310-builds/kdevelop-python.log
https://github.com/archlinux/svntogit-packages/commits/packages/kdevelop-python
https://archlinux.org/todo/remaining-rebuilds-for-python-310/

-- 
You are receiving this mail because:
You are watching all bug changes.

[kdev-python] [Bug 438206] Fails to build against Python 3.10

2021-12-11 Thread Thomas Bettler
https://bugs.kde.org/show_bug.cgi?id=438206

Thomas Bettler  changed:

   What|Removed |Added

 CC||thomas.bett...@gmail.com

-- 
You are receiving this mail because:
You are watching all bug changes.

[kdev-python] [Bug 438206] Fails to build against Python 3.10

2021-09-07 Thread Francis Herne
https://bugs.kde.org/show_bug.cgi?id=438206

Francis Herne  changed:

   What|Removed |Added

   Assignee|m...@svenbrauch.de  |m...@flherne.uk
 Ever confirmed|0   |1
 Status|REPORTED|CONFIRMED
 CC||m...@flherne.uk

--- Comment #1 from Francis Herne  ---
Noted, we will need to add support for Python 3.10 by next release.

As I mentioned previously, we tend to leave this until late in the Python
release cycle because the API is prone to breaking changes even in late betas.

This time Python upstream has made life particularly inconvenient for us
(c.f.https://bugzilla.redhat.com/show_bug.cgi?id=1898116#c12) and we'll have to
work around their deliberate obstruction. C'est la vie.

-- 
You are receiving this mail because:
You are watching all bug changes.