-
-
Notifications
You must be signed in to change notification settings - Fork 654
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
Document backwards compatibility guarantees for inclusion of modules from the standard library in binary builds. #15886
Comments
I think it would be best to document that any dependencies should be bundled by add-on authors, as dependencies in NVDA core cannot be relied on. |
I'm sorry, but 'any dependencies' is not something which should appear in any serious documentation targeting developers. |
@seanbudd, I can only strongly support everything @lukaszgo1 writes. Also cc @michaelDCurran for information and opinion. First of all, I do not know if it is official or not. But all the components of Python's standard library included in NVDA have always been considered as being a de facto part of the API: add-on authors have always been using these functions without questioning and NV Access has never warned about any limitation in this usage. The minimum of the minimum would be to announce the following (if it applies) as API breaking changes in the change log:
A more acceptable minimum would be to avoid removing such modules, except for a good reason: e.g. causing other bugs or incompatibility, technical difficulty to keep it in the bundle, etc. This recommendation more specifically applies for modules that are known to be used in existing add-ons, and even more specifically when add-on authors have done the effort to report this breakage (e.g. the case of At last, the risk identified by @lukaszgo1 are very real:
|
Ideally we would either include all of the standard python library, or document the diff between releases. We can consider including standard library submodules like |
If we would be able to create the diff between releases then there would be no need to document anything - we just should see what modules were included ,and if they no longer are forcibly bundle them.
Creating a diff between releases should be doable, but scripting it is probably pretty time consuming. It sounds like a nice challenge though.
It seems you have considered this particular case, and reached the conclusion that it should not be bundled.
We should also clarify what happens if someone reports that some module is missing. Using |
@seanbudd you write:
I am not personally impacted by the lack of But given the last arguments provided by @lukaszgo1 and the discussion in general, would you reconsider forcing the inclusion of And more generally, in the future, forcing the inclusion of missing modules upon add-on author request when this module has been embedded in previous versions of NVDA? This would allow to develop a diff script but still avoid authors to be impacted by the automatic selection of embedded modules by py2exe. Whatever your choice, it would be nice to have a final decision on this topic, especially now that we have reached beta stage. |
#15820 was closed as it was fixed in the add-on by the only add-on author which reported the issue. |
What I do not understand here is why standard library modules are treated differently to our internal API. When deprecating parts of it, we usually implement backward compatibility whenever feasible by default i.e. we do not start with the part of the API removed, and implement back compat code only when some add-on author contacts you and complains. It is clear that modules of the standard library cause their own set of challenges, since we cannot determine what has been removed automatically, however the fact that we cannot be perfect should not mean that we're not improving where we can. Since we know that at least part of the std lib was included and no longer is, it should be included on the same principles as backward compatibility with |
I am probably the one who made evolve this discussion more on the inclusion of @seanbudd, again I can only second and try to insist on @lukaszgo1 arguments:
I understand that we cannot document it completely because it's technically less easy than changing a submodule version. But we should at least guarantee a best effort. And today we are far from this. I acknowledge that some add-on authors have found a workaround to compensate for the lack of It's important for add-on authors that the management of Python standard libraries be clarified. And IMO, this should be done now that add-on author update their add-ons for 2024.1, not after this release. |
i agree with cyrille last comment. |
I agree with the concerns and comments by @lukaszgo1 and @CyrilleB79. The
current handling of this matter is quite un-ideal for add-on authors. It will
probably ultimately cause problems on the user side, if we leave this for add-on authors
to hackishly solve.
I've been trying to find a way with py2exe, to get it to dump a list of every
(sub)module it includes in a build, but I generally use pyinstaller for my
packages so I am far from skilled with py2exe internals.
|
Could diffing the library.zip possibly give us a start to determining what is included across versions? At least at a certain level of granularity? Here's a Linuxish bash scriptwhich does a reasonable job. Here's a sample of its output, for anyone who doesn't want to run it. This is far from ideal by any means, and I did not check the modules included outside library.zip, but perhaps it sparks an idea for someone. |
also ideas from other long term addon authors are welcome. |
Thanks for the mention, @Adriani90. For years, I've been considering an idea and I think this issue is the right place for sharing it. Currently, we have various add-ons which bundle the same libraries with no differences, only a few differences, and entirely or partially. This takes extra space on disk and is a source of potential bugs. Let's remember that sys.modules must be taken into account in addition to sys.path. When a library is imported, even if its path is removed afterwards, subsequent calls to import that library will make use of the first one. |
Hello all,I was thinking about this problem and I don't understand why the full standard library is not included by default, excluding some big and unused parts like TK. If NVDA is just an end-user, non-extensible tool I understand, but with extensibility in mind, this is not understandable.About external, I would prefer to leverage existing toolset for package management and python per-addon runtime, so the library author can import anything he want to import, and after the addon is unloaded the library loads goes out.I understand that just the first propose is practical as of now, but consider the next solutions at the long-term roadmap.El 16 dic 2023 07:27, José Manuel Delicado ***@***.***> escribió:
Thanks for the mention, @Adriani90. For years, I've been considering an idea and I think this issue is the right place for sharing it. Currently, we have various add-ons which bundle the same libraries with no differences, only a few differences, and entirely or partially. This takes extra space on disk and is a source of potential bugs. Let's remember that sys.modules must be taken into account in addition to sys.path. When a library is imported, even if its path is removed afterwards, subsequent calls to import that library will make use of the first one.
Given this scenario, I would go beyond the standard library. A robust dependency management system should be built for add-ons, similar to those provided by pip, npm, apt on Debian, etc.
In a first stage, a new type of add-on should be available in addition to app modules, global plugins, braille display drivers, synth drivers and vision enhancement providers: library. This would be loaded just after core, but before any other component. This would make possible for authors to install a library and import it without changing sys.path, and removes or delays the need of documenting all changes in standard library. Of course, there are multiple security drawbacks, and a bad use of this system replacing standard modules would cause unwanted behaviours, but I see a lot of advantages.
After that, add-on authors should have a mechanism (for example in add-on manifest) to specify library requirements for their add-ons.
What do you think?
CC: @hxebolax
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: ***@***.***>
|
Hi all, Short of renaming this topic to talk about Python standard library (as this is what we're focusing on at present), we need to remember that Python standard library is used by NVDA API (stable or not). We do talk about Python standard library because NVDA is mostly written in Python with C++ employed in some cases. As noted earlier, when using py2exe to bundle modules into a binary distribution, only Python standard library modules used by NVDA code base (directly or not) gets included, reducing bundle size and internet bandwidth (for some). In other words, what NV Access is focusing on (and what most add-ons focus on) is NVDA API most of the time - we teach NVDA code base when discussing add-ons, not Python standard library excpet when library modules are useful for add-ons or needed by authors. We must also remember that NVDA includes several third-party modules in addition to parts of Python standard library. The best example is wxWidgets in the form of wxPython, which may conflict with use cases of tkinter/tk. The tkinter module is included in Python to provide a graphical user interface environment for Python programs, and tkinter is not the only GUI framework employed by Python programs - PyQT, wxPython, to name a few. Also, unless things have changed, tkinter-based programs are known to ship with inaccessible GUI, which defeats the purpose of screen reader add-ons with GUI included. To address a few points:
In summary, I see our current discussion as highlighting an ongoing tension between NV Access, add-ons community, and NVDA users over the scope of NVDA itself, its API, and how Python modules figure in our discussion. My overall position is that NV Access, add-ons community, and users must remember that NVDA is, first and foremost, an accessibility information processor, not a general-purpose productivity tool. Through add-ons, we have reconfigured our relationship with a screen reader to believe that NVDA can solve all sorts of problems with help from humans (add-on developers) and machines (code run by add-ons). One may say that add-ons do help NVDA become a more sophisticated information processor with the ability to handle and present timely, relevant, and context-aware information, and that sentiment was materialized through NV Access add-on store. If you think about it carefully, add-ons are also domain specialists - it's just that our interaction with various add-ons led us to think that NVDA is a general-purpose tool when in fact we've been talking to domain experts all this time. The question of bundling add-on dependencies and documenting changes about them (including parts of Python standard library) can be summarized thus: how do we get a number of domain specialists to talk to each other, specifically what are commonalities these domain experts share i.e. needed dependencies. Thanks. |
Hi Cyrille,
As you pointed out about 3.11.7, we already have it out.
Recently I saw it published on the python website.
Thanks,
Zvonimir
…--
Ta wiadomość e-mail została sprawdzona pod kątem wirusów przez oprogramowanie antywirusowe Avast.
www.avast.com
|
Thanks all for commenting. If we want to keep this discussion focused and productive, I'd remind that this issue is about describing and documenting what can or cannot be done and expected with each version of NVDA today. For future changes on what should be included in the future, we may open a new issue, or comment in an existing one on this topic if it has already been opened. |
My two cents: as an add-on writer I would prefer that the entire standard Python library be included in NVDA distribution. I often find myself reimplementing things that are available but excluded. Examples: thread pool, Future. Both of these belong to package concurrent. |
Just for reference, last time I had to download NVDA in a quite rural area of Poland (which is probably not the worst example you can find) the current 33 MB file took 20 minutes to download, when increased by 100 MB I would have to spent an hour and a half downloading. I imagine in some parts of the world an uninterrupted internet connection may not be even available for that long. In short I'd be very careful with increasing size of the launcher by a significant amount.
Already included since NVDA 2023.1 :-) |
see also #3328 which shows that even for updates which are smaller people were expecting faster downnloading. However, at least for that part we could provide a diff binary as proposed in that issue. |
Created as a result of discussion in PR #15820. cc @CyrilleB79 @seanbudd
Is your feature request related to a problem? Please describe.
When creating binary version of NVDA, py2exe bundles only parts of Python's standard library which are used (either implicitly in NVDA, or explicitly by our dependencies / other parts of Python's standard modules). Add-on developers often rely on these modules being included, the most recent example being the fact that after migration to Python 3.11
ctypes.util
is no longer a part of the binary distribution.It is worth pointing out that if only part of the module is not included, adding it from an add-on introduces several difficulties (
ctypes.util
will be used as an example below):from ctypes.util import foo
work, it is necessary to either prepend the folder containing entirectypes
copied from the standard library to thesys.path
, or add the directory containingutil
fromctypes
to the__path__
of the bundledctypes
module. Add-on developers often get it wrong by either appending to the path (and not realizing why this does not work), or not cleaning up after themselves, therefore modifying NVDA's import pathctypes
module imported in our process it is possible NVDA may behave differently when the version bundled in a given add-on is used, and when starting with add-ons disabled, which would be painful to debugDescribe the solution you'd like
ctypes.util
should be again bundled, just because there is no reason to make life of add-on developers harderDescribe alternatives you've considered
If point 1 from the above list is not implemented, the known removals of standard library modules should be documented in the change log.
Additional context
The particular removal which triggered this issue affects at least 3 add-ons, many more has not been yet tested with Alpha versions of NVDA, so impact may be much higher. As described bundling only part of the module in add-ons is difficult, and requires more than basic knowledge of Python's import system to be done properly.
The text was updated successfully, but these errors were encountered: