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

What is the plan for Python 3 support? #657

Closed
pspacek opened this issue May 24, 2017 · 59 comments
Closed

What is the plan for Python 3 support? #657

pspacek opened this issue May 24, 2017 · 59 comments

Comments

@pspacek
Copy link

pspacek commented May 24, 2017

Hello,

I'm trying to find out if there are any plans for "the original" scapy to support Python 3 or not.

The only references to real code I found is in #87 (comment) but it seems to me that the plan for scapy rewrite is not moving forward because repo https://bitbucket.org/secdev/scapy3-prototype2 has last commit from 2015-02-25.

Given that current Fedora (and so future of RHEL/CentOS/Scientific Linux) is migrating away from Python 2 (as well as all other Linux distros) this forces me to ask the question again:
What are the plans for Python 3 support in scapy?

Without some form plan, Fedora/RHEL/CentOS will have to implement the same approach as Debian (see #87 (comment)), i.e. use scapy3k instead of scapy.

If this is the case, are there any plans to start merging features between scapy and scapy3k?

Thank you for your time and answers.

@guedou
Copy link
Member

guedou commented May 24, 2017

Python 3 compatibility will likely happen during 2017. However, it is difficult to know exactly when. @gpotter2 does an amazing job at pushing Python 3 support by submitting dedicated PRs.

The efforts currently happen on two labels:

  • coverage: the goal is to enhance the code coverage in order to make sure that things won't break;
  • convergence: the goal is to rewrite parts of Scapy to make it Python 3 compatible code.

Code coverage is now close to 80% (it was ~50% back in December 2016). I believe that it is a good indicator that Python 3 compatibility can be achieved in 2017 without introducing regressions.

Feel free to contribute if you are interested !

@pspacek
Copy link
Author

pspacek commented May 24, 2017

Oh, that is awesome! I'm on packaging side here so it is sufficient for me to know that something is happening and that we do not need to drag scapy3k into Fedora (assuming the port will happen soon).

Thank you very much!

@gpotter2
Copy link
Member

gpotter2 commented May 26, 2017

@pspacek Scapy3k was created a quite long time ago. It has not received all the bug fixes of scapy and its development is way less active than this one.

There are no plan of merging both because of how old it is, and it wouldn't not make sense to fix the conflicts between them...

Merging the different parts of python 3 support is slow, as we need to keep a stable environment.

I have a roadmap of the next changes needed, and will pretty much work as quick as the review goes in, but there are quite a lot of things to fix :)

Have you got any idea of when will python 2 be abandoned ?

@zopieux
Copy link

zopieux commented May 29, 2017

Does the scapy dev team plans for a Python 2 and 3 code base, or an alternative branch/project for Python 3 support maintained separately?

@guedou
Copy link
Member

guedou commented May 29, 2017 via email

@L1ghtn1ng
Copy link

@guedou @gpotter2 This is a fork and is python 3 only https://github.com/phaethon/scapy and IMO scapy should by python 3 only as on this day https://pythonclock.org/ python 2 is EoL. With the changes in the fork, I do not see why you could not get python 3 support much quicker if you want to work with @phaethon to do so?

@guedou
Copy link
Member

guedou commented May 29, 2017 via email

@phaethon
Copy link

My short version of phaethon/scapy branch and our relationship with @guedou and co. In 2015 an issue was raised (not by me) on bitbucket repository about python3 support and the answer of the core team was "not at this time, if you need it fork the repository". This is exactly what I did. After that I hoped that there would be some cooperation between the repos, but no - I asked to include info about python3 compatibility, but the suggestion was refused. I wanted people to find out that it is possible to use scapy with python3 (as many are tied to python3 for one reason or another) and was pushing information about the fork across different channels. The core team considered it being aggressive and in a passive aggressive form themselves kept ignoring if not hiding info about the python3 fork.

I believe @guedou would more likely either reimplement from ground 0 python3 compatibility (as it was done for pcapng support after it was implemented in scapy3k) or wait for someone to bring the change from scapy3k to scapy (like it was done with Windows reimplementation, which eliminated libdnet, which was copied from scapy3k by a contributor). I would love to work in a cooperative way, but don't believe @guedou - he never invited me. Posting all scapy3k changes as one big PR would not make sense.

I would believe it is possible to solve the situation by somebody from the community moderating the situation, but I wouldn't believe @guedou would let this happen. @guedou - fix me if I am wrong.

@phaethon
Copy link

and, btw, I wouldn't say it would be so hard to go through the differences and resync the repositories. With a trained eye it is quite quick to go through the commits. But for some people it would be too embarrassing to credit any of my effort, which made hundreds (measured by stars on github) or may be thousands of people to keep using scapy for last couple of years even if they are choosing to be with python3.

