Trey's preferred style for writing Python code and more
EditorConfig universal issue tracker and wiki
Merged. Let's hope it passes! 🤞
Remove python 3.6
Use github for flake8
Merge pull request #39 from spapas/remove-python3.6
Remove python 3.6
I agree. 👍 Let's drop support for anything that's been EOL'd for over a year.
To re-initialize I'm posting a
run message to the web worker, which calls
Use CPython compiled for WebAssembly and then import
Or visit this page and click the "Run in Browser" button to see the error.
The error shown is:
Traceback (most recent call last): File "//__main__.py", line 2, in <module> import unittest.mock File "/home/runner/work/cpython-wasm-test/cpython-wasm-test/cpython/Lib/unittest/mock.py", line 26, in <module> File "/home/runner/work/cpython-wasm-test/cpython-wasm-test/cpython/Lib/asyncio/__init__.py", line 8, in <module> File "/home/runner/work/cpython-wasm-test/cpython-wasm-test/cpython/Lib/asyncio/base_events.py", line 18, in <module> ModuleNotFoundError: No module named 'concurrent'
This error seems to only occur on the WebAssembly build for the browser (the Node build allows
unittest.mock to be imported as expected).
unittest.mock works for me now
unittest.mock, an exception is raised due to
It seems the
asyncio library is only used in
unittest.mock when mocking async functions.
I believe delaying the import of
asyncio until the moment it's needed would make
unittest.mock functional for most use cases on WASM builds.
A demonstration of the error: https://www.pythonmorsels.com/r/35fv2/
CPython 3.11.0rc1 built with Emscripten for the web browser
Duplicate of #96883. I accidentally opened this issue twice.
The following code runs correctly the first time but then complains that
datetime.strptime is of type
NoneType the second time the code is run within the same browser session.
"""Demonstrates WASM issue with datetime.strptime.""" from datetime import datetime print(datetime.strptime("2023-01-13", "%Y-%m-%d")) print(datetime.strptime("2023-01-13", "%Y-%m-%d"))
Live example here: https://pym.dev/p/2g6wn/
Note that running
datetime.strptime twice doesn't cause an issue. The issue seems to be due to exiting Python and then re-entering it. For example in an interactive session, one would need to call
exit() and then start the interactive session again in the same browser window (example here).
>>> from datetime import datetime >>> datetime.strptime("2023", "%Y") datetime.datetime(2023, 1, 1, 0, 0) >>> exit() # The REPL is automatically re-entered after this >>> from datetime import datetime >>> datetime.strptime("2023", "%Y") Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: 'NoneType' object is not callable
CPython 3.11.0 compiled to Emscripten for the browser.
I'm using freezegun, so I'm affected by #126.
When I set
CACHALOT_ENABLED= False in my settings, my tests pass.
I'd prefer to use cachalot for most of my tests and only disable it for the tests where freezegun is used. When I use
override_settings(CACHALOT_ENABLED=False), the setting does change but the queries with the test are still cached.
override_settings decorator to disable
CACHALOT_ENABLED should have disabled caching during the decorated test.
@override_settings(CACHALOT_ENABLED=False) decorator on a test that uses
freezegun.freeze_time for a long past date. When calling the
refresh_from_db() method on a model instance, the instance will not refresh even if it has been changed.
I'm using Docker with Postgres and on Django 3.2.7.
@xuhdev @ffes I added the CNAME record. It looks like there's an SSL error now though.