Comments (8)
Could be worthwhile have both available. I'll look at what best way of doing that might be. I may want to break apart the wrappers.py file into two files.
from wrapt.
Also, this could be useful for cross-testing 2 implementations.
from wrapt.
I could issue PR on this. Of course, I understand if you want to do this yourself.
from wrapt.
Have been working on code today so can get a new release out. So am pondering how can come up with acceptable way of restructuring it.
I could move the pure Python components appearing before the C extension imports from wrappers.py
into _wrapperspy.py
with them import them into wrappers.py
from there if no C extension. It would still be regarded as internal implementation detail though and you would need to import wrapt._wrapperspy
to get the pure Python components. Just don't like the naming of the files at the moment with that option.
Another alternative is to move some of the stuff after the C extension import into a separate file called monkey.py
indicative of their use in monkey patching, and see if that results in a better way of organising things.
from wrapt.
Some thoughts.
I like the former. Doesn't break backwards compatibility. Also, creating new monkey.py
feels a bit superfluous given that file would only have couple of objects left in it.
It seems that there is only 1 class in wrappers.py
which inherits from either C or Py implementations. For consistency it might be good to have it with both inheritances as well.
In this case, could:
- Create
_wrappersc.py
and_wrapperspy.py
. - Define
WeakFunctionProxyBase
in_wrapperspy.py
- Create WeakFunctionProxy(WeakFunctionProxyBase, ObjectProxy) in both
_wrappersc.py
and_wrapperspy.py
._wrappersc.py
would importWeakFunctionProxyBase
from_wrapperspy.py
- Then do conditional import from
wrappers.py
.
This way all objects with all implementations would be possible access at the same time.
from wrapt.
I did it rather differently to satisfy my ideas of what works better. Can you try:
The pure Python ObjectProxy
is available using:
from wrapt.wrappers import ObjectProxy
from wrapt.
Fair. All seems to be working. Thanks for this.
from wrapt.
Have released 1.16.0 with this now.
from wrapt.
Related Issues (20)
- Idea: Sticky/Viral ObjectProxy HOT 3
- ObjectProxy does not play well with GenericAlias, such as isinstance(proxy, Dict) HOT 12
- RFE: is it possible to start making github releases?🤔 HOT 2
- Publish cp312 wheel HOT 6
- Release 1.14.1 Py3.11 wheels HOT 7
- __doc__ property HOT 9
- Unable to install wrapt 1.14.1 via poetry HOT 2
- Accessing ObjectProxy __dict__ HOT 5
- Update to setup.cfg potentially required HOT 4
- Documentation isn't building? HOT 6
- Best way to associate some data with `ObjectProxy`? HOT 3
- Accessing a class attribute that is a wrapt wrapped function will try and bind the function. HOT 4
- pydevd error when debugging with wrapt HOT 28
- Add type hint annotations for user-facing code HOT 2
- classmethod tests fail with Python 3.13 (Python reverted to pre-3.9 behavior) HOT 2
- 1.16.0: pytest fails
- How to use adapter factory to change signature depending on instance HOT 9
- Accessing a class attribute that is a wrapped function raises an AttributeError
- RFE: remove use `PY2` and `PY3` in the module code HOT 1
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 wrapt.