@gpotter2
Copy link
Member

gpotter2 commented May 29, 2017

@phaethon Hello,

It does not really make sense to have two concurrent repositories. Yours has many many missing features/fixes compared to this one, but I'm sure that it also has great improvements. Moreover it's not useful to remind us what you did add first on yours, as yours remains a fork of this one...

In a near future, this repository will support python 3, whatever you chose to act upon. We would be happy to get contributions until then.

@guedou
Copy link
Member

guedou commented May 29, 2017

Well, that's a convenient way to relate what really happened. It is quite distracting and fun to read. Thanks that was refreshing !

@phaethon
Copy link

@gpotter2 - a large part of the help you need is residing in a form of code in phaethon/scapy. You are welcome to ask me any questions that may arise. Fire up an issue on phaethon/scapy and I will prioritize responding to you over other issues. Actually, what I think has to be discussed first is the "interface" - how to treat strings and bytes, and what gets returned by different functions, and what expected at an input of the various function calls. scapy3k uses bytes for most things, but in some cases it may make sense to return/expect a string (e.g. domain name). It would be sad if secdev/scapy implemented incompatible interface to what scapy3k has, as I would believe many people working with python3 already have some code developed.

And, yes, I would appreciate including credit to me in a Readme of this repository as it has de facto used (I guess it still uses) parts of code copied from phaethon/scapy. This would be a nice and friendly invitation for further cooperation. Is that unreasonable?

@p-l-
Copy link
Member

p-l- commented May 29, 2017

