Comments (4)
PyXB wasn't designed for use in threaded applications. (Nor was it designed to operate without validation; although it turned out it was possible and useful to some people to disable validation, doing so will change the binding content in ways that may not preserve critical information).
As it turns out, though, the practical (untested) answer is yes, this can be done. Look at pyxb.ValidationConfig, which was designed to control validation behavior on a per-class (XML type/element) basis. If you modify this class to use thread-local state instead of private attributes, you can probably make this work as long as you don't create any new namespaces or change the content models while multiple threads are active.
Interesting use case. I'll consider adding thread-local state to that class in a future release, and look into what it might take to make the rest of the system thread-safe.
from pyxb.
A candidate solution is 65a3e6d. Let me know if that works for you; if so, and it survives other testing, I'll put it in the next release.
from pyxb.
On consideration, while 65a3e6d will probably do what you want, it's not really consistent with the pre-existing use of distinct configurations to control validation within the XML space, where changing a validation configuration should affect all threads. It might be possible to make the global configuration thread-local but content-specific ones global, but that could produce some really confusing/non-deterministic behavior.
This gets back to PyXB not being designed for use in a threaded environment. Retro-fitting thread safety is not trivial. At this time I think the final resolution of this issue will be "wontfix" and "don't use PyXB with multiple threads".
from pyxb.
Based on the fact you can use single-threaded execution as PyXB was designed in your commercial application, I'll just close this as "wontfix".
from pyxb.
Related Issues (20)
- Simple content with fixed value and attributes are not handled properly HOT 2
- Preserve XSD annotations in bindings HOT 1
- AnyContent not definable
- "List index out of range" using bindings built by pyxbgen HOT 1
- Invalid XML can be generated with extension elements HOT 2
- "all" allows multiple occurrences of the same term HOT 1
- NamespaceUniquenessError in elementDeclaration HOT 3
- Marshalling of restricted dateTime ignores restriction pattern HOT 3
- Install without pre-defined bundles? HOT 2
- Support of Python 3.7+ HOT 3
- Support of Python 3.8. HOT 7
- UnboundElementError when trying to subclass HOT 3
- SimpleTypeValueError when trying createfromdocument for MD_Metadata
- XInclude processing HOT 3
- creating an instance of a union does not name the actual type in the resulting exception
- Multiple accepting paths for xs:any ##other element
- validateBinding, toDOM and toxml raise AbstractElementError on unpickled pyxb object with abstract element/substitutionGroup
- Test suite does not work HOT 2
- Running setup.py install for pyxb … error
- test_gYearMonth.Test_gYearMonth.testBasic and test_date.Test_date.testArguments fails, test_gMonthDay.Test_gMonthDay.testBasic errors
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pyxb.