I totally support @guedou point of view here. I don't think Scapy's code uses your code from phaethon/scapy, but I might be wrong (and actually I don't really care).

@L1ghtn1ng
Copy link

L1ghtn1ng commented May 29, 2017 via email

@p-l-
Copy link
Member

p-l- commented May 30, 2017

@L1ghtn1ng I don't think we need a mediator here, but thanks for your offer. We want to have Scapy work with both Python 2 & 3 and the same code base, and we are working on it.

@irl
Copy link
Contributor

irl commented Aug 22, 2017

I had previously been told that Python 3 support was not a priority for Scapy (#87 (comment)) but it appears that there's been some backtracking here.

As I have @phaethon's fork packaged as python3-scapy in Debian currently, that is as far as Debian is concerned the "official" Python 3 variant of Scapy.

@phaethon Do you have a test suite that could be applied to any Python 3 porting work in this repository to ensure that if we change the upstream source for the python3-scapy package in Debian back to @secdev's repository that we wouldn't break existing uses of Scapy on Python 3 in Debian?

@p-l-
Copy link
Member

p-l- commented Aug 22, 2017

@irl Scapy comes with an important test suite, and when it can use Python 3 we will be able to use the very same tests with both Python 2 and 3.

@irl
Copy link
Contributor

irl commented Aug 22, 2017

@p-l- You're missing the point. I need to ensure that whatever Python 3 support for Scapy looks like, anything that worked in @phaethon's fork still works. Otherwise, I don't see a path for switching the "python3-scapy" package to be being built from the secdev sources.

@p-l-
Copy link
Member

p-l- commented Aug 22, 2017

@irl you're missing the point. The fork you're using as a base is not Scapy. It's a fork, based on Scapy, that should probably have another name to avoid confusions. If you're naming something python3-scapy, then you probably want to make sure that what works with Scapy also works with it, by the way.

Its API and behavior already differ from Scapy's API. And Scapy's API and behavior are what exist in this repository.

@irl
Copy link
Contributor

irl commented Aug 23, 2017

Based on the previous comment I had received, linked above, I did not believe that there would be Python 3 support in Scapy and so this was the only way to include it in Debian.

The python3-scapy package provides a certain API and those that have installed the package in Debian will be upset when everything breaks because the API is different.

I only care about what is in Debian and maintaining compatibility across versions within Debian. My priorities are the users of Debian and high quality free software.

This is only an issue for the secdev developers if having their Scapy in Debian is the desirable outcome for them. Really, this is an issue for me, but it can be helped by a test suite from @phaethon so that I can come up with a series of patches to try to stop breakage from occurring due to a change in which project is considered the upstream for the package.

At the very least, I'd like to have an idea of how much breakage there would be.

If having Scapy in Debian is not something that really matters to you and you don't care, then that is also fine and I can follow up with @phaethon somewhere else.

@mcpat
Copy link
Contributor

mcpat commented Aug 23, 2017

If you really care what is in Debian it would be best to transition the python3-scapy package to a different one with a different name. Because using the same name for two different (even if diverged) things is not meaningful. The debian package should have been named python3-scapy3k from the beginning because that's how it's called upstream...

@irl
Copy link
Contributor

irl commented Aug 23, 2017

@mcpat This is not useful. I had previously been told that there would not be Python 3 support in Scapy and that @phaethon's fork was considered the Python 3 version going forward. This is the situation and this is what needs resolving.

@p-l-
Copy link
Member

p-l- commented Aug 23, 2017

The code you are currently packaging as "python3-scapy" is not Scapy. This code is Scapy. Python 3 support or not does not change that.

@gpotter2
Copy link
Member

gpotter2 commented Aug 23, 2017

@mcpat is a bit right if you ask me.
Scapy3k is a very different fork, and it was likely a bad idea to call it 'scapy for python 3'.

You have been told that python 3 support was 'not a priority' 10 months ago. That was our mistake and isn't the case anymore. We're currently working on it.

@irl
Copy link
Contributor

irl commented Aug 23, 2017

This conversation appears to be a waste of everyone's time. I would appreciate it if someone could ping me when this repository's support for Python 3 is nearing stability and I'll look at possible paths for the change at that time.

@mcpat
Copy link
Contributor

mcpat commented Aug 23, 2017

Hm why exactly is it not helpful? I just proposed a way to clean the current situation while not frustrating the users of the scapy3k API. I mean you decided yourself to package it under python3-scapy even though it was clear back than, that ongoing development and extensions are done in this repo here - and a merge path was and is not established!
Also, nobody said back than that support for Python3 was not envisioned. It just did not make it on the roadmap...

@p-l-
Copy link
Member

p-l- commented Nov 7, 2017

FWIW, Scapy is now usable with Python 3. Most tests pass (we still have to fix some parts of the code), and you can report bugs with Python 3 (see #936 for example). Thanks to all the contributors, and to @gpotter2 particularly!

@johnthagen
Copy link
Contributor

#861 has landed! 🎆

@irl
Copy link
Contributor

irl commented Jan 9, 2018

If there can be an RC release, I'm currently releasing the next version of PATHspider (mami-project/pathspider#188) and can test this against that. There is then only one other Debian package with a dependency on python3-scapy and then there should be a clear path to having python3-scapy switch upstream back to this repository.

Edit: Ideally this would be today, as that would fit nicely in the release workflow and I can fix any remaining issues, otherwise any Debian upload may have to wait for a PATHspider point release.

@p-l-
Copy link
Member

p-l- commented Jan 9, 2018

@irl I think @guedou planned a release for tomorrow morning.

@irl
Copy link
Contributor

irl commented Jan 9, 2018

Hm ok, do you see any significant changes happening between now and then? I can do my PATHspider testing with a local Debian package based on the current master perhaps?

@p-l-
Copy link
Member

p-l- commented Jan 9, 2018

I don't think so. Maybe #1024 could land in the meantime since it increases coverage and it's a tiny patch. Also, if @gpotter2 makes a PR to add Windows x86_64 tests. Anyway nothing that would impact the API.

@irl
Copy link
Contributor

irl commented Jan 9, 2018

Cool, thanks.

@guedou
Copy link
Member

guedou commented Jan 10, 2018

I just tagged 2.4-rc1, see https://github.com/secdev/scapy/releases

We need to merge some more PR before v2.4.0 but this will happen in the next weeks.

@irl
Copy link
Contributor

irl commented Jan 10, 2018

Ok, from my testing this is looking good for the requirements of PATHspider. I've not tested dhcpcanon yet though. I've opened phaethon/kamene#231 to look at making this co-installable and a proof of concept patch was working, until I messed it up and broke the patch which will need to be rewritten.

  • python3-scapy will be renamed to python3-scapy3k (using package name of "scapy3k" for import)
  • the python3-scapy3k will breaks+replaces python3-scapy << 0.21-1
  • the src:scapy package will then have a new python3-scapy binary package built from it (using package name of "scapy" for import)
  • both pathspider and dhcpcanon will then depend on scapy from this repository, keeping the fork available for those that need its API

@johnthagen
Copy link
Contributor

@guedou Will you wait until v2.4.0 before making a PyPI release or were you also planning to release a "-dev" release onto PyPI?

@guedou
Copy link
Member

guedou commented Jan 10, 2018 via email

@guedou
Copy link
Member

guedou commented Jan 10, 2018

@johnthagen please try pip install --pre scapy that will install the latest rc (currently rc2).

@johnthagen
Copy link
Contributor

@guedou I installed 2.4rc2 into a Python 3.6 virtual environment, played around making a couple sample packets, and everything worked! 🥇

@p-l-
Copy link
Member

p-l- commented Jan 11, 2018

@irl I've tested dhcpcanon which works fine (which is normal since it uses Scapy for Python 2 already).

@p-l-
Copy link
Member

p-l- commented Mar 27, 2018

@guedou pressed the "release" button for 2.4.0, so I guess this can be considered fixed :)

Thanks a lot to everybody involved in this great project!

@p-l- p-l- closed this as completed Mar 27, 2018
@zopieux
Copy link

zopieux commented May 5, 2018

Open-source development is a fantastic and fulfilling initiative, but comes with its share of human vices. You can't reasonably ask for everybody to play fairly and without pride. @phaethon made a great contribution to bring Python 3 support to scapy which, at the time, may have been lagging behind – however good their reasons.

If @phaethon doesn't want to collaborate with upstream, so be it. It's still his/her right to keep the GitHub repo online. Let's stay respectful of the work accomplished by everybody and gently educate users about the issue, even if that takes time.

@phaethon
Copy link

phaethon commented May 5, 2018

Thanks @zopieux for bringing a share of fairness into the discussion.
phaethon/scapy works well for many users since 2015, and I have no short term intention to delete the repo. Contributions are welcome. If there will be any critical flaw, it will get fixed.
If there are constructive suggestions for the benefit of users I am always open to discuss them.
My ages-old suggestion is to put a text explaining options of scapy implementations and existence of the fork in all appropriate places.
One maintainer of this repo even went so far as deleting valid information (information explaining existence of the fork and a link to it) from Wikipedia. That guy would be probably too ashamed to admit it in the public. And I have no intention of meaningless fight over such issues. I would be happy if somebody would put a neutral text over there, on the Readme of this repo, and I am happy to make objective additions to phaethon/scapy repo's Readme.
And, yes, if someone embarrasses users of my repo (e.g. claiming that something is fixed for 2 years, while actually it is not, or not even reading the actual issue and copy pasting their text), I keep my right to block the intimidating user.

@zopieux
Copy link

zopieux commented May 5, 2018

Well, thanks for keeping the discussion alive. Having a page explaining the state of the various forks is a good idea, as long as we play fair and use the same wording in upstream and forks. I guess the real issue is the branding: scapy3k is not scapy with 3k compatibility (because scapy now has it), it's a fork that has diverged significantly over time.

I just saw the phaethon/kamene#231 discussion about changing the module name and I appreciate the decision to implement the change. I hope the secdev people are okay with the scapy3k name.

@phaethon, would you be okay with a prominent line in your README stating this is a fork of the original scapy project with a link?
@p-l-, would you be okay with a table somewhere in the README listing the forks with links?

@phaethon
Copy link

phaethon commented May 5, 2018

@zopieux I am fully supportive on placing objective bilateral linking with information reflecting reality. Probably, we would need to agree on 'what reality is' first, but sure it is possible with a reasonable mediator in between the maintainers of both repos.

@gpotter2
Copy link
Member

gpotter2 commented Jun 6, 2018

@irl Hello ! It might be worth updating the debian issue: scapy3k is now kamene, so I'm guessing a package name like python-kamene is probably for the better, rather than python-scapy3k

@irl
Copy link
Contributor

irl commented Jun 6, 2018

I filed bugs about this a while ago, waiting on ftp master to process https://bugs.debian.org/898105. Can't really do anything until that happens.

@irl
Copy link
Contributor

irl commented Jun 6, 2018

You could always email [email protected] with words of encouragement.

@irl
Copy link
Contributor

irl commented Jun 7, 2018

python3-scapy built from secdev sources has now been uploaded. This will require manual approval from the ftp masters as this is a new binary package.

@gpotter2
Copy link
Member

gpotter2 commented Jun 8, 2018

FTR, the list of depedencies could be updated:

@pacho2
Copy link

pacho2 commented Feb 2, 2020

Is scapy-2.4.3 still relying on old pyx version (that is python2 only) for 2D graphs or documentation needs updating?
https://scapy.readthedocs.io/en/latest/installation.html

Thanks for the info :)

@gpotter2
Copy link
Member

gpotter2 commented Feb 2, 2020

@pacho2 No, Scapy will work with any PyX version. It uses it only for optional features and will work without it. PyX >= 1.13 supports Python 3 (https://github.com/pyx-project/pyx) but dropped Python 2.7.

The doc makes the distinction correctly:

Note: PyX requires version <=0.12.1 on Python 2.7. This means that on Python 2.7, it needs to be installed via pip install pyx==0.12.1. Otherwise pip install pyx

I'll however lock this issue because this is sorta unrelated, and I don't want to keep pinging so many people. Please open a different issue or ask on the gitter if you have additional questions :-)

@secdev secdev locked as resolved and limited conversation to collaborators Feb 2, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests