instance_id
stringlengths
21
53
repo
stringclasses
188 values
language
stringclasses
1 value
pull_number
int64
20
148k
title
stringlengths
6
144
body
stringlengths
0
83.4k
created_at
stringdate
2015-09-25 03:17:17
2025-07-10 16:50:35
problem_statement
stringlengths
188
240k
hints_text
stringlengths
0
145k
resolved_issues
listlengths
1
6
base_commit
stringlengths
40
40
commit_to_review
dict
reference_review_comments
listlengths
1
62
merged_commit
stringlengths
40
40
merged_patch
stringlengths
297
9.87M
metadata
dict
pydantic__pydantic-6043@8d3d98a
pydantic/pydantic
Python
6,043
Sort produced json schemas
closes #6013 Selected Reviewer: @Kludex
2023-06-08T03:05:00Z
Produce best-effort deterministically sorted json schemas A lot of our tests, and probably user tests as well, at least via FastAPI, make assertions about the JSON schemas. It is very convenient for the order of keys and items in these schemas to be as deterministic as possible so that tests don't have to change if the...
[ { "body": "A lot of our tests, and probably user tests as well, at least via FastAPI, make assertions about the JSON schemas. It is very convenient for the order of keys and items in these schemas to be as deterministic as possible so that tests don't have to change if the schema gets shuffled because of intern...
d476599cdd956284595034d7d9fd046569a0574c
{ "head_commit": "8d3d98a23953a18d7c4d8fcf159d22b10449298e", "head_commit_message": "Sort produced json schemas", "patch_to_review": "diff --git a/pydantic/json_schema.py b/pydantic/json_schema.py\nindex 8cb4359e5a9..70335bd4d5c 100644\n--- a/pydantic/json_schema.py\n+++ b/pydantic/json_schema.py\n@@ -45,11 +45,1...
[ { "diff_hunk": "@@ -45,11 +45,12 @@\n `core_schema.CoreSchemaFieldType`.\n \"\"\"\n \n-JsonSchemaValue = Dict[str, Any]\n+JsonSchemaValue = Dict[str, Any] # type: ignore", "line": null, "original_line": 48, "original_start_line": null, "path": "pydantic/json_schema.py", "start_line": null, ...
94362414ca7c37ae68eb32bb1a374a915fc40e62
diff --git a/docs/blog/pydantic-v2-alpha.md b/docs/blog/pydantic-v2-alpha.md index e39a07421a2..5d25a64af64 100644 --- a/docs/blog/pydantic-v2-alpha.md +++ b/docs/blog/pydantic-v2-alpha.md @@ -194,7 +194,7 @@ from pydantic import TypeAdapter validator = TypeAdapter(List[int]) assert validator.validate_python(['1', '2...
{ "difficulty": "medium", "estimated_review_effort": 3, "problem_domain": "Code Refactoring / Architectural Improvement" }
pydantic__pydantic-6007@d836b72
pydantic/pydantic
Python
6,007
Allow applying serializers and constraints to named/ref schemas
Fixes https://github.com/pydantic/pydantic/issues/5998 This makes some fundamental changes to core schema and json schema building. In particular: - Any schemas with a `"ref"` or `"$ref"` we immediately stick into `"definitions"` or `"$defs"` respectively. I added a `resolve_ref_schema` method to `GetCoreSchemaHan...
2023-06-05T16:44:22Z
Field serializers clobber serialization for the field type's schema ```python from pydantic import BaseModel, field_serializer class User(BaseModel): y: str class Model(BaseModel): user1: User user2: User @field_serializer('user1') def serialize_user1(self, v: User): retur...
[ { "body": "```python\r\nfrom pydantic import BaseModel, field_serializer\r\n\r\n\r\nclass User(BaseModel):\r\n y: str\r\n\r\n\r\nclass Model(BaseModel):\r\n user1: User\r\n user2: User\r\n\r\n @field_serializer('user1')\r\n def serialize_user1(self, v: User):\r\n return f'User1({v.y})'\r\n...
f93966dd035ce2e8aa0e6a6d461d51c7f9a58383
{ "head_commit": "d836b720995f25a1a385b098de2a021421b28a07", "head_commit_message": "Address feedback by adding docstrings and moving class to end of file", "patch_to_review": "diff --git a/docs/usage/json_schema.md b/docs/usage/json_schema.md\nindex 0014aeecb68..7536e0622f0 100644\n--- a/docs/usage/json_schema.m...
[ { "diff_hunk": "@@ -1504,3 +1477,50 @@ def _common_field(\n 'frozen': frozen,\n 'metadata': metadata,\n }\n+\n+\n+class _Definitions:\n+ \"\"\"Keeps track of references and definitions\"\"\"\n+\n+ def __init__(self) -> None:\n+ self.seen: set[str] = set()\n+ self.definiti...
8cc5342213a6e07c515fd66d37f2308354224d9e
diff --git a/docs/usage/json_schema.md b/docs/usage/json_schema.md index 0014aeecb68..7536e0622f0 100644 --- a/docs/usage/json_schema.md +++ b/docs/usage/json_schema.md @@ -774,6 +774,7 @@ class Person(BaseModel): cls, core_schema: CoreSchema, handler: GetJsonSchemaHandler ) -> JsonSchemaValue: j...
{ "difficulty": "medium", "estimated_review_effort": 4, "problem_domain": "Bug Fixes" }
pydantic__pydantic-6180@37af552
pydantic/pydantic
Python
6,180
💥 Use custom `PydanticDeprecationWarning` warning instead of the generic one
## Change Summary Implement custom `PydanticDeprecationWarning`. - Provides a single class to ignore or test for. - Provides info on Pydantic version the deprecation was introduced in. - Provides a link to the V2 migration guide for things deprecated in v2.0. ## Related issue number Fixes #5571 ## Check...
2023-06-19T09:34:45Z
Add migration documentation for filterwarnings/DeprecationWarning ### Initial Checks - [X] I confirm that I'm using Pydantic V2 installed directly from the `main` branch, or equivalent ### Description Having a list of all DeprecationWarning to use in pyproject/[tool.pytest.ini_options]/filterwarnings would allow tak...
PR welcome if it's not too intrusive; would be best if there was a way to add a test for this that ensured we kept using it. One possible thorn is that pycharm will show deprecation warning info in the hover popups _only_ if the first line of the deprecated function emits the warning with a string literal as the rea...
[ { "body": "### Initial Checks\n\n- [X] I confirm that I'm using Pydantic V2 installed directly from the `main` branch, or equivalent\n\n### Description\n\nHaving a list of all DeprecationWarning to use in pyproject/[tool.pytest.ini_options]/filterwarnings would allow taking care of things which actually break t...
add972469cf457b69d6f25e7958b5b01bf58b63f
{ "head_commit": "37af552d5bc7f2a34f71b01125a705289eff856a", "head_commit_message": "🚑 Implement workaround for PyCharm unable displaying DeprecationWarning subclasses", "patch_to_review": "diff --git a/pydantic/__init__.py b/pydantic/__init__.py\nindex b71d47159cf..e18a78a62b1 100644\n--- a/pydantic/__init__.py...
[ { "diff_hunk": "@@ -8,6 +8,11 @@\n \n from ..config import ConfigDict, ExtraValues, JsonSchemaExtraCallable\n from ..errors import PydanticUserError\n+from ..warnings import PydanticDeprecatedSince20\n+\n+if not TYPE_CHECKING:\n+ # See PyCharm issues PY-21915 and PY-51428\n+ DeprecationWarning = PydanticD...
b15401e33327b89a81da586fdf165f3b305fed4e
diff --git a/pydantic/__init__.py b/pydantic/__init__.py index b71d47159cf..e18a78a62b1 100644 --- a/pydantic/__init__.py +++ b/pydantic/__init__.py @@ -42,6 +42,7 @@ from .types import * from .validate_call import validate_call from .version import VERSION +from .warnings import * __version__ = VERSION @@ -183...
{ "difficulty": "medium", "estimated_review_effort": 3, "problem_domain": "Documentation Updates" }
pyodide__pyodide-3925@0caed95
pyodide/pyodide
Python
3,925
Make PyProxy of a callable an instanceof Function
Resolves #3924. Make a copy of the PyProxy class which is a subclass of Function. Since the difference between `PyProxy` and `PyProxyFunction` is an implementation detail, we use `[Symbol.hasInstance]` to make them recognize the same set of objects as their instances. E.g., ```js const pyFunc = pyodide.runPython(`...
2023-06-12T19:11:44Z
Python Callables are not instanceof Function ## 🐛 Bug Using the `instanceof` operator on PyProxy's of Python Functions (or other Callables) returns False. ### To Reproduce All of the following result in `false`: ```js const pyFunc_0 = pyodide.runPython(` lambda: print("zero") `); const pyFunc_1 =...
Thanks for another great bug report @JeffersGlass!
[ { "body": "## 🐛 Bug\r\n\r\nUsing the `instanceof` operator on PyProxy's of Python Functions (or other Callables) returns False.\r\n\r\n### To Reproduce\r\n\r\nAll of the following result in `false`:\r\n\r\n```js\r\nconst pyFunc_0 = pyodide.runPython(`\r\n lambda: print(\"zero\")\r\n`);\r\n\r\nconst pyFunc_1...
005535b49296a349479ea526cf85cb83719a2ecd
{ "head_commit": "0caed957770a8d93bdfafb1538a7f6c4a6c0709f", "head_commit_message": "[pre-commit.ci] auto fixes from pre-commit.com hooks\n\nfor more information, see https://pre-commit.ci", "patch_to_review": "diff --git a/src/core/pyproxy.ts b/src/core/pyproxy.ts\nindex 00e53eb81b0..7b634f6ca9e 100644\n--- a/sr...
[ { "diff_hunk": "@@ -2096,3 +2096,63 @@ def test_pyproxy_of_list_fill(selenium, func):\n assert func(a) is a\n func(ajs)\n assert a == ajs.to_py()\n+\n+\n+def test_pyproxy_instanceof_function(selenium):\n+ selenium.run_js(\n+ \"\"\"\n+ const pyFunc_0 = pyodide.runPython(`\n+ ...
fd23755782809b8321cbceb1f07d2c7aae1574e2
diff --git a/docs/project/changelog.md b/docs/project/changelog.md index a3f224ac620..966baec80c9 100644 --- a/docs/project/changelog.md +++ b/docs/project/changelog.md @@ -53,6 +53,12 @@ myst: `{env: {HOME: whatever_directory}}`. {pr}`3870` +- {{ Fix }} A `PyProxy` of a callable is now an `instanceof Function`...
{ "difficulty": "medium", "estimated_review_effort": 3, "problem_domain": "Bug Fixes" }
pypa__pip-13251@64b34b4
pypa/pip
Python
13,251
doc: Explain how to query values for --platform and --python-version
Fixes https://github.com/pypa/pip/issues/6369
2025-03-01T12:22:06Z
Better documentation on using --platform and --python-version **What's the problem this feature will solve?** I want to use pip to download linux packages onto a mac. I know that I need to use some combination of `--platform`, `--python-version`, `--only-binary=:all:`. but I don't know the proper values for these o...
> or the package documentation on pypi to be clear for each package what values were used for these options. Have you tried looking at the downloadable files page for each package? e.g. https://pypi.org/project/pandas/#files Does that help you more? I was just digging through the source code as you made this commen...
[ { "body": "**What's the problem this feature will solve?**\r\nI want to use pip to download linux packages onto a mac.\r\n\r\nI know that I need to use some combination of `--platform`, `--python-version`, `--only-binary=:all:`. but I don't know the proper values for these options.\r\n\r\n\r\n**Describe the sol...
354e9d46c7624f0b41074a6d43b4840d8a7e2111
{ "head_commit": "64b34b4d546413b7ae0aadb88e270cca5acb630c", "head_commit_message": "fix: changed command sysconfig.get_platform() by packaging.tags.sys_tags()", "patch_to_review": "diff --git a/docs/html/cli/pip_download.rst b/docs/html/cli/pip_download.rst\nindex d247c51ccfb..03117136997 100644\n--- a/docs/html...
[ { "diff_hunk": "@@ -47,7 +47,16 @@ constrained download requirement. If some of your dependencies are not\n available as binaries, you can build them manually for your target platform\n and let pip download know where to find them using ``--find-links``.\n \n+.. note::\n \n+ To determine the appropriate value...
dfd685a6832bd2e5382de025959fff323093ff3b
diff --git a/docs/html/cli/pip_download.rst b/docs/html/cli/pip_download.rst index d247c51ccfb..52fa2c651da 100644 --- a/docs/html/cli/pip_download.rst +++ b/docs/html/cli/pip_download.rst @@ -47,7 +47,12 @@ constrained download requirement. If some of your dependencies are not available as binaries, you can build the...
{ "difficulty": "low", "estimated_review_effort": 1, "problem_domain": "Documentation Updates" }
pyodide__pyodide-3824@dd171ee
pyodide/pyodide
Python
3,824
Change the name of repodata.json to pyodide-lock.json
Resolves #3788 - [x] Add a [CHANGELOG](https://github.com/pyodide/pyodide/blob/main/docs/project/changelog.md) entry
2023-05-03T05:17:23Z
Change `repodata.json` name to something else? I am told by conda people that repodata.json is supposed to be the input to a solver. Our repodata.json is a lock file which is the output of a solver. This is a misleading name clash. We will need to spend a lot of time explaining to conda people that this file isn't what...
@katietz In the default mode, I would say it's still the input to a solver, it's just that given that Pyodide is a distribution ( with a single version for each package) dependency resolution is trivial. In terms of contents, it's taking `meta.yaml` and copying them to this file, so same as conda as far as I understan...
[ { "body": "I am told by conda people that repodata.json is supposed to be the input to a solver. Our repodata.json is a lock file which is the output of a solver. This is a misleading name clash. We will need to spend a lot of time explaining to conda people that this file isn't what they expect to be. Can we r...
9d8ed8e3b8b09a36b2291d8e26768e877603cf24
{ "head_commit": "dd171ee751dcc5a6765307042a67ee13006d5842", "head_commit_message": "Change the name of repodata.json to pyodide-lock.json", "patch_to_review": "diff --git a/Makefile b/Makefile\nindex a16097803c6..d4c4229f6c2 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -15,7 +15,7 @@ all: check \\\n \tdist/package...
[ { "diff_hunk": "@@ -17,28 +17,28 @@ import { makeWarnOnce } from \"./util\";\n \n /**\n * Initialize the packages index. This is called as early as possible in\n- * loadPyodide so that fetching repodata.json can occur in parallel with other\n+ * loadPyodide so that fetching pyodide-lock.json can occur in paral...
b20591ae5655d25a20a2792bbed582c12454bced
diff --git a/.circleci/config.yml b/.circleci/config.yml index 6cdadf206ce..7f7d5cc0d15 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -102,7 +102,7 @@ jobs: name: Zip build directory command: | tar cjf pyodide.tar.gz dist - tar cjf pyodide-core.tar.gz dist...
{ "difficulty": "low", "estimated_review_effort": 2, "problem_domain": "New Feature Additions" }
pydantic__pydantic-5891@bfd194f
pydantic/pydantic
Python
5,891
Use `__pydantic_private__` for storing private attributes
Closes https://github.com/pydantic/pydantic/issues/3523 Requires https://github.com/pydantic/pydantic-core/pull/640. The only weird thing remaining is that the private attributes are no longer member descriptors. I don't know how much that matters.. But the test of `__set_name__` functionality didn't require modi...
2023-05-26T18:32:46Z
Layout conflict in ModelMetaclass when mixing in two models with private variables. # Bug Disclaimer: I have checked out stackoverflow, issue tracker, docs, google etc. for resources on this, but didnt found any solution. Output of `python -c "import pydantic.utils; print(pydantic.utils.version_info())"`: ``` ...
Okay, some update. It seems like problem with `__slots__` and multiple inheritance. Pydantic's documentation states directly, that creating a private attribute will also create a `__slots__` entry: > [Upon class creation pydantic constructs __slots__ filled with private attributes.](https://pydantic-docs.helpmanual....
[ { "body": "# Bug\r\nDisclaimer: I have checked out stackoverflow, issue tracker, docs, google etc. for resources on this, but didnt found any solution. \r\n\r\nOutput of `python -c \"import pydantic.utils; print(pydantic.utils.version_info())\"`:\r\n```\r\n pydantic version: 1.8.2\r\n pyd...
0024e9956862ffc7dc5b4993bd290ac9f4d8de51
{ "head_commit": "bfd194f89e9721de9fbf769f8958fe11acd172ba", "head_commit_message": "Use __pydantic_private__ for storing private attributes", "patch_to_review": "diff --git a/pydantic/_internal/_model_construction.py b/pydantic/_internal/_model_construction.py\nindex 5111bf2daf3..72a31908b8e 100644\n--- a/pydant...
[ { "diff_hunk": "@@ -245,17 +241,21 @@ class ParentBModel(GrandParentModel):\n class Model(ParentAModel, ParentBModel):\n _baz = PrivateAttr(default)\n \n- assert GrandParentModel.__slots__ == {'_foo'}\n- assert ParentBModel.__slots__ == {'_bar'}\n- assert Model.__slots__ == {'_baz'}\n- i...
ce5738f50e17142cbc87a39f8ae67f4e8d038db5
diff --git a/pdm.lock b/pdm.lock index d000e2b39bc..edc478488c5 100644 --- a/pdm.lock +++ b/pdm.lock @@ -440,7 +440,7 @@ dependencies = [ [[package]] name = "pydantic-core" -version = "0.35.0" +version = "0.36.0" requires_python = ">=3.7" summary = "" dependencies = [ @@ -662,9 +662,8 @@ summary = "Backport of p...
{ "difficulty": "medium", "estimated_review_effort": 4, "problem_domain": "Bug Fixes" }
pydantic__pydantic-5859@bb2ac39
pydantic/pydantic
Python
5,859
Add a test demonstrating initvar works with inheritance
Closes https://github.com/pydantic/pydantic/issues/5496. ~It seems that at some point since the 2.0a4 release, this got fixed, but I've added a test written from the code in the issue. (This test fails in 2.0a4.)~ This got fixed for python 3.11 after #5760, but not for other python versions.. Selected Reviewer: ...
2023-05-24T22:54:41Z
V2 pydantic dataclass: InitVar and inheritance don't work together ### Initial Checks - [X] I confirm that I'm using Pydantic V2 installed directly from the `main` branch, or equivalent ### Description When using `from __future__ import annotations` the code example raises the following error: ``pydantic.errors.Pyd...
Thanks for reporting, confirmed. I get a slightly different error `Forward references must evaluate to types. Got dataclasses.InitVar[int].`, but that might be cause I'm on 3.10. Still definitely needs to be fixed. I did some investigation into this, and part of the problem is that dataclasses doesn't expose via ...
[ { "body": "### Initial Checks\n\n- [X] I confirm that I'm using Pydantic V2 installed directly from the `main` branch, or equivalent\n\n### Description\n\nWhen using `from __future__ import annotations` the code example raises the following error:\r\n``pydantic.errors.PydanticSchemaGenerationError: Unable to ge...
290ed647f2ec6d817f91ed47f4702a522cb05294
{ "head_commit": "bb2ac393c3d02022e4364d27817077f8dfbf5c74", "head_commit_message": "Demonstrate that the init var type is used despite coming from a forward ref", "patch_to_review": "diff --git a/pydantic/dataclasses.py b/pydantic/dataclasses.py\nindex b35758ad31c..88317a0ec88 100644\n--- a/pydantic/dataclasses....
[ { "diff_hunk": "@@ -211,3 +211,8 @@ def create_dataclass(cls: type[Any]) -> type[PydanticDataclass]:\n \n \n __getattr__ = getattr_migration(__name__)\n+\n+if (3, 8) <= sys.version_info < (3, 11):\n+ # Monkeypatch dataclasses.InitVar so that typing doesn't error if it occurs as a type when evaluating type hi...
a1615bfc1ec1d3954f02523b76dc06a0183b020d
diff --git a/pydantic/dataclasses.py b/pydantic/dataclasses.py index b35758ad31c..bb5fb17720e 100644 --- a/pydantic/dataclasses.py +++ b/pydantic/dataclasses.py @@ -6,7 +6,7 @@ import dataclasses import sys import types -from typing import TYPE_CHECKING, Any, Callable, Generic, TypeVar, overload +from typing import ...
{ "difficulty": "medium", "estimated_review_effort": 2, "problem_domain": "Bug Fixes" }
pyodide__pyodide-2769@d3d1767
pyodide/pyodide
Python
2,769
Add noop "bind" function to PyProxyCallableMethods
<!-- Thank you for contributing to Pyodide! All improvements are welcome, so don't be afraid to make a PR. --> ### Description <!-- Please explain what your PR is about: - reasoning for the change - some details of updated code - any noteworthy choices to be aware of Please refer to any ...
2022-06-23T01:20:31Z
Add "bind" to function PyProxy ## 🚀 Feature <!-- A clear and concise description of the feature proposal --> Some libraries like Vue are calling "bind" on functions, to attempt to bind a javascript `this` to the function. Currently, there is no corresponding function in the PyProxy of functions and it is raising...
Sounds reasonable to me. It would be possible to hook `bind(x)` to `f.__get__(x)` but it is not clear whether that makes any sense. I don't know enough about the internals of PyProxy to suggest a solution. I think that having `bind` be a no-op makes the most sense. In JavaScript if you have a function: ```js function...
[ { "body": "## 🚀 Feature\r\n\r\n<!-- A clear and concise description of the feature proposal -->\r\n\r\nSome libraries like Vue are calling \"bind\" on functions, to attempt to bind a javascript `this` to the function. Currently, there is no corresponding function in the PyProxy of functions and it is raising a...
f5925944a21dad413e0a3376fda82896b11e35b2
{ "head_commit": "d3d17673db1424912493247bc328d719e87117c4", "head_commit_message": "Add compare bind return to test_pyproxy_call", "patch_to_review": "diff --git a/src/core/pyproxy.ts b/src/core/pyproxy.ts\nindex 1c304a390c8..ddfc6603918 100644\n--- a/src/core/pyproxy.ts\n+++ b/src/core/pyproxy.ts\n@@ -1140,6 +1...
[ { "diff_hunk": "@@ -888,6 +888,9 @@ def assert_call(s, val):\n with pytest.raises(selenium.JavascriptException, match=msg):\n selenium.run_js(\"f.callKwargs(76, {x : 6})\")\n \n+ assert_call(\"f.bind({})()\", [2, 3])\n+ assert_call(\"f.bind({}).$$ == f.$$\", True)", "line": null, "orig...
ef0b2501825307a99f5c75081056fea8bd198ebf
diff --git a/src/core/pyproxy.ts b/src/core/pyproxy.ts index 1c304a390c8..ddfc6603918 100644 --- a/src/core/pyproxy.ts +++ b/src/core/pyproxy.ts @@ -1140,6 +1140,13 @@ export class PyProxyCallableMethods { } return Module.callPyObjectKwargs(_getPtr(this), ...jsargs); } + + /** + * No-op bind function fo...
{ "difficulty": "low", "estimated_review_effort": 2, "problem_domain": "New Feature Additions" }
pyodide__pyodide-3592@aea09a8
pyodide/pyodide
Python
3,592
Add url parameter to install_xbuildenv
### Description Resolve #3567 Adds url paramter to `install_xbuildenv`, which helps installing xbuildenv from arbitrary URL. This is mostly for developers / maintainers who want to test tot xbuildenv. This PR also adds a private CLI entrypoint `pyodide xbuildenv install`. ### Checklists - [x] Add / upda...
2023-02-17T00:51:58Z
Option to install arbitrary version of xbuildenv for debug purpose When testing out-of-tree builds with tot pyodide-build, it is sometimes annoying to create a cross-build environment. So I think it would be nice to have the option to install an arbitrary version of cross-build env, such as: ``` pyodide install-...
[ { "body": "When testing out-of-tree builds with tot pyodide-build, it is sometimes annoying to create a cross-build environment.\r\n\r\nSo I think it would be nice to have the option to install an arbitrary version of cross-build env, such as:\r\n\r\n```\r\npyodide install-xbuildenv --version x.x.x\r\n```\r\n\r...
0d5bd851fe969c4ab62dd75384c255ac9ca35e5f
{ "head_commit": "aea09a8f203575d3d4a6ce5e5cf1de9858214f6f", "head_commit_message": "Revert changes in initialize_pyodide_root", "patch_to_review": "diff --git a/pyodide-build/pyodide_build/cli/xbuildenv.py b/pyodide-build/pyodide_build/cli/xbuildenv.py\nnew file mode 100644\nindex 00000000000..36e7ccaa725\n--- /...
[ { "diff_hunk": "@@ -328,3 +335,24 @@ def test_create_zipfile_compile(temp_python_lib, tmp_path):\n with ZipFile(output) as zf:\n assert \"module1.pyc\" in zf.namelist()\n assert \"module2.pyc\" in zf.namelist()\n+\n+\n+def test_xbuildenv_install(tmp_path):\n+ envpath = Path(tmp_path) / \"...
e0109f86e51fd821855f926f6057314c19bd949b
diff --git a/pyodide-build/pyodide_build/cli/xbuildenv.py b/pyodide-build/pyodide_build/cli/xbuildenv.py new file mode 100644 index 00000000000..36e7ccaa725 --- /dev/null +++ b/pyodide-build/pyodide_build/cli/xbuildenv.py @@ -0,0 +1,32 @@ +from pathlib import Path + +import typer + +from ..install_xbuildenv import inst...
{ "difficulty": "medium", "estimated_review_effort": 3, "problem_domain": "New Feature Additions" }
pyodide__pyodide-2484@9168933
pyodide/pyodide
Python
2,484
Fix large integer conversions
This resolves #2482. I added hypothesis test coverage but it never looks at integers as large as 2^63 even after many many trials so it doesn't find the bug. ### Checklists - [x] Add a [CHANGELOG](https://github.com/pyodide/pyodide/blob/main/docs/project/changelog.md) entry - [x] Add / update tests
2022-05-04T14:02:58Z
Power operator incorrect result ## 🐛 Bug I have an incorrect result when using the power operator ** with some values ### To Reproduce ```print(5 ** 55)``` result : -62726610764649328357466690409063133331 ### Expected behavior ```print(5 ** 55)``` result : 277555756156289135105907917022705078125 ##...
Thanks for the report. It's interesting that we didn't catch this for a long time. ~I am getting the correct results from Python 3.11 alpha 6 REPL of @tiran's (https://cheimes.fedorapeople.org/python-wasm/)~ ~@tiran Do you have any tips on this issue?~ Edit: Oh, sorry, never mind. It looks like it's our consol...
[ { "body": "## 🐛 Bug\r\n\r\nI have an incorrect result when using the power operator ** with some values\r\n\r\n### To Reproduce\r\n\r\n```print(5 ** 55)```\r\nresult : -62726610764649328357466690409063133331\r\n\r\n### Expected behavior\r\n\r\n```print(5 ** 55)```\r\nresult : 2775557561562891351059079170227050...
410c875e048b67af62c0a75d6c0d6326c485af8a
{ "head_commit": "9168933eed78dfd72eb066fb5a12dd1c1fcacb62", "head_commit_message": "Update changelog", "patch_to_review": "diff --git a/Makefile.envs b/Makefile.envs\nindex 85c91449468..0afd23a1ad8 100644\n--- a/Makefile.envs\n+++ b/Makefile.envs\n@@ -52,7 +52,7 @@ export DBG_LDFLAGS_SOURCEMAPDEBUG=-gseparate-dw...
[ { "diff_hunk": "@@ -52,7 +52,7 @@ export DBG_LDFLAGS_SOURCEMAPDEBUG=-gseparate-dwarf\n export DBGFLAGS=$(DBGFLAGS_NODEBUG)\n \n # Include debug symbols but no source maps (most useful)\n-#export DBGFLAGS=$(DBGFLAGS_WASMDEBUG)\n+export DBGFLAGS=$(DBGFLAGS_WASMDEBUG)", "line": null, "original_line": 55, ...
5a4b71f091ba745993c92f2b2e5c7d519a8403b0
diff --git a/.circleci/config.yml b/.circleci/config.yml index 7f2be753823..1bfaa40af0e 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -182,7 +182,7 @@ jobs: tools/pytest_wrapper.py \ --junitxml=test-results/junit.xml \ --verbose \ - --durations 1...
{ "difficulty": "medium", "estimated_review_effort": 4, "problem_domain": "Bug Fixes" }
pyodide__pyodide-2767@1bccf61
pyodide/pyodide
Python
2,767
ENH Add micropip support for loading wheels from emfs
Resolves #2731. ### Checklists - [x] Add a [CHANGELOG](https://github.com/pyodide/pyodide/blob/main/docs/project/changelog.md) entry - [x] Add / update tests - [x] Add new / update outdated documentation
2022-06-22T18:51:11Z
Micropip should be able to install wheels from the file system ## 🚀 Feature Micropip should be able to install a wheel which is in the emscripten file system from a path. ### Motivation In node (and some day maybe in chrome), we can mount the local file system into the Emscripten file system. It would be usef...
Posting here for visibility. The latest JupyterLite release adds support for accessing files from the Python (Pyodide-based) kernel: - https://github.com/jupyterlite/jupyterlite/releases/tag/v0.1.0b9 - https://github.com/jupyterlite/jupyterlite/pull/655 While the mounting logic is a bit specific to JupyterLi...
[ { "body": "## 🚀 Feature\r\n\r\nMicropip should be able to install a wheel which is in the emscripten file system from a path.\r\n\r\n### Motivation\r\n\r\nIn node (and some day maybe in chrome), we can mount the local file system into the Emscripten file system. It would be useful to install these, for instanc...
8bfce929862e3600961459ec7a787e2116fb2ca3
{ "head_commit": "1bccf61429579b1e240a072375b9865956029f83", "head_commit_message": "Update docs", "patch_to_review": "diff --git a/docs/project/changelog.md b/docs/project/changelog.md\nindex 55bd718803b..87c60e6748b 100644\n--- a/docs/project/changelog.md\n+++ b/docs/project/changelog.md\n@@ -16,6 +16,11 @@ sub...
[ { "diff_hunk": "@@ -412,42 +422,53 @@ async def install(\n A requirement or list of requirements to install. Each requirement is a\n string, which should be either a package name or URL to a wheel:\n \n- - If the requirement ends in ``.whl`` it will be interpreted as a URL.\n- Th...
9493da810e5973e7966bfb19d86db63d113717d5
diff --git a/docs/project/changelog.md b/docs/project/changelog.md index 271ac11e457..69b6b50cf52 100644 --- a/docs/project/changelog.md +++ b/docs/project/changelog.md @@ -17,6 +17,10 @@ substitutions: - {{ Fix }} `micropip` supports extra markers in packages correctly now. {pr}`2584` +- {{ Enhancement }} `micro...
{ "difficulty": "medium", "estimated_review_effort": 4, "problem_domain": "New Feature Additions" }
pyodide__pyodide-3268@cd790d3
pyodide/pyodide
Python
3,268
Implement more detailed streams support
This adds a carefully designed API for controlling stdin, stdout, and stderr. It changes the default behavior to be a bit more useful, though in doing so introduces some mild backwards incompatibility. In particular: 1. By default, stdin reads directly from `process.stdin` in node (as before) and raises an error if ...
2022-11-18T01:39:37Z
Stdout not ending in newline doesn't trigger stdout callback until newline is printed ## 🐛 Bug When the Python code prints to stdout some text not ending with a new line, the stdout callback configured in loadPyodide() isn't called. ### To Reproduce ```js let py = await loadPyodide({ stdout: (data) ...
Thanks for the report! The reason is that the default `stdout` and `stderr` is `console.log` and `console.warn` and these cannot print partial lines. So the emscripten helper functionality for this is written with the assumption that the streams will similarly only want complete lines. Another issue that comes up is...
[ { "body": "## 🐛 Bug\r\n\r\nWhen the Python code prints to stdout some text not ending with a new line, the stdout callback configured in loadPyodide() isn't called.\r\n\r\n### To Reproduce\r\n\r\n```js\r\nlet py = await loadPyodide({\r\n stdout: (data) => {\r\n console.log(`Got stdout data: $...
d802fb3fdc4deda6c27071935cbd10011c425b1f
{ "head_commit": "cd790d30c3617c2bd76266430647871ed0368723", "head_commit_message": "Update changelog", "patch_to_review": "diff --git a/docs/project/changelog.md b/docs/project/changelog.md\nindex 30ca898a8d5..bb5573b4c20 100644\n--- a/docs/project/changelog.md\n+++ b/docs/project/changelog.md\n@@ -98,6 +98,13 @...
[ { "diff_hunk": "@@ -0,0 +1,385 @@\n+import { IN_NODE } from \"./compat.js\";\n+import type { Module } from \"./module\";\n+\n+declare var API: any;\n+declare var Module: Module;\n+\n+declare var FS: typeof Module.FS;\n+declare var TTY: any;\n+\n+// The type of the function we need to produce to read from stdin\...
5f8cef4f5d62031cb24b2d1d618ed15010760eb2
diff --git a/docs/index.rst b/docs/index.rst index dfb991b8379..e28b53b16f0 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -47,6 +47,7 @@ Using Pyodide usage/type-conversions.md usage/wasm-constraints.md usage/keyboard-interrupts.md + usage/streams.md usage/api-reference.md usage/faq.md dif...
{ "difficulty": "medium", "estimated_review_effort": 4, "problem_domain": "Bug Fixes" }
pyodide__pyodide-2396@8882c56
pyodide/pyodide
Python
2,396
Fix type declarations
Hopefully resolves #2395.
2022-04-14T00:13:42Z
In pyodide 0.20.0, pyodide.d.ts only exports `loadPyodide` With pyodide 0.19.0 (installed from the release tarball), the pyodide.d.ts file exported many types, including `PyProxy`, `PyProxyCallable`, and `loadPyodide`. As of 0.20.0, that file only exports `loadPyodide`. Is that intentional? Some of those types were use...
Thanks for the report! No it's not intentional. We want to be exporting those other types. We can include them again in 0.20.1. We don't want the other files like api.d.ts, everything should be in the one file pyodide.d.ts The problem is we don't really know how to use typescript. In `pyodide.ts` we say `export { ....
[ { "body": "With pyodide 0.19.0 (installed from the release tarball), the pyodide.d.ts file exported many types, including `PyProxy`, `PyProxyCallable`, and `loadPyodide`. As of 0.20.0, that file only exports `loadPyodide`. Is that intentional? Some of those types were useful for some TypeScript code I've been w...
1c14950b1a90c323a87fa75a69d9a940ebdd23df
{ "head_commit": "8882c56c68c60da1afb8c21cac6841a6ccbaaa41", "head_commit_message": "Fix type declarations", "patch_to_review": "diff --git a/Makefile b/Makefile\nindex b4c27666577..31b832fd318 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -79,6 +79,9 @@ node_modules/.installed : src/js/package.json src/js/package-l...
[ { "diff_hunk": "@@ -1,6 +1,6 @@\n {\n \"name\": \"pyodide\",\n- \"version\": \"0.20.0\",\n+ \"version\": \"0.20.0-dev.0\",", "line": null, "original_line": 3, "original_start_line": null, "path": "src/js/package.json", "start_line": null, "text": "@user1:\n```suggestion\r\n \"versio...
2bcc22821bf8e90af30162bc18c189909e760389
diff --git a/Makefile b/Makefile index b4c27666577..97587a3a29c 100644 --- a/Makefile +++ b/Makefile @@ -79,6 +79,9 @@ node_modules/.installed : src/js/package.json src/js/package-lock.json dist/pyodide.js: src/js/*.ts src/js/pyproxy.gen.ts src/js/error_handling.gen.ts node_modules/.installed npx rollup -c src/js/ro...
{ "difficulty": "medium", "estimated_review_effort": 3, "problem_domain": "Dependency Updates & Env Compatibility" }
pyodide__pyodide-2414@baf6c1f
pyodide/pyodide
Python
2,414
Fix micropip package name resolution
### Description Hopefully resolve #2408 ### Checklists - [x] Add a [CHANGELOG](https://github.com/pyodide/pyodide/blob/main/docs/project/changelog.md) entry - [x] Add / update tests
2022-04-21T00:44:15Z
micropip does not resolve locally available versions I have three wheels: * travertino is v0.1.3 * toga-core is v0.3.0.dev33, and declares travertino>=0.1.3 as a requirement * toga-web is v0.3.0.dev33, and declares toga-core==0.3.0.dev33 as a requirement All three exist as `.whl` files in my static files folde...
Thanks for the report. Yes I can confirm that this a bug and splitting the install should work. The reason of this bug is that micropip is handling the package name differently when it is installed from PyPI or from `.whl` url. ```python >>> import micropip >>> await micropip.install("toga-web==0.3.0.dev32") >...
[ { "body": "I have three wheels:\r\n\r\n* travertino is v0.1.3\r\n* toga-core is v0.3.0.dev33, and declares travertino>=0.1.3 as a requirement\r\n* toga-web is v0.3.0.dev33, and declares toga-core==0.3.0.dev33 as a requirement\r\n\r\nAll three exist as `.whl` files in my static files folder. Travertino 0.1.3 has...
07724919d089e4eef45e15c098efabdaa9e77761
{ "head_commit": "baf6c1f37f4ec4fda5ca8b638513dc6f75bc8514", "head_commit_message": "Update changelog", "patch_to_review": "diff --git a/docs/project/changelog.md b/docs/project/changelog.md\nindex 0f94b332707..dded3ab9070 100644\n--- a/docs/project/changelog.md\n+++ b/docs/project/changelog.md\n@@ -14,6 +14,9 @@...
[ { "diff_hunk": "@@ -337,6 +337,20 @@ async def add_wheel(self, name, wheel, version, extras, ctx, transaction):\n for recurs_req in dist.requires(extras):\n await self.add_requirement(recurs_req, ctx, transaction)\n \n+ # We have to recheck that duplicated packages are not added,\n+ ...
795459656753ede7c78c9a9eef6c201fb1c51931
diff --git a/docs/project/changelog.md b/docs/project/changelog.md index bbcd9d15355..779ea85bd2b 100644 --- a/docs/project/changelog.md +++ b/docs/project/changelog.md @@ -14,6 +14,9 @@ substitutions: ## Unreleased +- {{ Fix }} micropip now correctly handles package names that include dashes + {pr}`2414` + - {{...
{ "difficulty": "medium", "estimated_review_effort": 3, "problem_domain": "Bug Fixes" }
pydantic__pydantic-5697@e647bbc
pydantic/pydantic
Python
5,697
Add `UrlConstraints.__hash__`
<!-- Thank you for your contribution! --> <!-- Unless your change is trivial, please create an issue to discuss the change before creating a PR --> <!-- We're currently in the process of rewriting pydantic in preparation for V2, see https://docs.pydantic.dev/blog/pydantic-v2/. --> <!-- **Note:** if you're making a p...
2023-05-05T15:07:57Z
`Optional[HTTPUrl]` raises `TypeError` on declaration due to unhashable type `UrlConstraints` ### Initial Checks - [X] I confirm that I'm using Pydantic V2 installed directly from the `main` branch, or equivalent ### Description When using a field that is a union of `None` and `HTTPUrl`, they Python typing module th...
Thanks @madkinsz for reporting. I can confirm the problem. it can be fixed by adding a `def __hash__(self) -> int:` to `UrlConstraints`. Would you like to prepare a patch? @hramezani sure I'll give it a shot!
[ { "body": "### Initial Checks\n\n- [X] I confirm that I'm using Pydantic V2 installed directly from the `main` branch, or equivalent\n\n### Description\n\nWhen using a field that is a union of `None` and `HTTPUrl`, they Python typing module throws a type error due to an unhashable type.\r\n\r\n```python\r\nTrac...
517161d61284df9089ddea738df7f9aa236da03e
{ "head_commit": "e647bbcc02995dbdcd27cc66c1308618aabc4451", "head_commit_message": "Remove change file", "patch_to_review": "diff --git a/pydantic/networks.py b/pydantic/networks.py\nindex cda9fce19d1..c9dde43ea77 100644\n--- a/pydantic/networks.py\n+++ b/pydantic/networks.py\n@@ -54,6 +54,18 @@ class UrlConstra...
[ { "diff_hunk": "@@ -647,6 +656,60 @@ class Model2(BaseModel):\n Model(v='ws:///foo/bar')\n \n \n+@pytest.mark.parametrize(\n+ 'options',\n+ [\n+ # Ensures the hash is generated correctly when a field is null\n+ {'max_length': None},\n+ {'allowed_schemes': None},\n+ {'ho...
5574718b6e6fc29547f5446f32b7065c438145fa
diff --git a/pydantic/networks.py b/pydantic/networks.py index cda9fce19d1..c9dde43ea77 100644 --- a/pydantic/networks.py +++ b/pydantic/networks.py @@ -54,6 +54,18 @@ class UrlConstraints(_fields.PydanticMetadata): default_port: int | None = None default_path: str | None = None + def __hash__(self) -> i...
{ "difficulty": "low", "estimated_review_effort": 2, "problem_domain": "Bug Fixes" }
pydantic__pydantic-5706@e3c9332
pydantic/pydantic
Python
5,706
Generate JSON schema for Sequence[T] as though it was List[T]
Closes #5597 @lig would you mind adding any tests you think are appropriate here out of PR https://github.com/pydantic/pydantic/pull/5598? If this addresses all of those (and we merge this), maybe close that PR as well. Selected Reviewer: @hramezani
2023-05-06T20:16:06Z
Unexpected behavior for `Sequence[int]` in Json Schema ### Initial Checks - [X] I confirm that I'm using Pydantic V2 installed directly from the `main` branch, or equivalent ### Description - [X] Using `Sequence[int]` for json is inconsistent. - [ ] `BaseModel.validate_json` should raise if `BaseModel.model_j...
[ { "body": "### Initial Checks\r\n\r\n- [X] I confirm that I'm using Pydantic V2 installed directly from the `main` branch, or equivalent\r\n\r\n### Description\r\n\r\n- [X] Using `Sequence[int]` for json is inconsistent.\r\n- [ ] `BaseModel.validate_json` should raise if `BaseModel.model_json_schema` raises. Se...
70e7e99ca1861ad71520cc8fcf1a2fb913abbc10
{ "head_commit": "e3c93326ed1896ec93b772bfe7a1e7ecd7abf7bb", "head_commit_message": "Generate JSON schema for sequence as though it was list", "patch_to_review": "diff --git a/pydantic/_internal/_generate_schema.py b/pydantic/_internal/_generate_schema.py\nindex a17088e7666..2cccf927157 100644\n--- a/pydantic/_in...
[ { "diff_hunk": "@@ -3983,3 +3984,39 @@ class Model(BaseModel):\n 'title': 'Model',\n 'type': 'object',\n }\n+\n+\n+def test_sequence_schema():\n+ class Model(BaseModel):\n+ int_sequence: Sequence[int]\n+ int_list: list[int]", "line": null, "original_line": 3992, ...
b5f361e33252a5d30e289c14b44decfae3884501
diff --git a/pydantic/_internal/_generate_schema.py b/pydantic/_internal/_generate_schema.py index c712fc4669f..5094f3d19bd 100644 --- a/pydantic/_internal/_generate_schema.py +++ b/pydantic/_internal/_generate_schema.py @@ -829,20 +829,23 @@ def _sequence_schema(self, sequence_type: Any) -> core_schema.CoreSchema: ...
{ "difficulty": "medium", "estimated_review_effort": 4, "problem_domain": "Bug Fixes" }
pydantic__pydantic-5632@3522ceb
pydantic/pydantic
Python
5,632
Revise models docs to indicate attributes are copied for validation
Closes https://github.com/pydantic/pydantic/issues/1068 ## Change Summary <!-- Please give a short summary of the changes. --> ## Related issue number <!-- Are there any issues opened that will be resolved by merging this change? --> <!-- WARNING: please use "fix #123" style references so the issue is clos...
2023-04-28T23:02:59Z
Inconsistency with attributes assignment # Bug Please complete: * OS: **macOS Mojave 10.14.6** * Python version `import sys; print(sys.version)`: **3.7.3** * Pydantic version `import pydantic; print(pydantic.VERSION)`: **1.2** On class construction with deep data structs like arrays and dictionaries, I get a c...
validation has to iterate over every element of the list to check each item is valid as an int input and perhaps coerce values to ints. e.g. `['1', 2.1, b'3']` will be coerced to `[1, 2, 3]`. This requires creating an new list, hence the new id, that's unavoidable with pydantic. you don't have `validation_assignment...
[ { "body": "# Bug\r\n\r\nPlease complete:\r\n* OS: **macOS Mojave 10.14.6**\r\n* Python version `import sys; print(sys.version)`: **3.7.3**\r\n* Pydantic version `import pydantic; print(pydantic.VERSION)`: **1.2**\r\n\r\nOn class construction with deep data structs like arrays and dictionaries, I get a copy. It'...
c600c010418c46cec1f3a0fe8fb6ca4be4a7949f
{ "head_commit": "3522cebce5acbe995a0aa60f1cd353a0f04d888f", "head_commit_message": "update docs to note attributes are copied", "patch_to_review": "diff --git a/docs/usage/dataclasses.md b/docs/usage/dataclasses.md\nindex 757095678fe..caba93f5fac 100644\n--- a/docs/usage/dataclasses.md\n+++ b/docs/usage/dataclas...
[ { "diff_hunk": "@@ -377,3 +377,34 @@ print(pydantic_core.to_json(user, indent=4).decode())\n }\n \"\"\"\n ```\n+## Attribute copies\n+\n+As described earlier, when constructing classes with data attributes, Pydantic copies the the attribute in order to efficiently iterate over its elements for validation.\n+\n+...
c3ed05f39403194d5e1119c31537bcddf974ea12
diff --git a/docs/usage/dataclasses.md b/docs/usage/dataclasses.md index 757095678fe..9aa35be8dae 100644 --- a/docs/usage/dataclasses.md +++ b/docs/usage/dataclasses.md @@ -20,15 +20,15 @@ print(user) ``` !!! note - Keep in mind that `pydantic.dataclasses.dataclass` is a drop-in replacement for `dataclasses.data...
{ "difficulty": "low", "estimated_review_effort": 1, "problem_domain": "Bug Fixes" }
pypa__pip-11143@dcd2d5e
pypa/pip
Python
11,143
New HTTP cache with lower memory usage
Fixes #2984 Additionally, updates `CacheControl` to the latest release. TL;DR: Huge decrease in memory usage, by using streaming cache instead of loading (multiple copies of) the whole file into memory in one go. **Note to reviewer:** The Windows CI didn't run for reasons that I can't control. Please rerun, a...
2022-05-24T16:21:17Z
Excessive memory use when caching large packages I'm getting a MemoryError while trying to install a large package (matplotlib) in a low memory (512mb) environment. It appears that the cause is the caching mechanism, as disabling the cache fixes the issue. ``` $ pip --version pip 7.1.0 from /…/virtualenv/local/lib/pyt...
Experiencing the same with `basemap` on a 4GB machine (Win 7): ``` $>pip install https://github.com/matplotlib/base map/archive/v1.0.7rel.tar.gz Collecting https://github.com/matplotlib/basemap/archive/v1 .0.7rel.tar.gz Downloading https://github.com/matplotlib/basemap/archive /v1.0.7rel.tar.gz \ 131.5MB 1.3MB/...
[ { "body": "I'm getting a MemoryError while trying to install a large package (matplotlib) in a low memory (512mb) environment. It appears that the cause is the caching mechanism, as disabling the cache fixes the issue.\n\n```\n$ pip --version\npip 7.1.0 from /…/virtualenv/local/lib/python2.7/site-packages (pyth...
ed113ff23b8f1845d9b05a3dfd93bd9b024303c0
{ "head_commit": "dcd2d5e344f27149789f05edb9da45994eac2473", "head_commit_message": "Update CacheControl to 0.13.1.", "patch_to_review": "diff --git a/docs/html/topics/caching.md b/docs/html/topics/caching.md\nindex 954cebe402d..19bd064a74c 100644\n--- a/docs/html/topics/caching.md\n+++ b/docs/html/topics/caching...
[ { "diff_hunk": "@@ -93,25 +93,31 @@ def get_cache_info(self, options: Values, args: List[Any]) -> None:\n num_http_files = len(self._find_http_files(options))\n num_packages = len(self._find_wheels(options, \"*\"))\n \n- http_cache_location = self._cache_dir(options, \"http\")\n+ h...
cc140553360120de3e95b98801fa6721e970ae95
diff --git a/docs/html/topics/caching.md b/docs/html/topics/caching.md index 954cebe402d..8d6c40f112d 100644 --- a/docs/html/topics/caching.md +++ b/docs/html/topics/caching.md @@ -27,6 +27,13 @@ While this cache attempts to minimize network activity, it does not prevent network access altogether. If you want a local ...
{ "difficulty": "high", "estimated_review_effort": 4, "problem_domain": "Performance Optimizations" }
pyodide__pyodide-2263@ef28468
pyodide/pyodide
Python
2,263
Add cryptography, openssl, and _ssl packages
Resolves #761. ssl passes 46/168 tests. 108 fail due to inability to start a socket and another 14 failing with attribute errors due to missing library functions. ### Checklists - [x] Add a [CHANGELOG](https://github.com/pyodide/pyodide/blob/main/docs/project/changelog.md) entry - [x] Add / update tests
2022-03-09T21:43:43Z
Cryptography Support Pyodide is genius. It will certainly influence and broaden the world impact of all these data science tools and Python in so many new contexts. Any plan on adding 'cryptography' to the list of supported packages? It seems many cool modules depend on it for fundamental encryption and security...
The issue with adding the cryptography package is that it uses CFFI for C-extensions and we currently don't support CFFI (https://github.com/iodide-project/pyodide/issues/681#issuecomment-639413545). Is this a limitation of pyodide or would we be able to add this in with a PR? Same applies for [`pynacl`](https://githu...
[ { "body": "Pyodide is genius. It will certainly influence and broaden the world impact of all these data science tools and Python in so many new contexts. \r\n\r\nAny plan on adding 'cryptography' to the list of supported packages?\r\n\r\nIt seems many cool modules depend on it for fundamental encryption and se...
74e6809da1ed609ea6f4c671b2f9196d3ce5caa9
{ "head_commit": "ef284681268b9ff5df0b43266e42d594fa877241", "head_commit_message": "Make ssl as part of core build", "patch_to_review": "diff --git a/.circleci/config.yml b/.circleci/config.yml\nindex aeeb8db2577..2e5af905828 100644\n--- a/.circleci/config.yml\n+++ b/.circleci/config.yml\n@@ -74,7 +74,7 @@ jobs:...
[ { "diff_hunk": "@@ -74,7 +74,7 @@ jobs:\n source pyodide_env.sh\n \n ccache -z\n- PYODIDE_PACKAGES=\"core\" make\n+ PYODIDE_PACKAGES=\"core, ssl\" make", "line": null, "original_line": 77, "original_start_line": null, "path": ".circleci/config.yml", ...
df9046e5a1112f81318569a243b6589a34a3e47a
diff --git a/Makefile.envs b/Makefile.envs index dec3170dff2..ccf75bf5be2 100644 --- a/Makefile.envs +++ b/Makefile.envs @@ -19,6 +19,7 @@ export HOSTPYTHON=$(HOSTPYTHONROOT)/bin/python$(PYMAJOR).$(PYMINOR) export CPYTHONROOT=$(PYODIDE_ROOT)/cpython export CPYTHONLIB=$(CPYTHONROOT)/installs/python-$(PYVERSION)/lib/...
{ "difficulty": "high", "estimated_review_effort": 4, "problem_domain": "New Feature Additions" }
pydantic__pydantic-5480@d2a5585
pydantic/pydantic
Python
5,480
Add migration error messages to V2
<!-- Thank you for your contribution! --> <!-- Unless your change is trivial, please create an issue to discuss the change before creating a PR --> <!-- We're currently in the process of rewriting pydantic in preparation for V2, see https://docs.pydantic.dev/blog/pydantic-v2/. --> <!-- **Note:** if you're making a p...
2023-04-14T09:50:45Z
Add nice error message when attempting to import removed modules/functions in v2 If a user attempts to import removed functions, from removed modules, or both, we should give a better error message than a plain ImportError. Ideally the error message will include some information about the migration path, or possibly a ...
Keen to work on this! Will require a fair bit of discussion on how we wish to inform the user, how long this will be persisted for etc. I have an initial idea (see PR https://github.com/pydantic/pydantic/pull/5113) Using this [PEP-562](https://github.com/orgs/pydantic/projects/1/views/3?pane=issue&itemId=19807370) ...
[ { "body": "If a user attempts to import removed functions, from removed modules, or both, we should give a better error message than a plain ImportError. Ideally the error message will include some information about the migration path, or possibly a request to create an issue if the changes break something in t...
58679eaf37bff192b34a0de6941e47da88cb7b4b
{ "head_commit": "d2a55855a4d837d8e8bbb9fe3cdc5cfa37ae4e1e", "head_commit_message": "Apply suggestions from code review\n\nCo-authored-by: David Montague <35119617+dmontagu@users.noreply.github.com>", "patch_to_review": "diff --git a/docs/usage/errors.md b/docs/usage/errors.md\nindex 01f55d9c6b5..cf3080a4748 1006...
[ { "diff_hunk": "@@ -91,8 +96,12 @@ def pydantic_encoder(obj: Any) -> Any:\n raise TypeError(f\"Object of type '{obj.__class__.__name__}' is not JSON serializable\")\n \n \n+@deprecated('custom_pydantic_encoder is deprecated, use BaseModel.model_dump instead.')", "line": null, "original_line": 99...
448769df3a05d342469f4b6ce320e90a143a7758
diff --git a/docs/usage/errors.md b/docs/usage/errors.md index 01f55d9c6b5..cf3080a4748 100644 --- a/docs/usage/errors.md +++ b/docs/usage/errors.md @@ -69,6 +69,10 @@ TODO TODO +## Import error {#import-error} + +This error is raised when you try to import an object that was available in V1 but has been removed i...
{ "difficulty": "medium", "estimated_review_effort": 4, "problem_domain": "New Feature Additions" }
pydantic__pydantic-5506@91128f0
pydantic/pydantic
Python
5,506
No case enum
Closes #5495, and resolves some other bugs with validation of plain enum.Enum fields, and validation of all enums from JSON. Selected Reviewer: @samuelcolvin
2023-04-17T19:36:29Z
V2 doesn't support bound enum generics ### Initial Checks - [X] I confirm that I'm using Pydantic V2 installed directly from the `main` branch, or equivalent ### Description Provided code example raises the following error: ``` pydantic_core._pydantic_core.SchemaError: Error building "model" validator: SchemaEr...
Thanks for reporting, I think we can make this work. @samuelcolvin I see two ways to resolve this: * Option 1: Use an `is_instance_schema` for enums with no cases — this seems sensible to me because 1, there's nothing that would pass validation, and 2, python already has a specific check for whether an enum class ha...
[ { "body": "### Initial Checks\n\n- [X] I confirm that I'm using Pydantic V2 installed directly from the `main` branch, or equivalent\n\n### Description\n\nProvided code example raises the following error:\r\n```\r\npydantic_core._pydantic_core.SchemaError: Error building \"model\" validator:\r\n SchemaError: E...
e70165c1c669fdf6db3ae026de57817a395429d3
{ "head_commit": "91128f040aa19c204cf212c2a5a5140a9255899a", "head_commit_message": "Fix test", "patch_to_review": "diff --git a/pydantic/_internal/_std_types_schema.py b/pydantic/_internal/_std_types_schema.py\nindex c6509cc4dc0..bb5e961c12c 100644\n--- a/pydantic/_internal/_std_types_schema.py\n+++ b/pydantic/_...
[ { "diff_hunk": "@@ -83,29 +91,37 @@ def to_enum(__input_value: Any, _: core_schema.ValidationInfo) -> Enum:\n )\n \n lax: CoreSchema\n- json_type: Literal['int', 'float', 'str']\n+ json_types: set[Literal['int', 'float', 'str']]\n if issubclass(enum_type, int):\n # this handles `IntEnu...
392ed0d3b8754bbc0ad25912510ec6e96c4ead8f
diff --git a/docs/usage/enums.md b/docs/usage/enums.md index 476d52bb340..4c10c366ede 100644 --- a/docs/usage/enums.md +++ b/docs/usage/enums.md @@ -36,6 +36,6 @@ except ValidationError as e: """ 1 validation error for CookingModel fruit - Input should be 'pear' or 'banana' [type=literal_error, inpu...
{ "difficulty": "medium", "estimated_review_effort": 4, "problem_domain": "Bug Fixes" }
pypa__pip-10832@13f4707
pypa/pip
Python
10,832
Use rich.traceback with debug mode
<!--- Thank you for your soon to be pull request. Before you submit this, please double check to make sure that you've added a news file fragment. In pip we generate our NEWS.rst from multiple news fragment files, and all pull requests require either a news file fragment or a marker to indicate they don't require ...
2022-01-26T08:25:03Z
Print the exception via rich.traceback, when running with `--debug` This would mean that exporting `PIP_DEBUG=1` and running tests with this would print a detailed traceback with information about locals! It would make debugging easier, especially in tests when there's a weird failure. Plus, I'm pretty sure anyone p...
[ { "body": "This would mean that exporting `PIP_DEBUG=1` and running tests with this would print a detailed traceback with information about locals! It would make debugging easier, especially in tests when there's a weird failure.\r\n\r\nPlus, I'm pretty sure anyone passing `--debug` would likely appreciate this...
e752b1a26ba927d9f348ecce8b5443d8b50fb5d0
{ "head_commit": "13f47078f0eaab84baaad9b63aaddf581c4ef311", "head_commit_message": "Fix lint", "patch_to_review": "diff --git a/news/10791.feature.rst b/news/10791.feature.rst\nnew file mode 100644\nindex 00000000000..be41c6b7e21\n--- /dev/null\n+++ b/news/10791.feature.rst\n@@ -0,0 +1 @@\n+Print the exception v...
[ { "diff_hunk": "@@ -10,6 +10,8 @@\n from optparse import Values\n from typing import Any, Callable, List, Optional, Tuple\n \n+from pip._vendor.rich.traceback import install", "line": null, "original_line": 13, "original_start_line": null, "path": "src/pip/_internal/cli/base_command.py", "st...
e17421c33a5ae73c5a38b35b8bd24c6895140bbc
diff --git a/news/10791.feature.rst b/news/10791.feature.rst new file mode 100644 index 00000000000..be41c6b7e21 --- /dev/null +++ b/news/10791.feature.rst @@ -0,0 +1 @@ +Print the exception via ``rich.traceback``, when running with ``--debug``. diff --git a/src/pip/_internal/cli/base_command.py b/src/pip/_internal/cli...
{ "difficulty": "low", "estimated_review_effort": 3, "problem_domain": "Test Suite / CI Enhancements" }
pyodide__pyodide-2019@d2131a6
pyodide/pyodide
Python
2,019
Remove function pointer cast emulation
This is a third attempt at the fpcast removal. The good news is that chrome is working okay here. I guess this one works. Closes #2016. Closes #1677. Closes #1577.
2021-12-05T20:28:44Z
fpcast emulation tracing and removing We currently build with function pointer cast emulation. It is really hard to remove this because it is hard to know where bad function calls are being made (i.e. where an indirect call is made where the call arguments don't match the target function arguments). I would suggest ...
Thanks for opening this issue with a detailed plan @joemarshall ! Personally I also won't have much availability to look into this in the near future, but I very much look forward to getting rid of fpcast emulation. It should also help for Python performance #1120 as far as I understand. I had a tiny fiddle with th...
[ { "body": "We currently build with function pointer cast emulation. It is really hard to remove this because it is hard to know where bad function calls are being made (i.e. where an indirect call is made where the call arguments don't match the target function arguments).\r\n\r\nI would suggest that what is ne...
418813de331e8222e17b35f124043289bd6b0936
{ "head_commit": "d2131a6aa40deef714057cca0307e67c8766556c", "head_commit_message": "Remove max-func-params ldflag, doesn't do anything without fpcast", "patch_to_review": "diff --git a/.circleci/config.yml b/.circleci/config.yml\nindex d7d9e8dc3f0..2e43c6add44 100644\n--- a/.circleci/config.yml\n+++ b/.circleci/...
[ { "diff_hunk": "@@ -23,7 +25,11 @@ def test_fnmatch(selenium_module_scope, pattern, name, flags, expected):\n assert result == expected\n \n \n-@run_in_pyodide(packages=[\"cffi_example\"], module_scope=True)\n+@run_in_pyodide(\n+ packages=[\"cffi_example\"],\n+ module_scope=True,\n+ xfail_browsers=...
21aa985ca8dc2c1098576e9c83cf96e2d63a9d83
diff --git a/.circleci/config.yml b/.circleci/config.yml index d7d9e8dc3f0..685df69ef53 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -236,16 +236,6 @@ jobs: command: | pytest -s benchmark/stack_usage.py | sed -n 's/## //pg' - test-emsdk: - <<: *defaults - resource_cl...
{ "difficulty": "medium", "estimated_review_effort": 3, "problem_domain": "Code Refactoring / Architectural Improvement" }
pypa__pip-10693@7e59f57
pypa/pip
Python
10,693
Move from tox to Nox
Closes #6721. Move all our CI from tox to Nox, and update documentation. @pypa/pip-team @theacodes <!--- Thank you for your soon to be pull request. Before you submit this, please double check to make sure that you've added a news file fragment. In pip we generate our NEWS.rst from multiple news fragment files...
2021-11-29T15:32:19Z
Investigate if we can replace our tox+invoke setup with nox My understanding is that nox is good enough to cover our use-cases for both tox and invoke (eg. the test stuff can possibly be easier, and the vendoring / generation logic). It'll might be worth the effort to invest time to switch from those two tools to us...
Happy to help in any way. :) Nox is pretty well suited for what y'all are doing. I think if we do this -- we see most benefit from replacing our invoke stuff. I imagine having the chunk of the code living in tools/automation/ and having the noxfile.py just contain the "overview" of what those commands need. @xavfern...
[ { "body": "My understanding is that nox is good enough to cover our use-cases for both tox and invoke (eg. the test stuff can possibly be easier, and the vendoring / generation logic).\r\n\r\nIt'll might be worth the effort to invest time to switch from those two tools to using just nox.\r\n\r\n/cc @crwilcox @t...
9cf35b25e25a47b41480d5b2dc82b8ebd1eeb6a0
{ "head_commit": "7e59f57e2a67064934f88b2591a67d4d14247fd9", "head_commit_message": "Fix the news entry", "patch_to_review": "diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml\nindex 6d3f70fcabe..e9885a499ae 100644\n--- a/.github/workflows/ci.yml\n+++ b/.github/workflows/ci.yml\n@@ -121,17 +121,17 ...
[ { "diff_hunk": "@@ -63,12 +63,6 @@ def should_update_common_wheels() -> bool:\n return need_to_repopulate\n \n \n-# -----------------------------------------------------------------------------", "line": 66, "original_line": 66, "original_start_line": null, "path": "noxfile.py", "start_l...
a829016820c2a5662572949c26164fade5cf8932
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6d3f70fcabe..5f92432913c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -84,8 +84,8 @@ jobs: - uses: actions/checkout@v2 - uses: actions/setup-python@v2 - - run: pip install vendoring - - run: vendo...
{ "difficulty": "medium", "estimated_review_effort": 3, "problem_domain": "Test Suite / CI Enhancements" }
pyodide__pyodide-1981@be7dfcd
pyodide/pyodide
Python
1,981
Better test discovery
This improves the pytest test discovery with the following points, - Running `pytest` with no arguments (or `pytest .`) now correctly collects all available tests (except for emsdk ones which require the compiler setup and have to be run separately with `make -C emsdk test`) - Running `pytest` on packages now skips...
2021-11-20T12:49:46Z
`make test` in docker always fails due broken emsdk/tests ## 🐛 Bug Hey, is the emsdk/tests-suite broken or sort of? When I want to run the test suite locally in a docker container, it always fails. `make test` produces this immediately on current main branch: ``` pytest src emsdk/tests packages/*/test* pyodide...
I'm not sure if it's related, but we also see emsdk test failures on #1677. Should be fixed in https://github.com/pyodide/pyodide/pull/1981 which removes the `make test` command. The emdsk tests have to be currently run separately with `make -C emsdk test` since, unlike the rest of the tests, they require all the compi...
[ { "body": "## 🐛 Bug\r\n\r\nHey, is the emsdk/tests-suite broken or sort of? When I want to run the test suite locally in a docker container, it always fails.\r\n\r\n`make test` produces this immediately on current main branch:\r\n```\r\npytest src emsdk/tests packages/*/test* pyodide-build -v\r\n==============...
f1685c12c80487912dc461c9329f360477085276
{ "head_commit": "be7dfcdd58b3b621c916b5a78b1c24da0e75bda5", "head_commit_message": "More fixes", "patch_to_review": "diff --git a/Makefile b/Makefile\nindex 8a584493fc7..7fcb5999b71 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -124,8 +124,6 @@ update_base_url: \\\n \tbuild/webworker.js\n \n \n-test: all\n-\tpytest...
[ { "diff_hunk": "@@ -463,8 +478,57 @@ def extra_checks_test_wrapper(selenium, trace_hiwire_refs, trace_pyproxies):\n assert delta_keys <= 0\n \n \n+def _maybe_skip_test(item, delayed=False):\n+ \"\"\"If necessary skip test at the fixture level, to avoid\n+\n+ loading the selenium_standalone fixture...
aff7d9e502af28cfcb252e59002c86fe9358a381
diff --git a/Makefile b/Makefile index 8a584493fc7..7fcb5999b71 100644 --- a/Makefile +++ b/Makefile @@ -124,8 +124,6 @@ update_base_url: \ build/webworker.js -test: all - pytest src emsdk/tests packages/*/test* pyodide-build -v lint: node_modules/.installed # check for unused imports, the rest is done by bl...
{ "difficulty": "medium", "estimated_review_effort": 4, "problem_domain": "Bug Fixes" }
pyodide__pyodide-2012@c09b5a7
pyodide/pyodide
Python
2,012
ENH Add micropip.list()
### Summary Closes: #1967 Adds a new API `micropip.list()` which returns a list of installed packages. ### Detail - `PackageMetadata`: a dataclass object that contains (name, version, source) of a package - `PackageDict`: a dict-like object that maps package name to PackageMetadata - has custom `__repr_...
2021-12-01T15:44:07Z
Add micropip.list It would be nice to add `micropip.list` function to list all installed packages and their versions, by analogy with the `pip list` command. The output could be a list like object of dictionaries (or data class objects) with the following fields, ```py name: str version : str path : ...
Should the output of this API include js packages like numpy? I think so if we are going to merge `micropip` and `pyodide.loadPackage` Yes, I was thinking we could support both, and indicate the source in a separate column. ``` # Name Version Source package_1 0.2.2 py...
[ { "body": "It would be nice to add `micropip.list` function to list all installed packages and their versions, by analogy with the `pip list` command.\r\n\r\nThe output could be a list like object of dictionaries (or data class objects) with the following fields,\r\n```py\r\n name: str\r\n version : str\r...
418813de331e8222e17b35f124043289bd6b0936
{ "head_commit": "c09b5a7ed8e8ccecfc3a79a1ead3931af56cfbb2", "head_commit_message": "Implement micropip.list()", "patch_to_review": "diff --git a/packages/micropip/src/micropip/__init__.py b/packages/micropip/src/micropip/__init__.py\nindex 8833180c86d..524499beee2 100644\n--- a/packages/micropip/src/micropip/__i...
[ { "diff_hunk": "@@ -365,7 +381,30 @@ def install(requirements: Union[str, List[str]], keep_going: bool = False):\n )\n \n \n-__all__ = [\"install\"]\n+def list():", "line": null, "original_line": 384, "original_start_line": null, "path": "packages/micropip/src/micropip/micropip.py", "sta...
1533bcac1e2300a35611aad532fc04d77676ed91
diff --git a/docs/project/changelog.md b/docs/project/changelog.md index e01ee9e4ca3..55beae71250 100644 --- a/docs/project/changelog.md +++ b/docs/project/changelog.md @@ -123,6 +123,10 @@ substitutions: failing after processing the first one. {pr}`1976` +- {{Enhancement}} Added a new API {func}`micropip.list`...
{ "difficulty": "medium", "estimated_review_effort": 3, "problem_domain": "New Feature Additions" }
pydantic__pydantic-5386@009207b
pydantic/pydantic
Python
5,386
Add __pydantic_init_subclass__ classmethod
Closes #5369. @samuelcolvin let me know if you think we should change this to be a non-dunder name (e.g., `model_init_subclass`). Should be trivial to change. The only argument I see for keeping it as a dunder like this is to help draw users' attention to the fact that it really is meant to be similar to `__init_...
2023-04-05T17:04:18Z
No way to access fields during __init_subclass__ ### Initial Checks - [X] I confirm that I'm using Pydantic V2 installed directly from the `main` branch, or equivalent ### Description There is no way to iterate through the `fields` from a class method anymore without instantiation For example, if I want to ...
There is no 2.04a release. To answer the question, you need to use `.model_fields`. @samuelcolvin Thank you for the super quick feedback! unless I am missing something `cls.model_fields` is also empty at definition class during `__init_subclass__` Ye, we set it after the class is created, this is empty in `__init_s...
[ { "body": "### Initial Checks\r\n\r\n- [X] I confirm that I'm using Pydantic V2 installed directly from the `main` branch, or equivalent\r\n\r\n### Description\r\n\r\nThere is no way to iterate through the `fields` from a class method anymore without instantiation\r\n\r\nFor example, if I want to iterate throug...
6cbd8d69609bcc5b4b383830736790f9b8087e36
{ "head_commit": "009207b6a1f82a8d54b63ef33721cb176925a867", "head_commit_message": "Add comment about kwargs in __pydantic_init_subclass__", "patch_to_review": "diff --git a/pydantic/main.py b/pydantic/main.py\nindex 5db7fe6d7e0..6e13215a846 100644\n--- a/pydantic/main.py\n+++ b/pydantic/main.py\n@@ -152,6 +152,...
[ { "diff_hunk": "@@ -211,6 +215,22 @@ def __init__(__pydantic_self__, **data: Any) -> None:\n def __get_pydantic_core_schema__(cls, source: type[BaseModel], gen_schema: GenerateSchema) -> CoreSchema:\n return gen_schema.model_schema(cls)\n \n+ @classmethod\n+ def __pydantic_init_subclass__(cls,...
f845f91327a3da98d61996a9bfa0165be9c8a83e
diff --git a/pydantic/main.py b/pydantic/main.py index 5db7fe6d7e0..bb68f7a4c51 100644 --- a/pydantic/main.py +++ b/pydantic/main.py @@ -152,6 +152,10 @@ def hash_func(self_: Any) -> int: types_namespace, raise_errors=False, ) + # using super(cls, cls) on the ne...
{ "difficulty": "medium", "estimated_review_effort": 3, "problem_domain": "Bug Fixes" }
pydantic__pydantic-5385@4e29f8f
pydantic/pydantic
Python
5,385
Add _types_namespace argument to model_rebuild
Closes https://github.com/pydantic/pydantic/issues/5383 I called the argument `_types_namespace` instead of `_types_namespace` to try to discourage people from using it (like `_parent_namespace_depth`, you probably shouldn't change the value unless you know what you are doing). But I would be open to changing thi...
2023-04-05T14:30:14Z
`localns` arguments are not longer accepted. ### Initial Checks - [X] I confirm that I'm using Pydantic V2 installed directly from the `main` branch, or equivalent ### Description I used localns to create nested models dynamically using pydanticv1. Define all models, `….update_forward_refs({"ModelNameA":ModelA","Mo...
Yeah, I realized we had eliminated this and was concerned someone might want the ability to specify the localns directly. I think we can re-add this into `model_rebuild`, I'll take a stab at it. @commonism just opened #5385 to address this; as I noted there: > @commonism If the unit test I added here isn't represent...
[ { "body": "### Initial Checks\n\n- [X] I confirm that I'm using Pydantic V2 installed directly from the `main` branch, or equivalent\n\n### Description\n\nI used localns to create nested models dynamically using pydanticv1.\r\nDefine all models, `….update_forward_refs({\"ModelNameA\":ModelA\",\"ModelNameA\":Mod...
86c01e180ab3d102ecc10a7aada95de19cb3607f
{ "head_commit": "4e29f8f8625a07e66fa19ea6b88f921a97f6254a", "head_commit_message": "Add _types_namespace argument to model_rebuild", "patch_to_review": "diff --git a/pydantic/main.py b/pydantic/main.py\nindex 762084ae027..03f63547319 100644\n--- a/pydantic/main.py\n+++ b/pydantic/main.py\n@@ -389,6 +389,7 @@ def...
[ { "diff_hunk": "@@ -1839,6 +1839,20 @@ class C(BaseModel, undefined_types_warning=False):\n assert m.model_dump() == {'b': {'c': {'a': None}}}\n \n \n+def test_model_rebuild_localns():\n+ class A(BaseModel, undefined_types_warning=False):\n+ x: int\n+\n+ class B(BaseModel, undefined_types_warni...
f277b78b7684e20fc085a19cea862c896a66f0f8
diff --git a/pydantic/main.py b/pydantic/main.py index 1898fe655d9..6d140898aca 100644 --- a/pydantic/main.py +++ b/pydantic/main.py @@ -390,6 +390,7 @@ def model_rebuild( force: bool = False, raise_errors: bool = True, _parent_namespace_depth: int = 2, + _types_namespace: dict[str, An...
{ "difficulty": "medium", "estimated_review_effort": 3, "problem_domain": "New Feature Additions" }
pyodide__pyodide-1742@eeb969b
pyodide/pyodide
Python
1,742
Add dict_converter parameter to toJs
This resolves #1529 by allowing `dict_converter=Object.fromEntries`. Perhaps we should rename the options for `toJs` to follow the Javascript naming conventions (so then `to_js` would have `dict_converter` and `toJs` would have `dictConverter`.
2021-07-23T16:47:45Z
Passing python dict into a js function Hi, I just noticed that we now (v0.17.0) convert python dict to a `Map` in js, and it break my previous code. I have 3 questions: 1. What would be the easiest way to send a dictionary in Python to Js so it will become a regular object. 2. What is the reason to choose convert...
Hi @oeway, thanks for the question. We didn't have time to vet this as well as I would have liked and so there are some usability issues. Ideally it would be good to have a careful discussion about each detail like this, but since we have such limited developer time available on this project, there's inevitably going t...
[ { "body": "Hi, I just noticed that we now (v0.17.0) convert python dict to a `Map` in js, and it break my previous code.\r\n\r\nI have 3 questions:\r\n1. What would be the easiest way to send a dictionary in Python to Js so it will become a regular object. \r\n2. What is the reason to choose converting `dict` t...
684269285b5341c72e5a95e020c9884360e0faab
{ "head_commit": "eeb969b4dabf979c301575706e6d008af255815f", "head_commit_message": "Reorder params in python2js to use standard C 'Object oriented' style", "patch_to_review": "diff --git a/docs/project/changelog.md b/docs/project/changelog.md\nindex a50e313efa5..57f1a81f0d8 100644\n--- a/docs/project/changelog.m...
[ { "diff_hunk": "@@ -144,22 +145,30 @@ def to_js(\n \n Parameters\n ----------\n- obj : Any\n- The Python object to convert\n-\n- depth : int, default=-1\n- The maximum depth to do the conversion. Negative numbers are treated\n- as infinite. Set this...
e5859b7e1dae3168d65d669539f87bb31bf8f627
diff --git a/docs/project/changelog.md b/docs/project/changelog.md index a50e313efa5..57f1a81f0d8 100644 --- a/docs/project/changelog.md +++ b/docs/project/changelog.md @@ -108,6 +108,18 @@ substitutions: now takes `depth` as a named argument. Also `to_js` and `to_py` only take depth as a keyword argument. {pr...
{ "difficulty": "medium", "estimated_review_effort": 4, "problem_domain": "Bug Fixes" }
pyodide__pyodide-1656@ba398f4
pyodide/pyodide
Python
1,656
ENH Add Ctypes support
Resolves #728. I took [the libffi port](https://brionv.com/log/2018/05/06/emscripten-fun-porting-libffi-to-webassembly-part-1/) started by @brion and added support for structs and closures (and fixed some issues with `long double`). I have that code here: https://github.com/hoodmane/libffi-emscripten It currentl...
2021-06-23T21:35:51Z
ctypes support Is there a plan to enable the `ctypes` library in pyodide? I'd like to use it to call from my pyodide python code into a WebAssembly. Alternatively, is there some other mechanism I can use to call into a WebAssembly? Here's why I ask. I am trying to get shapely, a popular Python package for computa...
Yes, currently we [remove the `ctypes` module](https://github.com/iodide-project/pyodide/blob/f2c92ad43112366951530fe63c48bf6969a89070/cpython/remove_modules.txt#L2) as it's not supported. @pmp-p Has managed to make it work in [micropython-ports-wasm](https://github.com/pmp-p/micropython-ports-wasm) so it should be ...
[ { "body": "Is there a plan to enable the `ctypes` library in pyodide? I'd like to use it to call from my pyodide python code into a WebAssembly. Alternatively, is there some other mechanism I can use to call into a WebAssembly?\r\n\r\nHere's why I ask. I am trying to get shapely, a popular Python package for...
3030e93560cfbe2ce1d53984f5badd999ccad3bd
{ "head_commit": "ba398f4e4d1ed8f047ce8e2e4b6bc1793111d070", "head_commit_message": "Fix path in patch", "patch_to_review": "diff --git a/.circleci/config.yml b/.circleci/config.yml\nindex ae53d041e86..79f48f26597 100644\n--- a/.circleci/config.yml\n+++ b/.circleci/config.yml\n@@ -3,7 +3,7 @@ version: 2\n default...
[ { "diff_hunk": "@@ -59,6 +62,7 @@ export MAIN_MODULE_LDFLAGS= $(LDFLAGS_BASE) -s MAIN_MODULE=1 \\\n \t$(wildcard $(CPYTHONROOT)/build/bzip2*/libbz2.a) \\\n \t-lstdc++ \\\n \t--memory-init-file 0 \\\n+\t-s WASM_BIGINT \\", "line": null, "original_line": 65, "original_start_line": null, "path": "M...
7e50510dc6111817aae5e3ed415a83a6283895b1
diff --git a/.circleci/config.yml b/.circleci/config.yml index ae53d041e86..d5e10f4f5f6 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -3,7 +3,7 @@ version: 2 defaults: &defaults working_directory: ~/repo docker: - - image: pyodide/pyodide-env:17 + - image: pyodide/pyodide-env:18 enviro...
{ "difficulty": "high", "estimated_review_effort": 4, "problem_domain": "New Feature Additions" }
pyodide__pyodide-1804@72a9daf
pyodide/pyodide
Python
1,804
ENH Change to minimal build by default
With this PR `make` only builds the packages needed for the core test suite (previously equivalent to `make minimal`), - `make minimal` is removed as redundant - To build all packages `PYODIDE_PACKAGES='*'` can be used. - This supports meta packages `core` and `min-scipy-stack` (cf PR docs for a description) ...
2021-08-25T16:18:56Z
Build only micropip with default PYODIDE_PACKAGES Currently when a user or contributor downloads pyodide and runs make they end up with the full build which can take a while and with packages they might not need. This situation is going to get worse as more packages are added. I propose to, - by default set `PYO...
@rth thanks for this proposal, I totally agree with you. For most cases I'm using `make minimal` as build target. Generally, a fellow and I are currently focusing on building a *nano*-build command for Pyodide to end up with the tiniest working Pyodide which is possible (without support for any native-code packages)...
[ { "body": "Currently when a user or contributor downloads pyodide and runs make they end up with the full build which can take a while and with packages they might not need. This situation is going to get worse as more packages are added.\r\n\r\nI propose to,\r\n - by default set `PYODIDE_PACKAGES='micropip'`...
5a63152172ce39c94c5bfde66a0b66667b916f18
{ "head_commit": "72a9daf88902e1c4ff057df23781b43377cf0a5a", "head_commit_message": "Skip import tests for packages that are not built independently from\nPYODIDE_PACKAGES", "patch_to_review": "diff --git a/.circleci/config.yml b/.circleci/config.yml\nindex 40fff31d6af..d233ee3877d 100644\n--- a/.circleci/config....
[ { "diff_hunk": "@@ -12,13 +12,46 @@ def _parse_package_subset(query: Optional[str]) -> Optional[Set[str]]:\n Also add the list of mandatory packages: [\"pyparsing\", \"packaging\",\n \"micropip\"]\n \n+ Supports folowing meta-packages,\n+ - 'core': corresponds to packages needed to run the core t...
b0648c20fce4a43955e3bb2f48b6866d644e7b7d
diff --git a/.circleci/config.yml b/.circleci/config.yml index 40fff31d6af..d233ee3877d 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -64,8 +64,7 @@ jobs: no_output_timeout: 1200 command: | ccache -z - # The following packages are currently used in the mai...
{ "difficulty": "medium", "estimated_review_effort": 3, "problem_domain": "New Feature Additions" }
pypa__pip-9708@2e5e9e5
pypa/pip
Python
9,708
explain why version cannot be retrieved when Requires-Python is not satisfied
<!--- Thank you for your soon to be pull request. Before you submit this, please double check to make sure that you've added a news file fragment. In pip we generate our NEWS.rst from multiple news fragment files, and all pull requests require either a news file fragment or a marker to indicate they don't require ...
2021-03-15T17:09:21Z
Explain why version cannot be retrieved due to python-requires **What's the problem this feature will solve?** <!-- What are you trying to do, that you are unable to achieve with pip as it currently stands? --> I am trying to install a specific version of a package (`ipython==7.20.0` in this case). However my version...
Sounds reasonable, but the implementation would be much less straightforward than it would seem at first glance. Python package distribution is file-based, not version-based, so it does not actually make sense to say “ipython==7.20.0 was found but cannot be installed due to `Requires-Python`” because different files fo...
[ { "body": "**What's the problem this feature will solve?**\r\n<!-- What are you trying to do, that you are unable to achieve with pip as it currently stands? -->\r\nI am trying to install a specific version of a package (`ipython==7.20.0` in this case). However my version of python is 3.6 and the python-require...
bc45b93eb679963d23f100be4ebb5d0f1568ceee
{ "head_commit": "2e5e9e54bc3c80c93adc8525bf9ae9cbb168a655", "head_commit_message": "Merge branch 'main' into requires-python", "patch_to_review": "diff --git a/news/9615.feature.rst b/news/9615.feature.rst\nnew file mode 100644\nindex 00000000000..075a6cd4295\n--- /dev/null\n+++ b/news/9615.feature.rst\n@@ -0,0 ...
[ { "diff_hunk": "@@ -610,7 +609,7 @@ def __init__(\n self.format_control = format_control\n \n # These are boring links that have already been logged somehow.\n- self._logged_links: Set[Link] = set()\n+ self._logged_links = set() # type: Set[Tuple[Link, str]]", "line": null, ...
60fe6c0cb8267a12cb7899dcba3c564d0eb264fd
diff --git a/news/9615.feature.rst b/news/9615.feature.rst new file mode 100644 index 00000000000..075a6cd4295 --- /dev/null +++ b/news/9615.feature.rst @@ -0,0 +1 @@ +Explains why specified version cannot be retrieved when *Requires-Python* is not satisfied. diff --git a/src/pip/_internal/index/package_finder.py b/src...
{ "difficulty": "medium", "estimated_review_effort": 3, "problem_domain": "Bug Fixes" }
pydantic__pydantic-5009@5bd2abd
pydantic/pydantic
Python
5,009
Dataclasses
Most of the changes in pydantic-core are in https://github.com/pydantic/pydantic-core/pull/428 TODO: * [x] prevent modifying input dc * [ ] validate assignment * [x] `field()` * [x] `InitVar` * [ ] `validate_on_init` or remove? * [x] dataclasses as types * [ ] serialization * [x] #5118 fix #2816.
2023-02-05T13:22:06Z
`BaseModel` runtime-warns about private class vars from an arbitrary type annotation I tried to find something similar to this in the issue set but figured it was worth a new one: This code triggers an odd `RuntimeWarning` at import time: ```python from dataclasses import dataclass from pydantic import BaseMo...
Hi @goodboy and thanks for reporting. Yes it's actually "normal" because when you use a stdlib `dataclass` inside a `BaseModel`, _pydantic_ will convert you stdlib `dataclass` into a _pydantic_ `dataclass` to validate (and coerce if needed) input data. Behind the scenes it creates a `BaseModel` based on your stdlib `...
[ { "body": "I tried to find something similar to this in the issue set but figured it was worth a new one:\r\n\r\nThis code triggers an odd `RuntimeWarning` at import time:\r\n\r\n```python\r\nfrom dataclasses import dataclass\r\n\r\nfrom pydantic import BaseModel\r\n\r\n\r\n@dataclass\r\nclass C:\r\n _privat...
b32e726eaa58b43cc1ae2614db64305ef21994b8
{ "head_commit": "5bd2abd08aa8ea4610da25a0842d7df61374533d", "head_commit_message": "move inner schema generation", "patch_to_review": "diff --git a/pydantic/_internal/_dataclasses.py b/pydantic/_internal/_dataclasses.py\nnew file mode 100644\nindex 00000000000..9d30662e6b9\n--- /dev/null\n+++ b/pydantic/_interna...
[ { "diff_hunk": "@@ -79,3 +90,162 @@ def _update_attrs(self, constraints: dict[str, Any], attrs: set[str] | None = No\n if k not in attrs:\n raise TypeError(f'{self.__class__.__name__} has no attribute {k!r}')\n setattr(self, k, v)\n+\n+\n+def collect_fields( # noqa: C901...
f963cde7d913628e54eaea44364354c43e9b244d
diff --git a/pydantic/_internal/_dataclasses.py b/pydantic/_internal/_dataclasses.py new file mode 100644 index 00000000000..3dc22c639c1 --- /dev/null +++ b/pydantic/_internal/_dataclasses.py @@ -0,0 +1,152 @@ +""" +Private logic for creating pydantic datacalsses. +""" +from __future__ import annotations as _annotation...
{ "difficulty": "high", "estimated_review_effort": 4, "problem_domain": "Bug Fixes" }
pyodide__pyodide-1376@59bbd1a
pyodide/pyodide
Python
1,376
Rework python2js_buffer
As discussed in #1374, this simplifies python2js_buffer and removes various soundness issues (use after free, sometimes shared sometimes copied memory). I also added support for suboffsets. Now in all cases the innermost levels will be TypedArrays, and all the other levels will be normal Arrays. I rewrote the file `...
2021-03-26T22:16:24Z
problem with sending bytes to javascript Is there any restriction on sending bytes from python to javascript? ```javascript pyodide.runPython('bytes([10])') > Uint8ClampedArray [10] pyodide.runPython('bytes([10, 11])') > Uint8ClampedArray(2) [24, 0] pyodide.runPython('bytes([10, 11, 12])') > Uint8ClampedArray(...
Thanks for the report! I can reproduce. For instance `b"AB"` produces indeed, - `Uint8ClampedArray [ 24, 0 ]` with v0.15.0 (Python 3.7) - `Uint8ClampedArray [ 0, 8 ]` on master (Python 3.8) That doesn't look right. That pattern depending on the input length is also quite strange. There is a test that checks ...
[ { "body": "Is there any restriction on sending bytes from python to javascript?\r\n\r\n```javascript\r\npyodide.runPython('bytes([10])')\r\n> Uint8ClampedArray [10]\r\npyodide.runPython('bytes([10, 11])')\r\n> Uint8ClampedArray(2) [24, 0]\r\npyodide.runPython('bytes([10, 11, 12])')\r\n> Uint8ClampedArray(3) [24...
05a84ba3e9a6ed2285abd35c451b51079b595a69
{ "head_commit": "59bbd1ab6acf6733236139879fc1ca47c47ea0b9", "head_commit_message": "Fix tests the rest of the way", "patch_to_review": "diff --git a/docs/usage/type-conversions.md b/docs/usage/type-conversions.md\nindex 5f2342f0abc..065665597be 100644\n--- a/docs/usage/type-conversions.md\n+++ b/docs/usage/type-...
[ { "diff_hunk": "@@ -272,6 +272,7 @@ performs the following explicit conversions:\n | `list`, `tuple` | `Array` |\n | `dict` | `Map` |\n | `set` | `Set` |\n+| a buffer | `TypedArray` |", "line": null, "original_line": 275, "...
c3f3c65993c61748b789cbd20615e437be44a087
diff --git a/docs/project/changelog.md b/docs/project/changelog.md index 181c84b70cd..6e0a9f81d60 100644 --- a/docs/project/changelog.md +++ b/docs/project/changelog.md @@ -56,6 +56,12 @@ substitutions: - {{ API }} Added `PyProxy.getBuffer` API to allow direct access to Python buffers as Javascript TypedArrays. ...
{ "difficulty": "high", "estimated_review_effort": 4, "problem_domain": "Bug Fixes" }
pypa__pip-9369@6a438bd
pypa/pip
Python
9,369
Upgrade vendored resolvelib to 0.5.4
Fix #9180.
2020-12-27T12:23:22Z
AttributeError: 'NoneType' object has no attribute 'excluded_of' on pip 20.3 **Environment** * pip version: 20.3 * Python version: 3.9.0 * OS: Linux This error has happened locally on my computer, in CircleCI, and in Docker. **Description** Some combination of dependencies seems to cause an `AttributeError`...
@uranusjr ^ Thanks for the report! I am able to reproduce without kombu (i.e. `celery==5.0.2 "billiard<4.0,>=3.6.0" redis==3.5.3 redis-log-handler==0.0.1.dev32`). (For maintainers) So the issue is in the new backtracking code: ```python incompatibilities_from_broken = [ (k, v.incompatibilities) for k, v i...
[ { "body": "**Environment**\r\n\r\n* pip version: 20.3\r\n* Python version: 3.9.0\r\n* OS: Linux\r\n\r\nThis error has happened locally on my computer, in CircleCI, and in Docker.\r\n\r\n**Description**\r\nSome combination of dependencies seems to cause an `AttributeError` to be thrown.\r\n```\r\nERROR: Exceptio...
5ccd226df893df43818158e713ba24a74d82176d
{ "head_commit": "6a438bdc9384f6e23e9f33f06039edda64411f72", "head_commit_message": "Upgrade vendored resolvelib to 0.5.4", "patch_to_review": "diff --git a/news/9180.vendor.rst b/news/9180.vendor.rst\nnew file mode 100644\nindex 00000000000..61c433fe631\n--- /dev/null\n+++ b/news/9180.vendor.rst\n@@ -0,0 +1,2 @@...
[ { "diff_hunk": "@@ -0,0 +1,2 @@\n+Upgrade resolvelib to 0.5.4 to fix error when an existing incompatibility is", "line": null, "original_line": 1, "original_start_line": null, "path": "news/9180.vendor.rst", "start_line": null, "text": "@user1:\nsuggestion: break this into 2 fragments --...
92b90ea7e967a9e68530abb8c0e3b1e8a039fd8b
diff --git a/news/9180.bugfix.rst b/news/9180.bugfix.rst new file mode 100644 index 00000000000..e597c1ad90a --- /dev/null +++ b/news/9180.bugfix.rst @@ -0,0 +1 @@ +Fix error when an existing incompatibility is unable to be applied to a backtracked state. diff --git a/news/resolvelib.vendor.rst b/news/resolvelib.vendor...
{ "difficulty": "medium", "estimated_review_effort": 3, "problem_domain": "Bug Fixes" }
pyodide__pyodide-1206@884d4cd
pyodide/pyodide
Python
1,206
TST: Fix test_monkeypatch_eval_code
By restoring eval_code after the test is done. It's crazy that this bug didn't show up before! Resolves #1200.
2021-02-06T18:22:22Z
TST Occasional failures of test_keyboard_interrupt I have seen this test fail at least once in the CI and once locally. Rerunning the test fixes it, but it does suggest that it's maybe not very stable. ``` ___________________________________________________________________________________ test_keyboard_interrupt[fire...
Actually I can consistently reproduce it with, ``` pytest src/tests/test_pyodide.py -k firefox ``` using both chrome or firefox. However when it's run separately, ``` pytest src/tests/test_pyodide.py -k "firefox and test_keyboard_interrupt" ``` it doesn't fail. So there is likely some bad interaction with other...
[ { "body": "I have seen this test fail at least once in the CI and once locally. Rerunning the test fixes it, but it does suggest that it's maybe not very stable.\r\n```\r\n___________________________________________________________________________________ test_keyboard_interrupt[firefox] _______________________...
5d392a6699595ae0f993152ac4c955a7ab1adb99
{ "head_commit": "884d4cd5c964d9eedf7b60d1f8df4d2e5f40d8e6", "head_commit_message": "Lint", "patch_to_review": "diff --git a/src/tests/test_pyodide.py b/src/tests/test_pyodide.py\nindex 22d6a972501..9b5e8b31e8d 100644\n--- a/src/tests/test_pyodide.py\n+++ b/src/tests/test_pyodide.py\n@@ -146,6 +146,11 @@ def eval...
[ { "diff_hunk": "@@ -146,6 +146,11 @@ def eval_code(code, ns):\n )\n assert selenium.run(\"x = 99; 5\") == [3, 5]\n assert selenium.run(\"7\") == [99, 7]\n+ selenium.run(\n+ \"\"\"\n+ pyodide.eval_code = old_eval_code\n+ \"\"\"\n+ )", "line": null, "original_line": ...
b2f2f749d5a76bfc96f471a90ca2fcf6361a8a43
diff --git a/src/tests/test_pyodide.py b/src/tests/test_pyodide.py index 22d6a972501..c99df835c09 100644 --- a/src/tests/test_pyodide.py +++ b/src/tests/test_pyodide.py @@ -134,18 +134,25 @@ def test_eval_code_locals(): def test_monkeypatch_eval_code(selenium): - selenium.run( - """ - import pyodi...
{ "difficulty": "low", "estimated_review_effort": 1, "problem_domain": "Test Suite / CI Enhancements" }
pypa__pip-9207@5cfd8a7
pypa/pip
Python
9,207
Fix redact url in --help
Closes #9191 Closes #9196 Happened as we pass a list from --extra-index-url values, and we only handled regular strings Added a test to address this @pradyunsg @sbidoul
2020-12-02T21:02:37Z
pip install --help fails <!-- If you're reporting an issue for `--use-feature=2020-resolver`, use the "Dependency resolver failures / errors" template instead. --> **Environment** * pip version: 20.3 * Python version: 3.7.9 & 2.7.16 * OS: macOS Catalina 10.15.7 <!-- Feel free to add more information about ...
HUH. This is definitely worth fixing. ;) Thanks for the bug report @Rosswell! Would it be possible to provide the output of `pip config list`? @pradyunsg sure thing: ``` global.extra-index-url='https://pypi.python.org/simple/' global.index-url='https://nexus.it.locusdev.net/repository/invitae-pypi/simple/' globa...
[ { "body": "<!--\r\nIf you're reporting an issue for `--use-feature=2020-resolver`, use the \"Dependency resolver failures / errors\" template instead.\r\n-->\r\n\r\n**Environment**\r\n\r\n* pip version: 20.3\r\n* Python version: 3.7.9 & 2.7.16\r\n* OS: macOS Catalina 10.15.7\r\n\r\n<!-- Feel free to add more in...
ab7ff0a1b50dadfe8da1fe44ee115440b844426c
{ "head_commit": "5cfd8a7c3ec791c26616005a688db226fd767549", "head_commit_message": "Handle case of list default values in UpdatingDefaultsHelpFormatter\n\nHappens because we pass a list from --extra-index-url", "patch_to_review": "diff --git a/news/9191.bugfix.rst b/news/9191.bugfix.rst\nnew file mode 100644\nin...
[ { "diff_hunk": "@@ -0,0 +1,2 @@\n+Handle case of list default values in UpdatingDefaultsHelpFormatter\n+Happens because we pass a list from --extra-index-url", "line": null, "original_line": 2, "original_start_line": 1, "path": "news/9191.bugfix.rst", "start_line": null, "text": "@user1:...
8de94b5740ac0fb83f3dc899c9d4f23d85ed82c0
diff --git a/news/9191.bugfix.rst b/news/9191.bugfix.rst new file mode 100644 index 00000000000..e1c6d633de9 --- /dev/null +++ b/news/9191.bugfix.rst @@ -0,0 +1,2 @@ +Fix crash when logic for redacting authentication information from URLs +in ``--help`` is given a list of strings, instead of a single string. diff --git...
{ "difficulty": "medium", "estimated_review_effort": 2, "problem_domain": "Bug Fixes" }
pyodide__pyodide-272@b6d0645
pyodide/pyodide
Python
272
Fix package loading race condition
There was a fairly hard-to-reproduce race condition in how packages are loaded. After the full set of packages to load are resolved, each of them is "loaded" by adding `<script>` elements to the end of the document. When these package `.js` files are run, the first thing they do is increment a global counter, and c...
2018-12-06T23:27:16Z
async imports don't play nicely with non-async ones A Mozillian found an aspect of async importing that appears to not work. The code block below demonstrates the issue - it appears that mixing imports that fetch resources (other stuff from the pyodide stack) don't play very nicely with imports that don't. You can r...
UPDATE: we're having trouble reproducing the bug all of a sudden, so I'm not sure if there's a network issue w/ where pyodide assets are being served. We get errors that look like: ``` Error: Traceback (most recent call last): File "/lib/python3.7/site-packages/pyodide.py", line 35, in eval_code exec(compil...
[ { "body": "A Mozillian found an aspect of async importing that appears to not work. The code block below demonstrates the issue - it appears that mixing imports that fetch resources (other stuff from the pyodide stack) don't play very nicely with imports that don't.\r\n\r\nYou can replace the `from js import do...
82d0c4cbfdcf1b5191f8bd65d31716877ebe281b
{ "head_commit": "b6d06454b24502281c9e41bdb66ecdb631e68b06", "head_commit_message": "Fix package loading race condition", "patch_to_review": "diff --git a/src/pyodide.js b/src/pyodide.js\nindex 56f5649a7fe..9f2189ca4cc 100644\n--- a/src/pyodide.js\n+++ b/src/pyodide.js\n@@ -148,8 +148,11 @@ var languagePluginLoad...
[ { "diff_hunk": "@@ -148,8 +148,11 @@ var languagePluginLoader = new Promise((resolve, reject) => {\n messageCallback(`Loading ${packageList}`);\n }\n \n+ var packageCounter = Object.keys(toLoad).length * 2;\n+\n window.pyodide._module.monitorRunDependencies = (n) => {", "line": null...
5484bc73c8428ad70d3421ad3f809f9d8861712b
diff --git a/src/pyodide.js b/src/pyodide.js index 56f5649a7fe..895fdd133f2 100644 --- a/src/pyodide.js +++ b/src/pyodide.js @@ -148,8 +148,14 @@ var languagePluginLoader = new Promise((resolve, reject) => { messageCallback(`Loading ${packageList}`); } - window.pyodide._module.monitorRunDependenc...
{ "difficulty": "medium", "estimated_review_effort": 3, "problem_domain": "Bug Fixes" }
pypa__pip-7891@0acfdcd
pypa/pip
Python
7,891
Don't fail uninstallation if easy-install.pth doesn't exist
Fixes and Closes https://github.com/pypa/pip/issues/7856 I have moved the `raise UninstallationError` exception from the constructor of `UninstallPathEntries` to the start of the `remove` method, and I am logging a warning and returning from the `remove` method if the file does not exist
2020-03-24T11:40:42Z
Cannot remove entries from nonexistent file * pip version: 20.0.2 * Python version: 3.7.6 * Operating system: OSX # Problem It appears that when attempting to uninstall a package that was installed in editable mode, removing it does not work correctly if the `lib/python3.7/site-packages/easy-install.pth` file d...
Sounds reasonable to me. The error message can continue to exist, but the uninstallation command does not need to fail. (It would help if pip has a mechanism to fail with a specific error code, but if the choice is between 1 and 0, I would prefer 0.) I can take this issue up and create the PR, but I have a question abo...
[ { "body": "* pip version: 20.0.2\r\n* Python version: 3.7.6\r\n* Operating system: OSX\r\n\r\n# Problem\r\n\r\nIt appears that when attempting to uninstall a package that was installed in editable mode, removing it does not work correctly if the `lib/python3.7/site-packages/easy-install.pth` file does not exist...
8c95de11ccb6ce75f67835766007d36f4ce6c941
{ "head_commit": "0acfdcd71986c8635b73b09633d13d36b1cfad40", "head_commit_message": "Check for uninstalled package after deleting pth file", "patch_to_review": "diff --git a/news/7856.bugfix b/news/7856.bugfix\nnew file mode 100644\nindex 00000000000..de1c264a46b\n--- /dev/null\n+++ b/news/7856.bugfix\n@@ -0,0 +1...
[ { "diff_hunk": "@@ -0,0 +1 @@\n+Uninstall should complete successfully, removing the .egg-link, even if the easy-install.pth file is not found.", "line": null, "original_line": 1, "original_start_line": null, "path": "news/7856.bugfix", "start_line": null, "text": "@user1:\nDo we need to...
0d2954d726aa56ad619097e35fb0f718190f3222
diff --git a/news/7856.bugfix b/news/7856.bugfix new file mode 100644 index 00000000000..209805d81e8 --- /dev/null +++ b/news/7856.bugfix @@ -0,0 +1 @@ +Uninstallation no longer fails on trying to remove non-existent files. diff --git a/src/pip/_internal/req/req_uninstall.py b/src/pip/_internal/req/req_uninstall.py ind...
{ "difficulty": "low", "estimated_review_effort": 2, "problem_domain": "Bug Fixes" }
pydantic__pydantic-2670@7beddee
pydantic/pydantic
Python
2,670
fix: stop calling parent class `root_validator` if overridden
<!-- Thank you for your contribution! --> <!-- Unless your change is trivial, please create an issue to discuss the change before creating a PR --> <!-- See https://pydantic-docs.helpmanual.io/contributing/ for help on Contributing --> ## Change Summary We would keep all the root validators even those that were s...
2021-04-13T21:25:00Z
Root validator called in superclass even if overridden in a subclass without calling super # Bug Output of `python -c "import pydantic.utils; print(pydantic.utils.version_info())"`: ``` pydantic version: 1.6.1 pydantic compiled: True install path: /Users/jakub/.virtualen...
I recently ran into this as well, and it certainly was unexpected to me. I ended up writing a small patch to the metaclass which removes overridden validators post-hoc. I post it below in case it is useful to others. ```python from pydantic import BaseModel from pydantic.main import ModelMetaclass def remove_ov...
[ { "body": "# Bug\r\n\r\nOutput of `python -c \"import pydantic.utils; print(pydantic.utils.version_info())\"`:\r\n```\r\n pydantic version: 1.6.1\r\n pydantic compiled: True\r\n install path: /Users/jakub/.virtualenvs/server/lib/python3.8/site-packages/pydantic\r\n ...
b718e8e62680c2d7a42f1cf946094e1c0fe28c1d
{ "head_commit": "7beddee13291bf773a4d1a9d5528f91e013f0d31", "head_commit_message": "fix: stop calling parent class `root_validator` if overridden", "patch_to_review": "diff --git a/changes/1895-PrettyWood.md b/changes/1895-PrettyWood.md\nnew file mode 100644\nindex 00000000000..bd806479486\n--- /dev/null\n+++ b/...
[ { "diff_hunk": "@@ -277,16 +277,25 @@ def to_camel(string: str) -> str:\n T = TypeVar('T')\n \n \n-def unique_list(input_list: Union[List[T], Tuple[T, ...]]) -> List[T]:\n+def unique_list(\n+ input_list: Union[List[T], Tuple[T, ...]],\n+ *,\n+ get_name: Callable[..., str] = lambda x: str(x),", "lin...
125541ea3d10e028130b3bf0e213a79c947b6df3
diff --git a/changes/1895-PrettyWood.md b/changes/1895-PrettyWood.md new file mode 100644 index 00000000000..bd806479486 --- /dev/null +++ b/changes/1895-PrettyWood.md @@ -0,0 +1 @@ +stop calling parent class `root_validator` if overridden diff --git a/pydantic/main.py b/pydantic/main.py index a67237cfad6..3eef5ed71eb ...
{ "difficulty": "medium", "estimated_review_effort": 3, "problem_domain": "Bug Fixes" }
pydantic__pydantic-2262@b539d3e
pydantic/pydantic
Python
2,262
Added schema generation for Generic fields
<!-- Thank you for your contribution! --> <!-- Unless your change is trivial, please create an issue to discuss the change before creating a PR --> <!-- See https://pydantic-docs.helpmanual.io/contributing/ for help on Contributing --> ## Change Summary Generating schema for generic fields hasn't been implement...
2021-01-14T08:20:46Z
BaseModel.schema() fails when using generic types # Bug ## Version Output of `python -c "import pydantic.utils; print(pydantic.utils.version_info())"`: ``` pydantic version: 1.5.1 pydantic compiled: True install path: C:\Users\adrian\miniconda3\envs\sangl-butler\Lib\site-packages\py...
Looks to me like generating schema for generic fields just hasn't been implemented yet. Happy to review and accept a PR to implement this. I've done some poking around and reduced this down to some test cases. These all succeed: ```python def test_with_generic(self): class Model(BaseModel, Generi...
[ { "body": "# Bug\r\n## Version\r\nOutput of `python -c \"import pydantic.utils; print(pydantic.utils.version_info())\"`:\r\n```\r\n pydantic version: 1.5.1\r\n pydantic compiled: True\r\n install path: C:\\Users\\adrian\\miniconda3\\envs\\sangl-butler\\Lib\\site-packages\\pydantic\r\...
13a5c7d676167b415080de5e6e6a74bea095b239
{ "head_commit": "b539d3e7c23e6b7c4e5ba76ad6af7fc90f3ebba7", "head_commit_message": "remove redundant len", "patch_to_review": "diff --git a/changes/2262-maximberg.md b/changes/2262-maximberg.md\nnew file mode 100644\nindex 00000000000..0911c71d0a4\n--- /dev/null\n+++ b/changes/2262-maximberg.md\n@@ -0,0 +1 @@\n+...
[ { "diff_hunk": "@@ -496,7 +498,10 @@ def field_type_schema(\n \n # check field type to avoid repeated calls to the same __modify_schema__ method\n if field.type_ != field.outer_type_:\n- modify_schema = getattr(field.outer_type_, '__modify_schema__', None)\n+ if field.shape == SHAPE_GENERI...
bf9e4dfa33150522213f4f6e72614999f1a5dd0c
diff --git a/changes/2262-maximberg.md b/changes/2262-maximberg.md new file mode 100644 index 00000000000..0911c71d0a4 --- /dev/null +++ b/changes/2262-maximberg.md @@ -0,0 +1 @@ +Support generating schema for Generic fields. \ No newline at end of file diff --git a/pydantic/schema.py b/pydantic/schema.py index cf4dc4...
{ "difficulty": "medium", "estimated_review_effort": 3, "problem_domain": "Bug Fixes" }
pypa__pip-7747@f2e49b3
pypa/pip
Python
7,747
Refactor parse_requirements to be independent of InstallRequirement
Fixes #7746 It's a bit of a big PR, sorry, but the commits make the change in stages, so that hopefully makes it a bit easier to review.
2020-02-14T12:27:23Z
Make parse_requirements independent of InstallRequirement **What's the problem this feature will solve?** The code in pip that currently parses requirements files is tightly coupled to the `InstallRequirement` class, meaning that it cannot be used to parse requirements files for any other purpose. By making `parse_req...
[ { "body": "**What's the problem this feature will solve?**\r\nThe code in pip that currently parses requirements files is tightly coupled to the `InstallRequirement` class, meaning that it cannot be used to parse requirements files for any other purpose. By making `parse_requirements` return instances of a gene...
cfbfff0b4caa5eaecccb64fccf76e7bf069518ce
{ "head_commit": "f2e49b3946423c07a46398f691f721771b80b38a", "head_commit_message": "Use a new ParsedRequirement class to communicate between handle_line and parse_requirements", "patch_to_review": "diff --git a/src/pip/_internal/req/req_file.py b/src/pip/_internal/req/req_file.py\nindex baf8d03ea2a..0263dc15388 ...
[ { "diff_hunk": "@@ -33,7 +33,7 @@\n if MYPY_CHECK_RUNNING:\n from optparse import Values\n from typing import (\n- Any, Callable, Iterator, List, NoReturn, Optional, Text, Tuple,\n+ Any, Callable, Iterator, List, NoReturn, Optional, Text, Tuple, Dict,", "line": null, "original_line...
2b6fb95ba46e712071282126e8fc693890bcd588
diff --git a/news/69a4dd1e-c03f-4780-ae6f-892f818fb367.trivial b/news/69a4dd1e-c03f-4780-ae6f-892f818fb367.trivial new file mode 100644 index 00000000000..e69de29bb2d diff --git a/src/pip/_internal/cli/req_command.py b/src/pip/_internal/cli/req_command.py index 29bbb8fe72d..0aa02ab1f9a 100644 --- a/src/pip/_internal/cl...
{ "difficulty": "medium", "estimated_review_effort": 4, "problem_domain": "Code Refactoring / Architectural Improvement" }
pydantic__pydantic-3349@052647e
pydantic/pydantic
Python
3,349
fix(PostgresDsn): Add support for multiple hosts in PostgresDsn #3337
## Change Summary Add support for multiple hosts validation in `PostgresDsn` class. Postgres supports multiple hosts in the DSN like: `postgres://user:pass@host1.db.net:4321,host2.db.net:6432/app`. The change keeps old PostgreDsn working for single host as it was before and introduces new attribute `hosts` to ke...
2021-10-24T00:19:29Z
PostgresDsn fails for multiple hosts Output of `python -c "import pydantic.utils; print(pydantic.utils.version_info())"`: ``` pydantic version: 1.8.2 pydantic compiled: False install path: /home/stupidhobbit/arc/arcadia/contrib/python/pydantic/pydantic python version: 3.9.7 (default, Oct 13 2021, 18:49:29) [Clang...
[ { "body": "Output of `python -c \"import pydantic.utils; print(pydantic.utils.version_info())\"`:\r\n```\r\npydantic version: 1.8.2\r\npydantic compiled: False\r\ninstall path: /home/stupidhobbit/arc/arcadia/contrib/python/pydantic/pydantic\r\npython version: 3.9.7 (default, Oct 13 2021, 18:49:29) [Clang 12.0....
5293adb3d3d1b6fcdb4e1ffc188a560fe601260c
{ "head_commit": "052647e1ad5e035cd78f039fe1ac76f6778471e7", "head_commit_message": "Reuse _host_regex in postgres_url_regex", "patch_to_review": "diff --git a/changes/3337-rglsk.md b/changes/3337-rglsk.md\nnew file mode 100644\nindex 00000000000..c0f2da37208\n--- /dev/null\n+++ b/changes/3337-rglsk.md\n@@ -0,0 +...
[ { "diff_hunk": "@@ -350,6 +397,98 @@ class PostgresDsn(AnyUrl):\n }\n user_required = True\n \n+ __slots__ = AnyUrl.__slots__ + ('hosts',)\n+\n+ def __init__(self, *args, hosts: Optional[List['HostParts']] = None, **kwargs):\n+ super().__init__(*args, **kwargs)\n+ self.hosts = hosts\...
9c0cc6e13a8499ca53921feea6a34daa68bf40e4
diff --git a/changes/3337-rglsk.md b/changes/3337-rglsk.md new file mode 100644 index 00000000000..c0f2da37208 --- /dev/null +++ b/changes/3337-rglsk.md @@ -0,0 +1 @@ +Support multi hosts validation in `PostgresDsn`. \ No newline at end of file diff --git a/docs/usage/types.md b/docs/usage/types.md index 15bb9f9cbb6..4...
{ "difficulty": "medium", "estimated_review_effort": 4, "problem_domain": "Bug Fixes" }
pydantic__pydantic-2119@8217f92
pydantic/pydantic
Python
2,119
fix: update all modified field values in `root_validator` when `validate_assignment` is on
<!-- Thank you for your contribution! --> <!-- Unless your change is trivial, please create an issue to discuss the change before creating a PR --> <!-- See https://pydantic-docs.helpmanual.io/contributing/ for help on Contributing --> ## Change Summary Following #1971 we now run `root_validator` on assignment wh...
2020-11-13T00:27:16Z
validate_assignment with side effect validators # Bug Output of `python -c "import pydantic.utils; print(pydantic.utils.version_info())"`: ``` pydantic version: 1.7.2 pydantic compiled: True install path: /home/arthur/Documents/odmantic/.venv/lib/python3.8/site-packages...
Hi @art049 Yes you're right. Since #1971 has been solved, this is the expected behaviour but it seems we update only the current field and not all. I can make a quick fix if you want should take couple of minutes
[ { "body": "# Bug\r\n\r\nOutput of `python -c \"import pydantic.utils; print(pydantic.utils.version_info())\"`:\r\n```\r\n pydantic version: 1.7.2\r\n pydantic compiled: True\r\n install path: /home/arthur/Documents/odmantic/.venv/lib/python3.8/site-packages/pydantic\r\n ...
31bc2435d7968fdf8d1f0c5c67f0f851c1bef54e
{ "head_commit": "8217f922042b3ca943b57ca806cb9e9e067cdae6", "head_commit_message": "fix: update all modified field values in `root_validator` when `validate_assignment` is on\n\ncloses #2116", "patch_to_review": "diff --git a/changes/2116-PrettyWood.md b/changes/2116-PrettyWood.md\nnew file mode 100644\nindex 00...
[ { "diff_hunk": "@@ -666,6 +666,28 @@ def current_lessequal_500(cls, values):\n ]\n \n \n+def test_root_validator_many_values_change():\n+ \"\"\"It should run root_validator on assignment and update ALL concerned fields\"\"\"\n+\n+ class Rectangle(BaseModel):\n+ width: float\n+ height: fl...
51ae3b386a5e3b8e71c9e59df68a5902d9f880a7
diff --git a/changes/2116-PrettyWood.md b/changes/2116-PrettyWood.md new file mode 100644 index 00000000000..d2c81cbf7f4 --- /dev/null +++ b/changes/2116-PrettyWood.md @@ -0,0 +1 @@ +fix: update all modified field values in `root_validator` when `validate_assignment` is on \ No newline at end of file diff --git a/pydan...
{ "difficulty": "medium", "estimated_review_effort": 3, "problem_domain": "Bug Fixes" }
pypa__pip-6864@173761c
pypa/pip
Python
6,864
Fix bypassed pip upgrade warning on Windows
Fixes #6841
2019-08-12T10:06:28Z
pip upgrade warning is bypassed when pip is a dependency Helping to debug a contributor setup issue at the PyCon AU sprints, we eventually tracked the problem down to: * briefcase needed a more recent pip * "pip install --upgrade briefcase" implicitly tried to upgrade pip, but had the usual Windows issues with tryi...
Yeah, the heuristics for working out when we're trying to use pip to upgrade itself aren't 100% reliable. I don't think anyone would object to improved detection of this case, but we don't know how to do it. Suggestions (and working code :slightly_smiling_face:) welcome, of course! Hmm... We're checking if "pip" is in ...
[ { "body": "Helping to debug a contributor setup issue at the PyCon AU sprints, we eventually tracked the problem down to:\r\n\r\n* briefcase needed a more recent pip\r\n* \"pip install --upgrade briefcase\" implicitly tried to upgrade pip, but had the usual Windows issues with trying to replace a running execut...
c4e45e9b89a4977512983a6ca9b8325ca101522d
{ "head_commit": "173761c03070db2795349f61b7c0229eb666b3ef", "head_commit_message": "Address review comments\n\nRebased to the latest master\nRemove unneeded assertions\nUse create_basic_wheel_for_package\nCouple other nitpicks", "patch_to_review": "diff --git a/news/6841.bugfix b/news/6841.bugfix\nnew file mode ...
[ { "diff_hunk": "@@ -1541,86 +1542,73 @@ def test_target_install_ignores_distutils_config_install_prefix(script):\n ])\n def test_protect_pip_from_modification_on_windows(script, pip_name):\n \"\"\"\n- Test ``pip install --upgrade pip`` is raised an error on Windows.\n+ Test that pip modification comma...
f9fc6673257c0cb8854e3df03f11c6ec91b5b8a8
diff --git a/news/6841.bugfix b/news/6841.bugfix new file mode 100644 index 00000000000..278caa64e54 --- /dev/null +++ b/news/6841.bugfix @@ -0,0 +1 @@ +Fix bypassed pip upgrade warning on Windows. diff --git a/src/pip/_internal/utils/misc.py b/src/pip/_internal/utils/misc.py index 576a25138ed..2a6735b7f4a 100644 --- a...
{ "difficulty": "medium", "estimated_review_effort": 3, "problem_domain": "Bug Fixes" }
pydantic__pydantic-2055@c7db59d
pydantic/pydantic
Python
2,055
Add two overload variants to `validate_arguments`
<!-- Thank you for your contribution! --> <!-- Unless your change is trivial, please create an issue to discuss the change before creating a PR --> <!-- See https://pydantic-docs.helpmanual.io/contributing/ for help on Contributing --> ## Change Summary Added two overload variants to `validate_arguments` for th...
2020-10-27T12:06:53Z
mypy "error: <nothing> not callable" when passing config to validate_arguments # Bug Output of `python -c "import pydantic.utils; print(pydantic.utils.version_info())"`: ``` pydantic version: 1.7 pydantic compiled: True install path: /home/brian/repos/medigator/venv/lib/...
[ { "body": "# Bug\r\n\r\nOutput of `python -c \"import pydantic.utils; print(pydantic.utils.version_info())\"`:\r\n```\r\n pydantic version: 1.7\r\n pydantic compiled: True\r\n install path: /home/brian/repos/medigator/venv/lib/python3.6/site-packages/pydantic\r\n ...
95435de4526b609ee904b7a27478cec2e32f8fe8
{ "head_commit": "c7db59db90f29eba76202ffbcf369ef2d4f2abac", "head_commit_message": "Add change file", "patch_to_review": "diff --git a/changes/2055-layday.md b/changes/2055-layday.md\nnew file mode 100644\nindex 00000000000..026555d6b60\n--- /dev/null\n+++ b/changes/2055-layday.md\n@@ -0,0 +1 @@\n+add two overlo...
[ { "diff_hunk": "@@ -0,0 +1 @@\n+add two overload variants to `validate_arguments` for the nested decorator signature", "line": null, "original_line": 1, "original_start_line": null, "path": "changes/2055-layday.md", "start_line": null, "text": "@user1:\nMaybe something more user oriented...
1f4d9a94c866e18370855ffd0752f3e4c9abe4a7
diff --git a/changes/2055-layday.md b/changes/2055-layday.md new file mode 100644 index 00000000000..04796051170 --- /dev/null +++ b/changes/2055-layday.md @@ -0,0 +1 @@ +fix annotation of `validate_arguments` when passing configuration as argument diff --git a/pydantic/decorator.py b/pydantic/decorator.py index 589baa...
{ "difficulty": "medium", "estimated_review_effort": 3, "problem_domain": "Bug Fixes" }
pydantic__pydantic-2183@8579183
pydantic/pydantic
Python
2,183
Feature/add anystr lower to config
<!-- Thank you for your contribution! --> <!-- Unless your change is trivial, please create an issue to discuss the change before creating a PR --> <!-- See https://pydantic-docs.helpmanual.io/contributing/ for help on Contributing --> ## Change Summary This change adds the anystr_lower field to the BaseConfig ...
2020-12-07T13:46:41Z
Adding "anystr_lower" to config # Feature Request Output of `python -c "import pydantic.utils; print(pydantic.utils.version_info())"`: ``` pydantic version: 1.6.1 pydantic compiled: True install path: *** python version: 3.8.0 (v3.8.0:fa919fdf25, Oct 14 2...
[ { "body": "# Feature Request\r\n\r\nOutput of `python -c \"import pydantic.utils; print(pydantic.utils.version_info())\"`:\r\n```\r\n pydantic version: 1.6.1\r\n pydantic compiled: True\r\n install path: ***\r\n python version: 3.8.0 (v3.8.0:fa919fdf25, Oct 1...
688107ec8e66f8da3bd1f97be6093a3cfab06a22
{ "head_commit": "8579183cc82e0538c2412e7fa820ccb54ee00e0b", "head_commit_message": "added unit tests for anystr_lower config", "patch_to_review": "diff --git a/changes/2134-tayoogunbiyi.md b/changes/2134-tayoogunbiyi.md\nnew file mode 100644\nindex 00000000000..2491250db7d\n--- /dev/null\n+++ b/changes/2134-tayo...
[ { "diff_hunk": "@@ -472,6 +476,13 @@ def constr_strip_whitespace(v: 'StrBytes', field: 'ModelField', config: 'BaseCon\n return v\n \n \n+def constr_lower(v: 'StrBytes', field: 'ModelField', config: 'BaseConfig') -> 'StrBytes':\n+ lower = field.type_.lower_str or config.anystr_lower\n+ if lower:\n+ ...
70ae2c08797196c9068a8f6e43c2ac272a185e04
diff --git a/changes/2134-tayoogunbiyi.md b/changes/2134-tayoogunbiyi.md new file mode 100644 index 00000000000..5779fc9db4b --- /dev/null +++ b/changes/2134-tayoogunbiyi.md @@ -0,0 +1 @@ +added `Config.anystr_lower` and `to_lower` kwarg to `constr` and `conbytes`. diff --git a/docs/examples/types_constrained.py b/docs...
{ "difficulty": "medium", "estimated_review_effort": 3, "problem_domain": "New Feature Additions" }
pypa__pip-6621@9294785
pypa/pip
Python
6,621
Add milliseconds to --log entry timestamps.
Resolves #6587. <!--- Thank you for your soon to be pull request. Before you submit this, please double check to make sure that you've added a news file fragment. In pip we generate our NEWS.rst from multiple news fragment files, and all pull requests require either a news file fragment or a marker to indicate t...
2019-06-16T18:56:52Z
Include milliseconds in pip log timestamps **What's the problem this feature will solve?** Currently (pip 19.1.1) when running `pip install --log example.log ...`, the log messages traced into `example.log` have timestamps that includes up to the second. For example: ``` 2019-06-09T22:29:08 Created temporary dir...
Makes sense. This should be easy to fix, by added `.%f` to the end of the format string we use and updating the corresponding tests to include milliseconds in the output (see #6142 for which tests are relevant). https://github.com/pypa/pip/blob/9c8b2ea759e5c7410eb46e91ec90b6bc9368bb93/src/pip/_internal/utils/logging...
[ { "body": "**What's the problem this feature will solve?**\r\n\r\nCurrently (pip 19.1.1) when running `pip install --log example.log ...`, the log messages traced into `example.log` have timestamps that includes up to the second. For example:\r\n\r\n```\r\n2019-06-09T22:29:08 Created temporary directory: /tmp/u...
82284073e744f9594a8f298f10034fa25589cecc
{ "head_commit": "9294785790743e23b793796081615ac5f284edd0", "head_commit_message": "Add milliseconds to --log entry timestamps.\n\nResolves #6587.", "patch_to_review": "diff --git a/news/6587.feature b/news/6587.feature\nnew file mode 100644\nindex 00000000000..d47c206d269\n--- /dev/null\n+++ b/news/6587.feature...
[ { "diff_hunk": "@@ -118,18 +122,32 @@ def get_message_start(self, formatted, levelno):\n \n return 'ERROR: '\n \n+ if PY2:\n+ # Compatibility with default_time_format and default_msec_format from\n+ # Python >= 3.3.\n+ default_msec_format = '%s,%03d'\n+\n+ def formatTime(s...
74d0fd3e33990ba876ca20e105bcca1a053d0547
diff --git a/news/6587.feature b/news/6587.feature new file mode 100644 index 00000000000..d47c206d269 --- /dev/null +++ b/news/6587.feature @@ -0,0 +1 @@ +Update timestamps in pip's ``--log`` file to include milliseconds. diff --git a/src/pip/_internal/utils/logging.py b/src/pip/_internal/utils/logging.py index a28e88...
{ "difficulty": "medium", "estimated_review_effort": 2, "problem_domain": "New Feature Additions" }
pypa__pip-6450@6448bb0
pypa/pip
Python
6,450
Add --path to pip freeze to support --target installations
`pip freeze` does not support installations in a target directory. This change adds the `--path` argument to `pip freeze` to enable this functionality. Closes: #6404
2019-04-27T16:29:21Z
Support --target installations with pip freeze **What's the problem this feature will solve?** <!-- What are you trying to do, that you are unable to achieve with pip as it currently stands? --> List all dependencies with `pip freeze` which have been installed into an arbitrary directory with `pip install --target`. ...
[ { "body": "**What's the problem this feature will solve?**\r\n<!-- What are you trying to do, that you are unable to achieve with pip as it currently stands? -->\r\nList all dependencies with `pip freeze` which have been installed into an arbitrary directory with `pip install --target`.\r\n\r\n**Describe the so...
ba539093754bc96dcdb7f4a48911deffcbcc8725
{ "head_commit": "6448bb05507a9f0404b3323f2d02007c91e76222", "head_commit_message": "Add support for --path in pip freeze", "patch_to_review": "diff --git a/news/6404.feature b/news/6404.feature\nnew file mode 100644\nindex 00000000000..f2f1db58bd1\n--- /dev/null\n+++ b/news/6404.feature\n@@ -0,0 +1,2 @@\n+Suppor...
[ { "diff_hunk": "@@ -56,6 +57,11 @@ def __init__(self, *args, **kw):\n action='store_true',\n default=False,\n help='Only output packages installed in user-site.')\n+ self.cmd_opts.add_option(\n+ '--path',\n+ dest='path',\n+ action='appe...
fcb4c3a51aee64a60264ff80b408f62b141eb998
diff --git a/news/6404.feature b/news/6404.feature new file mode 100644 index 00000000000..f3f6bae5539 --- /dev/null +++ b/news/6404.feature @@ -0,0 +1,2 @@ +Add a ``--path`` argument to ``pip freeze`` to support ``--target`` +installations. diff --git a/src/pip/_internal/commands/freeze.py b/src/pip/_internal/commands...
{ "difficulty": "medium", "estimated_review_effort": 3, "problem_domain": "New Feature Additions" }
pypa__pip-6491@91e106a
pypa/pip
Python
6,491
fix-5963: fail elegantly
Fail elegantly on on missing name or section in config set / unset Fixes #5963
2019-05-09T17:36:00Z
Setting config value with --venv flag fails outside venv **Environment** * pip version: b47b2fa8 * Python version: 3.7.0 * OS: Debian unstable I'm running inside a conda env, though that should not matter. **Description** Setting config value with `--venv` flag fails outside of a virtualenv: ``` Fatal I...
[ { "body": "**Environment**\r\n\r\n* pip version: b47b2fa8\r\n* Python version: 3.7.0\r\n* OS: Debian unstable\r\n\r\nI'm running inside a conda env, though that should not matter.\r\n\r\n**Description**\r\nSetting config value with `--venv` flag fails outside of a virtualenv:\r\n\r\n```\r\nFatal Internal error ...
9ab91a19ff1370b953a0f51ce3ac6cb3c40dd995
{ "head_commit": "91e106af5837a1876dc57f5a5975ba699e4905fd", "head_commit_message": "fix-5963: Add news file", "patch_to_review": "diff --git a/news/5963.bugfix b/news/5963.bugfix\nnew file mode 100644\nindex 00000000000..fcca0800a81\n--- /dev/null\n+++ b/news/5963.bugfix\n@@ -0,0 +1 @@\n+This change will fail el...
[ { "diff_hunk": "@@ -57,3 +57,6 @@ def test_listing_is_correct(self, script):\n \"\"\"\n \n assert lines == textwrap.dedent(expected).strip().splitlines()\n+\n+ def test_forget_section(self, script):\n+ script.pip(\"config\", \"set\", \"isolated\", \"true\", expect_error=True)", "li...
a8c72959341478d9390c1a861a97ded94f66ee4a
diff --git a/news/5963.bugfix b/news/5963.bugfix new file mode 100644 index 00000000000..60875b2e580 --- /dev/null +++ b/news/5963.bugfix @@ -0,0 +1 @@ +Fail elegantly when trying to set an incorrectly formatted key in config. diff --git a/src/pip/_internal/configuration.py b/src/pip/_internal/configuration.py index b1...
{ "difficulty": "medium", "estimated_review_effort": 2, "problem_domain": "Bug Fixes" }
pypa__pip-6225@370981f
pypa/pip
Python
6,225
Make failed uninstalls roll back more reliably and better at avoiding naming conflicts
Fixes #6194
2019-01-30T22:11:27Z
pip19.0.1 list error"AttributeError: _version" **Environment** * pip version:19.0.1 * Python version:3.7 * OS:MacOS <!-- Feel free to add more information about your environment here --> I update pip from 10.1 to 19.0.1, and I wanna check my python packages, I input "pip list" then two errors occurred. **Desc...
there seems to be completely broken metadata in your python installation - can you try to run pip in pdb and get the project name/location, perhaps the metadata folder to see whats messing things up? @zhouyu328 What's the output of the following command? ```bash find /usr/local/var/pyenv/versions/3.7.0/lib/python3.7/...
[ { "body": "**Environment**\r\n\r\n* pip version:19.0.1\r\n* Python version:3.7\r\n* OS:MacOS\r\n\r\n<!-- Feel free to add more information about your environment here -->\r\nI update pip from 10.1 to 19.0.1, and I wanna check my python packages, I input \"pip list\" then two errors occurred.\r\n**Description**\...
27880def83eac9e47ee61956818cc5eb81f1885e
{ "head_commit": "370981f96e9786556b2d25af24474e2845cac614", "head_commit_message": "Undo freeze fixes and fix existing tests", "patch_to_review": "diff --git a/news/6194.bugfix b/news/6194.bugfix\nnew file mode 100644\nindex 00000000000..146b0faa5d4\n--- /dev/null\n+++ b/news/6194.bugfix\n@@ -0,0 +1 @@\n+Make fa...
[ { "diff_hunk": "@@ -573,8 +573,9 @@ def names():\n assert not any(n == name for n in names())\n \n # Check the first group are correct\n- assert all(x == y for x, y in\n- zip(some_names, [c + name[1:] for c in chars]))\n+ for x, y in zip(some_names, ['~' + name[1:...
39031816260ed6343d6f3f08de5b16ae85ead61f
diff --git a/news/6194.bugfix b/news/6194.bugfix new file mode 100644 index 00000000000..146b0faa5d4 --- /dev/null +++ b/news/6194.bugfix @@ -0,0 +1 @@ +Make failed uninstalls roll back more reliably and better at avoiding naming conflicts. \ No newline at end of file diff --git a/src/pip/_internal/req/req_uninstall.py...
{ "difficulty": "medium", "estimated_review_effort": 3, "problem_domain": "Bug Fixes" }
pypa__pip-6142@6cb56ab
pypa/pip
Python
6,142
Prefix user_log (--log) entries with timestamp
Why? Eases post-facto analysis of time spent in different phases of pip operation. Historical note: https://github.com/pypa/pip/commit/767d11e49cb916e2d4637421d524efcb8d02ae8d#diff-b670e3b192038c9ffe810c1a12c0c51fL219 made it so that pip invocations emit zero timestamp information to the log file. Prior to that e...
2019-01-16T22:59:10Z
Time-stamp lines emitted to user_log. **What's the problem this feature will solve?** Enable post-facto analysis of pip operation running time. **Describe the solution you'd like** Prefix each line in the user_log (a.k.a. --log) with its timestamp. Example use-case: pip user notes installation of a package take...
@fischman You can disregard my previous message. I don't think this should be in pip's output by default. I'm okay with providing this functionality behind a flag. Agreed. This should not be in the default output - whether it needs a dedicated flag or can be enabled if verbose output is requested, I'm not too worried a...
[ { "body": "**What's the problem this feature will solve?**\r\nEnable post-facto analysis of pip operation running time.\r\n\r\n**Describe the solution you'd like**\r\nPrefix each line in the user_log (a.k.a. --log) with its timestamp.\r\n\r\nExample use-case: pip user notes installation of a package takes a lon...
35b1cc1c97fc69347ec4140660031a0ecfab0d1e
{ "head_commit": "6cb56ab2b07da40aac309912399554ad584a9e14", "head_commit_message": "Addressed 2nd round of @cjerdonek review comments, take 2 (missed a couple the first time around).", "patch_to_review": "diff --git a/news/6141.feature b/news/6141.feature\nnew file mode 100644\nindex 00000000000..991bf0f4252\n--...
[ { "diff_hunk": "@@ -44,15 +44,29 @@ def get_indentation():\n \n \n class IndentingFormatter(logging.Formatter):\n+ def __init__(self, *args, **kwargs):\n+ \"\"\"\n+ A logging.Formatter obeying containing indent_log contexts.\n+\n+ :param add_timestamp: A bool indicating output lines shou...
45de05366ea3d7a24d150e0410f4ce749cf2cf44
diff --git a/news/6141.feature b/news/6141.feature new file mode 100644 index 00000000000..de26edf7d78 --- /dev/null +++ b/news/6141.feature @@ -0,0 +1 @@ +Prefix pip's ``--log`` file lines with their timestamp. diff --git a/src/pip/_internal/utils/logging.py b/src/pip/_internal/utils/logging.py index d9b95414482..bc8b...
{ "difficulty": "medium", "estimated_review_effort": 3, "problem_domain": "New Feature Additions" }
pypa__pip-5971@ea1d5ac
pypa/pip
Python
5,971
Isolate, reuse PackageFinder best candidate logic
My take on #5175. This turns out to be more complicated than I imagined. I decided to make the outdated check follow how pip finds versions for requirements passed by the user: * If `allow_all_prereleases` is True, consider prereleases. (not applicable for self version check) * Try to find the latest stable version...
2018-10-30T21:12:39Z
pip 9 offers upgrades to prereleases * Pip version: 9.0.3 * Python version: 2.7.14 * Operating system: Ubuntu 17.10 ### Description: Any pip command says ``` You are using pip version 9.0.3, however version 10.0.0b2 is available. You should consider upgrading via the 'pip install --upgrade pip' command. `...
Thanks for reporting this! It's only likely to be an issue for a relatively short period (pip 10 final is due in just over a week) but it's good to have the problem recorded so that we can ensure it doesn't crop up for future betas. https://github.com/pypa/pip/blob/0007825733aa862e76a66e5d1cfee121c29192ff/src/pip/_inte...
[ { "body": "* Pip version: 9.0.3\r\n* Python version: 2.7.14\r\n* Operating system: Ubuntu 17.10\r\n\r\n### Description:\r\n\r\nAny pip command says\r\n\r\n```\r\nYou are using pip version 9.0.3, however version 10.0.0b2 is available.\r\nYou should consider upgrading via the 'pip install --upgrade pip' command.\...
54b6a91405adc79cdb8a2954e9614d6860799ccb
{ "head_commit": "ea1d5ac484cc635abf1f4dd3d5cb0ae6e1ae8f4e", "head_commit_message": "Isolate, reuse PackageFinder best candidate logic\n\nSplit out how PackageFinder finds the best candidate, and reuse it in the\nself version check, to avoid the latter duplicating (and incorrectly\nimplementing) the same logic.", ...
[ { "diff_hunk": "@@ -254,6 +255,63 @@ def _get_html_page(link, session=None):\n return None\n \n \n+class FoundCandidates(object):\n+ \"\"\"A collection of candidates, returned by `PackageFinder.find_candidates`.\n+\n+ Arguments:\n+\n+ * `candidates`: A sequence of all available candidates found.\n+...
2882042811bf4c3ed969f4d44149a07195cbca9e
diff --git a/news/5175.bugfix b/news/5175.bugfix new file mode 100644 index 00000000000..1ab90f4f35d --- /dev/null +++ b/news/5175.bugfix @@ -0,0 +1 @@ +Make pip's self version check avoid recommending upgrades to prereleases if the currently-installed version is stable. diff --git a/src/pip/_internal/index.py b/src/pi...
{ "difficulty": "medium", "estimated_review_effort": 3, "problem_domain": "Bug Fixes" }
pydantic__pydantic-1911@035b181
pydantic/pydantic
Python
1,911
Add `rediss` (Redis over SSL) protocol to `RedisDsn`
## Change Summary Added `rediss` to `RedisDsn.allowed_schemes`. ## Related issue number This PR closes #1877 ## Checklist * [x] Unit tests for the changes exist * [x] Tests pass on CI and coverage remains at 100% * [x] Documentation reflects the changes where applicable * [x] `changes/1911-TrDex.md` ...
2020-09-07T18:05:25Z
RedisDsn canot enable redis url with password and ssl schema `redis://:password@redishost` & `rediss://redis` are valid in redis.py, but cause ValidationError in RedisDsn. ``` In [7]: import redis In [8]: r = redis.StrictRedis.from_url('rediss://redis') In [9]: r = redis.StrictRedis.from_url('redis://:123@re...
[ { "body": "`redis://:password@redishost` & `rediss://redis` are valid in redis.py, but cause ValidationError in RedisDsn. \r\n\r\n```\r\nIn [7]: import redis\r\n\r\nIn [8]: r = redis.StrictRedis.from_url('rediss://redis')\r\n\r\nIn [9]: r = redis.StrictRedis.from_url('redis://:123@redis')\r\n\r\nIn [10]:\r\n```...
de0657e4a5495de9378db9fe15a17334c2b0fae5
{ "head_commit": "035b181c6438db9fa61004eb902ef80b187af4c0", "head_commit_message": "Allow URLs without `user` part\n\nRefer to #1877", "patch_to_review": "diff --git a/changes/1911-TrDex.md b/changes/1911-TrDex.md\nnew file mode 100644\nindex 00000000000..0885b029e81\n--- /dev/null\n+++ b/changes/1911-TrDex.md\n...
[ { "diff_hunk": "@@ -1,4 +1,4 @@\n-black==19.10b0\n+black==20.8b1", "line": null, "original_line": 1, "original_start_line": null, "path": "tests/requirements.txt", "start_line": null, "text": "@user1:\nbest not to change requirements in this PR." } ]
2dbbe5bab57888be5bf0fa5416273b06393c7c63
diff --git a/changes/1911-TrDex.md b/changes/1911-TrDex.md new file mode 100644 index 00000000000..99780228330 --- /dev/null +++ b/changes/1911-TrDex.md @@ -0,0 +1,2 @@ +Add `rediss` (Redis over SSL) protocol to `RedisDsn` +Allow URLs without `user` part (e.g., `rediss://:pass@localhost`) \ No newline at end of file di...
{ "difficulty": "low", "estimated_review_effort": 2, "problem_domain": "Bug Fixes" }
pypa__pip-5644@01a0fa5
pypa/pip
Python
5,644
Show appropriate error message
This catches code exception if wrong arguments passed to cmd options It also adds error message that suggests correct arguments to pass Fixes: https://github.com/pypa/pip/issues/5616 <!--- Thank you for your soon to be pull request. Before you submit this, please double check to make sure that you've added a n...
2018-07-23T15:37:29Z
Invalid values in boolean options in the environment cause traceback **Environment** * pip version: 10.0.1 * Python version: 3.6.6 * OS: Debian Unstable **Description** When setting an environment variable that is supposed to hold a boolean value to an invalid string that is not empty, a traceback happens. ...
Definitely a place where we can print a better error message. :) This issue is a good starting point for anyone who wants to help out with pip's development -- it's simple and the process of fixing this should be a good introduction to pip's development workflow. See the discussion above to understand what the desired ...
[ { "body": "**Environment**\r\n\r\n* pip version: 10.0.1\r\n* Python version: 3.6.6\r\n* OS: Debian Unstable\r\n\r\n**Description**\r\n\r\nWhen setting an environment variable that is supposed to hold a boolean value to an invalid string that is not empty, a traceback happens.\r\n\r\n**Expected behavior**\r\n\r\...
4e0cb5b01811b771cb5f7fce3f697f0d294284eb
{ "head_commit": "01a0fa5f049dbabdddb87ff76b9826c65cdcf181", "head_commit_message": "Show appropriate error message\n\nThis catches code exception if wrong arguments passed to cmd options\nIt also adds error message that suggests correct arguments to pass\n\nFixes: https://github.com/pypa/pip/issues/5616", "patch...
[ { "diff_hunk": "@@ -192,7 +192,17 @@ def _update_defaults(self, defaults):\n continue\n \n if option.action in ('store_true', 'store_false', 'count'):\n- val = strtobool(val)\n+ try:\n+ val = strtobool(val)\n+ except Val...
ad783151c5eb2ee32f5e6eb1451c51d8ae8d88ef
diff --git a/news/5644.bugfix b/news/5644.bugfix new file mode 100644 index 00000000000..39b72077266 --- /dev/null +++ b/news/5644.bugfix @@ -0,0 +1 @@ +Show a better error message when a configuration option has an invalid value. \ No newline at end of file diff --git a/src/pip/_internal/baseparser.py b/src/pip/_inter...
{ "difficulty": "medium", "estimated_review_effort": 3, "problem_domain": "Bug Fixes" }
pydantic__pydantic-1679@a701b3e
pydantic/pydantic
Python
1,679
Add private attributes support
<!-- Thank you for your contribution! --> <!-- Unless your change is trivial, please create an issue to discuss the change before creating a PR --> <!-- See https://pydantic-docs.helpmanual.io/contributing/ for help on Contributing --> ## Change Summary Private attributes declared as regular fields, but always st...
2020-07-02T17:54:10Z
Question: add private attribute I have a use case that I'd to add an attribute when initialising the instance which is not part of the model, thus should not be validated. Is that possible? Here's a practical example: ```py from pydantic import BaseModel from datetime import datetime class Test(BaseModel): ...
Yes, use underscore or `ClassVar`. This works, but it's not what I want, as every instance will have the same timestamp: ```py class TestExtra(BaseModel): a: int _procesed_at: datetime.utcnow() ``` This is what I want, but it fails with the same error: ```py class TestExtra(BaseModel): a: int ...
[ { "body": "I have a use case that I'd to add an attribute when initialising the instance which is not part of the model, thus should not be validated. Is that possible?\r\n\r\nHere's a practical example:\r\n\r\n```py\r\nfrom pydantic import BaseModel\r\nfrom datetime import datetime\r\n\r\nclass Test(BaseModel)...
5bfee873c8ab26b453cde59eaee4eca5b5a9eb7b
{ "head_commit": "a701b3e3dea80e19645acdd24c815e1c316c0291", "head_commit_message": "add # noqa: C901 (ignore complexity) to __setattr__\n(see comment in PR)", "patch_to_review": "diff --git a/changes/1679-MrMrRobat.txt b/changes/1679-MrMrRobat.txt\nnew file mode 100644\nindex 00000000000..8c6a2dc2ebf\n--- /dev...
[ { "diff_hunk": "@@ -123,6 +126,7 @@ class BaseConfig:\n json_loads: Callable[[str], Any] = json.loads\n json_dumps: Callable[..., str] = json.dumps\n json_encoders: Dict[Type[Any], AnyCallable] = {}\n+ underscore_attrs_are_private = False", "line": null, "original_line": 129, "origina...
104d600442e68180f578820a124c4608d06731e4
diff --git a/changes/1679-MrMrRobat.txt b/changes/1679-MrMrRobat.txt new file mode 100644 index 00000000000..8c6a2dc2ebf --- /dev/null +++ b/changes/1679-MrMrRobat.txt @@ -0,0 +1 @@ +Add private attributes support \ No newline at end of file diff --git a/docs/examples/private_attributes.py b/docs/examples/private_attri...
{ "difficulty": "medium", "estimated_review_effort": 4, "problem_domain": "New Feature Additions" }
pydantic__pydantic-1504@638daaa
pydantic/pydantic
Python
1,504
fix(field): remove some side effects of `default_factory`
<!-- Thank you for your contribution! --> <!-- Unless your change is trivial, please create an issue to discuss the change before creating a PR --> <!-- See https://pydantic-docs.helpmanual.io/contributing/ for help on Contributing --> ## Change Summary Fix some side effects of `default_factory`: - call it only ...
2020-05-11T06:37:45Z
`default_factory` being run prior to object init # Bug ``` pydantic version: 1.5.1 ``` `default_factory` gets run twice before any object instantiation. This is obvious for callables with side-effects: ```py >>> from pydantic import BaseModel, Field >>> class Seq(): ... def __init__(self)...
I'm not sure I would call this a bug. Since it'll be consistent, you should be able to just start with `v = -2` or whatever - I know it looks odd but as long as you include a comment I think it should be fine. I can't think of another safe workaround.
[ { "body": "# Bug\r\n\r\n```\r\n pydantic version: 1.5.1\r\n```\r\n\r\n`default_factory` gets run twice before any object instantiation. This is obvious for callables with side-effects:\r\n\r\n```py\r\n>>> from pydantic import BaseModel, Field\r\n>>> class Seq():\r\n... def __init__(self):\r\n......
f89e372bdaa03adec9ab8b04d167e97b00576e4b
{ "head_commit": "638daaaa0c1fa00575144b7c2c5355f28144b0af", "head_commit_message": "Avoid some side effects of default factory\n\n- by calling it only once if possible (fix #1491)\n- by not setting the default value in the schema (fix #1520)", "patch_to_review": "diff --git a/changes/1491-PrettyWood.md b/changes...
[ { "diff_hunk": "@@ -341,7 +341,14 @@ def prepare(self) -> None:\n Note: this method is **not** idempotent (because _type_analysis is not idempotent),\n e.g. calling it it multiple times may modify the field and configure it incorrectly.\n \"\"\"\n+\n+ # to prevent side effects by ...
fe533a0df26ce42ffd8ab0e0232f8348effa1f43
diff --git a/changes/1491-PrettyWood.md b/changes/1491-PrettyWood.md new file mode 100644 index 00000000000..a09bb0c87c0 --- /dev/null +++ b/changes/1491-PrettyWood.md @@ -0,0 +1,2 @@ +Avoid some side effects of `default_factory` by calling it only once +if possible and by not setting a default value in the schema diff...
{ "difficulty": "medium", "estimated_review_effort": 3, "problem_domain": "Bug Fixes" }
pydantic__pydantic-1560@c2116eb
pydantic/pydantic
Python
1,560
Change schema frozenset
<!-- Thank you for your contribution! --> <!-- Unless your change is trivial, please create an issue to discuss the change before creating a PR --> <!-- See https://pydantic-docs.helpmanual.io/contributing/ for help on Contributing --> ## Change Summary add one type(frozenset) to schema.py/field_class_to_schema ...
2020-05-26T08:41:17Z
add frozenset to schema.py/field_class_to_schema # Feature Request pydantic version: 1.5.1 pydantic compiled: False install path: /home/wang/PycharmProjects/FastApiLearn/venv/lib/python3.6/site-packages/pydantic python version: 3.6.5 (default, May 11 2018, ...
Could you fix your formatting in the issue? It would be useful to see a demonstration of the problem: e.g. code that raises an exception. I have added my exception. I meant a self contained example that demonstrates the problem. E.g.: ```py from pydantic import BaseModel ... ``` ``` from pydantic import ...
[ { "body": "# Feature Request\r\n\r\n pydantic version: 1.5.1\r\n pydantic compiled: False\r\n install path: /home/wang/PycharmProjects/FastApiLearn/venv/lib/python3.6/site-packages/pydantic\r\n python version: 3.6.5 (default, May 11 2018, 13:30:17) [GCC 7.3....
2eb62a3b2f2d345aa7b4625306331f68a7bc0fd5
{ "head_commit": "c2116eb462d94483e47df8270b460d9ab842d3ca", "head_commit_message": "add my test", "patch_to_review": "diff --git a/changes/1557-wangpeibao.md b/changes/1557-wangpeibao.md\nnew file mode 100644\nindex 00000000000..93eae4c0d11\n--- /dev/null\n+++ b/changes/1557-wangpeibao.md\n@@ -0,0 +1,2 @@\n+chan...
[ { "diff_hunk": "@@ -0,0 +1,3 @@\n+<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"/><title>未知 </title></head><body>", "line": null, "original_line": 1, "original_start_line": null, "path": "changes/index-1.html", "start_line": null, "text": "@user1:\nthi...
6e536486bb387dee8a51d314ff9cbd16b4141e2c
diff --git a/changes/1557-wangpeibao.md b/changes/1557-wangpeibao.md new file mode 100644 index 00000000000..f4aa9355c18 --- /dev/null +++ b/changes/1557-wangpeibao.md @@ -0,0 +1 @@ +change `schema.field_class_to_schema` to support `frozenset` in schema. diff --git a/pydantic/schema.py b/pydantic/schema.py index 3ca516...
{ "difficulty": "low", "estimated_review_effort": 3, "problem_domain": "New Feature Additions" }
pypa__pip-4199@0646c45
pypa/pip
Python
4,199
Fix Tests for Travis CI
Fixes #4198
2016-12-23T07:35:03Z
Travis CI - pypy broken dues to dependency change in pycrypto Currently the pypy build on Travis CI is broken since the latest paramiko (2.0) now depends on cryptography >= 1.1 which is incompatible with PyPy 2.5 which is used on Travis CI.
One way to fix this, would be to pin down paramiko to a version <2.0 using a version constraint.
[ { "body": "Currently the pypy build on Travis CI is broken since the latest paramiko (2.0) now depends on cryptography >= 1.1 which is incompatible with PyPy 2.5 which is used on Travis CI.", "number": 4198, "title": "Travis CI - pypy broken dues to dependency change in pycrypto" } ]
0999d91586e5483320210c0fd7d649b487f17aed
{ "head_commit": "0646c459a1e086baa8a2bdfcf96bd89707d72d90", "head_commit_message": "FIx Tests to pip paramiko", "patch_to_review": "diff --git a/tests/functional/test_install_reqs.py b/tests/functional/test_install_reqs.py\nindex c78a21786ea..f441f098b99 100644\n--- a/tests/functional/test_install_reqs.py\n+++ b...
[ { "diff_hunk": "@@ -171,7 +171,7 @@ def test_install_local_editable_with_extras(script, data):\n @pytest.mark.network\n def test_install_collected_dependencies_first(script):\n result = script.pip(\n- 'install', 'paramiko',\n+ 'install', 'paramiko==1.17',", "line": null, "original_line...
f3c872370ec342666fe96bccde2206906b39de27
diff --git a/tests/functional/test_install_reqs.py b/tests/functional/test_install_reqs.py index c78a21786ea..98d8b6bcd49 100644 --- a/tests/functional/test_install_reqs.py +++ b/tests/functional/test_install_reqs.py @@ -168,14 +168,13 @@ def test_install_local_editable_with_extras(script, data): assert script.sit...
{ "difficulty": "low", "estimated_review_effort": 2, "problem_domain": "Dependency Updates & Env Compatibility" }
pypa__pip-5419@cfa65e6
pypa/pip
Python
5,419
3905 pip version check cache dir
Fixes #3905 Changed rules on where pip version lock file selfcheck.json is stored. Previously, the lock file was either stored at ``USER_CACHE``/selfcheck.json, or for vitual enviorments it is stored at ``sys.prefix``\pip-selfcheck.json Now regardless of whether the user is in a virtual environment, the lock f...
2018-05-16T22:18:22Z
pip version check file doesn't honor cache-dir - Pip version: 7.1.0 - Python version: 2.7.6 - Operating System: Fedora 22 My pip config looks like: ``` [dev@machine ~] $ cat ~/.config/pip/pip.conf [global] cache-dir=/ssd/dev/.pip/cache ``` Whenever I try to install any package, it caches the wheels in the `cache-di...
I'm at PyCon sprints, researching this before making changes. I was able to recreate this issue using the latest pip (10.0.1) Looking in the code, I found that in `pip._internal.utils.outdated` there are two classes that write out the _selfcheck.json_ file. For users not in virtual environmnets `pip._inter...
[ { "body": "- Pip version: 7.1.0\n- Python version: 2.7.6\n- Operating System: Fedora 22\n\nMy pip config looks like:\n\n```\n[dev@machine ~] $ cat ~/.config/pip/pip.conf \n[global]\ncache-dir=/ssd/dev/.pip/cache\n```\n\nWhenever I try to install any package, it caches the wheels in the `cache-dir` as specified ...
60208552084ec16bf70b1d2913aed61cccdbe28d
{ "head_commit": "cfa65e68a469ffffd0f6a3172d0e1366280dc85d", "head_commit_message": "fix lint errors", "patch_to_review": "diff --git a/news/3905.bugfix b/news/3905.bugfix\nnew file mode 100644\nindex 00000000000..0c0c822192a\n--- /dev/null\n+++ b/news/3905.bugfix\n@@ -0,0 +1,8 @@\n+Changed rules on where pip ver...
[ { "diff_hunk": "@@ -21,34 +21,9 @@\n logger = logging.getLogger(__name__)\n \n \n-class VirtualenvSelfCheckState(object):\n- def __init__(self):\n- self.statefile_path = os.path.join(sys.prefix, \"pip-selfcheck.json\")\n-\n- # Load the existing state\n- try:\n- with open(self....
daae935450e5dacf1d63102207b3d3be82e8bfaf
diff --git a/news/3905.bugfix b/news/3905.bugfix new file mode 100644 index 00000000000..a719866fc9a --- /dev/null +++ b/news/3905.bugfix @@ -0,0 +1 @@ +Adjust path to selfcheck.json - remove virtualenv specific path and honor cache-dir in pip.conf diff --git a/src/pip/_internal/utils/outdated.py b/src/pip/_internal/ut...
{ "difficulty": "medium", "estimated_review_effort": 3, "problem_domain": "Dependency Updates & Env Compatibility" }
pydantic__pydantic-1527@837ab50
pydantic/pydantic
Python
1,527
Fix NameEmail equality comparison
## Change Summary Introducing an `__eq__` for `networks.NameEmail` as two similar instances were not being correctly evaluated as equal. ```python import pydantic # previously this would raise an AssertionError assert pydantic.NameEmail("test", "test@example.com") == pydantic.NameEmail("test", "test@example....
2020-05-18T16:10:24Z
Same NameEmail field instances are not equal # Bug Output of `python -c "import pydantic.utils; print(pydantic.utils.version_info())"`: ``` pydantic version: 1.5.1 pydantic compiled: True install path: /Users/***/.local/share/virtualenvs/tempenv-42b2286175873/lib/python3...
Thanks for reporting. Happy to accept a PR to add a proper `__eq__` method to `NameEmail`
[ { "body": "# Bug\r\n\r\nOutput of `python -c \"import pydantic.utils; print(pydantic.utils.version_info())\"`:\r\n```\r\n pydantic version: 1.5.1\r\n pydantic compiled: True\r\n install path: /Users/***/.local/share/virtualenvs/tempenv-42b2286175873/lib/python3.7/site-pack...
5067508eca6222b9315b1e38a30ddc975dee05e7
{ "head_commit": "837ab50b6aee73e1e7ea3a70b048068d252e803d", "head_commit_message": "Adding change doc for NameEmail.__eq__\n\nSigned-off-by: Stephen Bunn <stephen@bunn.io>", "patch_to_review": "diff --git a/changes/1514-stephen-bunn.md b/changes/1514-stephen-bunn.md\nnew file mode 100644\nindex 00000000000..47f9...
[ { "diff_hunk": "@@ -329,6 +329,12 @@ def __init__(self, name: str, email: str):\n self.name = name\n self.email = email\n \n+ def __eq__(self, other: Any) -> bool:\n+ if isinstance(other, NameEmail):\n+ return (self.name, self.email,) == (other.name, other.email,)\n+ ...
9637c9c1c9d0e0cd963714a53855ce7d4b519146
diff --git a/changes/1514-stephen-bunn.md b/changes/1514-stephen-bunn.md new file mode 100644 index 00000000000..47f99d1cf5b --- /dev/null +++ b/changes/1514-stephen-bunn.md @@ -0,0 +1 @@ +Add `NameEmail.__eq__` so duplicate `NameEmail` instances are evaluated as equal. \ No newline at end of file diff --git a/pydantic...
{ "difficulty": "low", "estimated_review_effort": 2, "problem_domain": "Bug Fixes" }
py-pdf__pypdf-2874@5cd90f2
py-pdf/pypdf
Python
2,874
MAINT: Add tests to source distributions
closes #2864
2024-09-27T05:24:03Z
Please include tests in pypi distfile ## Explanation I'm packaging pypdf for pkgsrc. We have standardized on using the pypi source tar.gz files. When updating packages, I like to run the test suite to make sure the software works fine. The tests are currently not included, please include them in the pypi source fi...
Thanks for the report - I honestly have not been aware that we are not even distributing the tests itself in our sdists. Nevertheless, I am not sure what would be the best approach here either for the PDF files itself - these currently originate from the repository itself (11.3 MB), the *sample-files* repository (14.5 ...
[ { "body": "## Explanation\r\n\r\nI'm packaging pypdf for pkgsrc. We have standardized on using the pypi source tar.gz files.\r\nWhen updating packages, I like to run the test suite to make sure the software works fine.\r\nThe tests are currently not included, please include them in the pypi source file to allow...
762fc1f6cd1e0c1643f3831b483d49b433b94df3
{ "head_commit": "5cd90f2bfc7a01584dc02430a27cf467840db8bb", "head_commit_message": "add include", "patch_to_review": "diff --git a/pyproject.toml b/pyproject.toml\nindex 87175fd40..336a4106b 100644\n--- a/pyproject.toml\n+++ b/pyproject.toml\n@@ -61,7 +61,8 @@ tests_dir = \"tests/\"\n package = \"./pypdf\"\n \n...
[ { "diff_hunk": "@@ -62,6 +62,7 @@ package = \"./pypdf\"\n \n [tool.flit.sdist]\n exclude = [\".github/*\", \"docs/*\", \"sample-files/.github/*\", \"sample-files/.gitignore\", \"sample-files/.pre-commit-config.yaml\", \"requirements/*\", \".flake8\", \".gitignore\", \".gitmodules\", \".pylintrc\", \"tox.ini\",...
7a8aa37025c2a9142b68be147400409b5c2c2e96
diff --git a/pyproject.toml b/pyproject.toml index 87175fd40..1dbc3cb05 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -61,7 +61,8 @@ tests_dir = "tests/" package = "./pypdf" [tool.flit.sdist] -exclude = [".github/*", "docs/*", "resources/*", "sample-files/*", "sample-files/.github/*", "sample-files/.gitignore...
{ "difficulty": "low", "estimated_review_effort": 2, "problem_domain": "Test Suite / CI Enhancements" }
pypa__pip-5370@7648fe3
pypa/pip
Python
5,370
Added --prefer-binary flag.
Hi, I ran into #3785, and I need this feature, because c/cpp compilation is cumbersome, so if there is a wheel, even an old one (but still valid for the requirements), i'd rather use it than attempt to compile the source package. I can't use `--only-binary :all:`, because then python-only package that provide only ...
2018-05-05T00:00:29Z
Prefering wheel-based installation over source-based installation > @pfmoore said: > If we had a --prefer-binary option, that said "only use binaries, unless that means there are no candidates, in which case retry allowing source", I suspect many of my concerns that over-eager upgrading would result in breakage might b...
I agree. Binary (wheel-based) installations mostly "just-work". Plus, they are the preferred format for packaging and publishing to PyPI (at least from pip's point-of-view). I think that making it the default would catalyse the adoption of wheels (not sure if it's needed though). Even in the long term, this seems to b...
[ { "body": "> @pfmoore said:\n> If we had a --prefer-binary option, that said \"only use binaries, unless that means there are no candidates, in which case retry allowing source\", I suspect many of my concerns that over-eager upgrading would result in breakage might be alleviated.\n\nThis issue serves as a star...
ff578b8d235fb4f47fee0b75356640583562a0ae
{ "head_commit": "7648fe3be1b68ebda202ae0bc5c47496c5ced49f", "head_commit_message": "tests: Added tests for the --prefer-binary flag", "patch_to_review": "diff --git a/news/3785.feature b/news/3785.feature\nnew file mode 100644\nindex 00000000000..fa13f58a02c\n--- /dev/null\n+++ b/news/3785.feature\n@@ -0,0 +1 @@...
[ { "diff_hunk": "@@ -602,3 +602,55 @@ def test_download_exit_status_code_when_blank_requirements_file(script):\n \"\"\"\n script.scratch_path.join(\"blank.txt\").write(\"\\n\")\n script.pip('download', '-r', 'blank.txt')\n+\n+\n+def test_download_prefer_binary_when_tarball_higher_than_wheel(script, d...
7a77ca40114fcd420889ef5e19870544c55ca02e
diff --git a/news/3785.feature b/news/3785.feature new file mode 100644 index 00000000000..ca5463ec860 --- /dev/null +++ b/news/3785.feature @@ -0,0 +1 @@ +Introduce a new --prefer-binary flag, to prefer older wheels over newer source packages. diff --git a/src/pip/_internal/basecommand.py b/src/pip/_internal/basecomma...
{ "difficulty": "medium", "estimated_review_effort": 3, "problem_domain": "New Feature Additions" }
pypa__pip-5339@d2853be
pypa/pip
Python
5,339
Remove username/password from log message
Sanitize the output of the "Looking in indexes:" log message (added in https://github.com/pypa/pip/pull/4483) to remove the username/password for basic authentication if configured. Currently, when using a basic authentication-protected index/repository, the username/password is printed to stdout during a `pip insta...
2018-04-27T05:06:57Z
index-url password is displayed on pip install. * Pip version: 10.0.0 * Python version: 2.7.14 * Operating system: macOS ### Description: When **index-url** is set (with either `--index-url` or `--extra-index-url`) with user credentials, the password is displayed each time pip is used. This is clearly a securit...
Also happens if you have `index-url` set in `~/.pip/pip.conf`. @pfmoore thoughts on this? This happened as a part of #4483. I can whip up a PR to strip the username/password when printing the URIs as a quick fix; thoughts? Or make it conditional to verbosity. I think hiding this behind verbosity and deferring to #47...
[ { "body": "* Pip version: 10.0.0\r\n* Python version: 2.7.14\r\n* Operating system: macOS\r\n\r\n### Description:\r\n\r\nWhen **index-url** is set (with either `--index-url` or `--extra-index-url`) with user credentials, the password is displayed each time pip is used. This is clearly a security issue, before p...
e1abd23865770505c5e6394be4c5df928bd92129
{ "head_commit": "d2853be974d2a6b15e837790ffe36c5768031ed4", "head_commit_message": "add news fragment file", "patch_to_review": "diff --git a/news/5249.bugfix b/news/5249.bugfix\nnew file mode 100644\nindex 00000000000..32f8a972180\n--- /dev/null\n+++ b/news/5249.bugfix\n@@ -0,0 +1 @@\n+Remove username/password ...
[ { "diff_hunk": "@@ -624,3 +625,29 @@ def test_call_subprocess_works_okay_when_just_given_nothing():\n def test_call_subprocess_closes_stdin():\n with pytest.raises(InstallationError):\n call_subprocess([sys.executable, '-c', 'input()'])\n+\n+\n+def test_remove_auth_from_url():", "line": null, ...
96dd6de889bd1fa9d9dbcddbae660924cd63a134
diff --git a/news/5249.bugfix b/news/5249.bugfix new file mode 100644 index 00000000000..32f8a972180 --- /dev/null +++ b/news/5249.bugfix @@ -0,0 +1 @@ +Remove username/password from log message when using index with basic auth diff --git a/src/pip/_internal/index.py b/src/pip/_internal/index.py index 3c3a92b7c1a..e85c...
{ "difficulty": "medium", "estimated_review_effort": 2, "problem_domain": "Security Patches / Vulnerability Fixes" }
pydantic__pydantic-1178@5255710
pydantic/pydantic
Python
1,178
change alias priority logic
## Change Summary This changes the priority of aliases to fix #1177, however it introduces a potential breaking change. For example: https://github.com/samuelcolvin/pydantic/blob/80152f337191ba7539e077c02a236bb713fdddd2/tests/test_aliases.py#L189-L204 before `alias_generator` on the child would take taken p...
2020-01-19T13:35:37Z
alias_generator used instead of field's alias on inheritance # Bug When `alias` is specified on a field for a class where `alias_generator` is also defined, `alias` is respected for that class but not any derived classes. Output of `python -c "import pydantic.utils; print(pydantic.utils.version_info())"`: ```pyt...
[ { "body": "# Bug\r\n\r\nWhen `alias` is specified on a field for a class where `alias_generator` is also defined, `alias` is respected for that class but not any derived classes.\r\n\r\nOutput of `python -c \"import pydantic.utils; print(pydantic.utils.version_info())\"`:\r\n```python\r\n pydantic v...
b7c0dd5b16fe4a730dbb390851fde63334dba369
{ "head_commit": "525571043d9e70495ae598795dbc1618c9234f06", "head_commit_message": "remove debugs", "patch_to_review": "diff --git a/changes/1177-samuelcolvin.md b/changes/1177-samuelcolvin.md\nnew file mode 100644\nindex 00000000000..02972a0d4b6\n--- /dev/null\n+++ b/changes/1177-samuelcolvin.md\n@@ -0,0 +1 @@\...
[ { "diff_hunk": "@@ -73,14 +73,22 @@ class BaseConfig:\n \n @classmethod\n def get_field_info(cls, name: str) -> Dict[str, Any]:\n- field_info = cls.fields.get(name) or {}\n- if isinstance(field_info, str):\n- field_info = {'alias': field_info}\n- elif cls.alias_generator ...
3c56a9391186a68f666b1ccaf9b739717576227b
diff --git a/changes/1178-samuelcolvin.md b/changes/1178-samuelcolvin.md new file mode 100644 index 00000000000..2721a3d8126 --- /dev/null +++ b/changes/1178-samuelcolvin.md @@ -0,0 +1,3 @@ +**Breaking Change:** alias precedence logic changed so aliases on a field always take priority over +an alias from `alias_generat...
{ "difficulty": "medium", "estimated_review_effort": 4, "problem_domain": "Bug Fixes" }
pypa__pip-4493@5185056
pypa/pip
Python
4,493
Make uninstall less verbose
Closes #4229
2017-05-17T18:28:04Z
"pip uninstall" is too noisy * Pip version: 9.0.1 * Python version: 3.6.0 * Operating System: Arch Linux ### Description: `pip uninstall` is too noisy. It should list the package(s) and its directory/location, but instead it lists all the files in there: ``` % pip uninstall pip Uninstalling pip-9.0.1: ...
Agreed. `pip` should probably list just the directories and scripts it would remove, instead of *all* the files. Hello ! What do you think about this display ? ``` $ pip uninstall hypothesis Uninstalling hypothesis-3.5.0: Proceed (y/n)? y Successfully uninstalled hypothesis-3.5.0 ``` And we can get `v...
[ { "body": "* Pip version: 9.0.1\r\n* Python version: 3.6.0\r\n* Operating System: Arch Linux\r\n\r\n### Description:\r\n\r\n`pip uninstall` is too noisy.\r\n\r\nIt should list the package(s) and its directory/location, but instead it lists\r\nall the files in there:\r\n\r\n```\r\n% pip uninstall pip\r\nUninstal...
dbb5212aa64510164acfd1f9f64ee2bd0b159dd0
{ "head_commit": "51850563c798adb79e70d201633db4290a5c4268", "head_commit_message": ":art:", "patch_to_review": "diff --git a/news/4493.feature b/news/4493.feature\nnew file mode 100644\nindex 00000000000..78654bf836b\n--- /dev/null\n+++ b/news/4493.feature\n@@ -0,0 +1 @@\n+Make uninstall command less verbose by ...
[ { "diff_hunk": "@@ -131,60 +131,78 @@ def compact(self, paths):\n necessary to contain all paths in the set. If /a/path/ and\n /a/path/to/a/file.txt are both in the set, leave only the\n shorter path.\"\"\"\n+\n+ sep = os.path.sep\n short_paths = set()\n for path i...
32c302edad2b18f5c7a968bf99bec209913464a0
diff --git a/news/4493.feature b/news/4493.feature new file mode 100644 index 00000000000..78654bf836b --- /dev/null +++ b/news/4493.feature @@ -0,0 +1 @@ +Make uninstall command less verbose by default diff --git a/pip/commands/uninstall.py b/pip/commands/uninstall.py index 130bec9582e..d1bbc534560 100644 --- a/pip/co...
{ "difficulty": "medium", "estimated_review_effort": 2, "problem_domain": "Bug Fixes" }
pypa__pip-4402@6d4d186
pypa/pip
Python
4,402
Fixed issue #979
Fixes #979
2017-04-02T13:21:00Z
pip list verbose to show install locations Hello! Currently ` for i in $( pip-2.7 freeze | cut -d'=' -f1) ; do echo -n " $i " ; pip-2.7 show $i | grep Location | cut -d':' -f2 ; done ` does a somewhat okay job of showing which package is installed where; but it's already buggy (since there is no pip list without vers...
Another great -vv option would be to list the install date/time Now that `pip list` has a `columns` with a `Location` column, this could be quite easy to implement.
[ { "body": "Hello!\n\nCurrently `\nfor i in $( pip-2.7 freeze | cut -d'=' -f1) ; do echo -n \" $i \" ; pip-2.7 show $i | grep Location | cut -d':' -f2 ; done\n` does a somewhat okay job of showing which package is installed where; but it's already buggy (since there is no pip list without version numbers; the q...
76f823bfcd7fc00e75efe5fb9f6027aedd57c73d
{ "head_commit": "6d4d186acc0cfe09ab3c0721f4e5216962aba407", "head_commit_message": "Added a warning when both --verbose and --quiet options used simultaneously", "patch_to_review": "diff --git a/AUTHORS.txt b/AUTHORS.txt\nindex 7859b7c3109..a0c3d18bf2b 100644\n--- a/AUTHORS.txt\n+++ b/AUTHORS.txt\n@@ -172,6 +172...
[ { "diff_hunk": "@@ -105,6 +105,12 @@ def parse_args(self, args):\n def main(self, args):\n options, args = self.parse_args(args)\n \n+ if options.quiet and options.verbose:", "line": null, "original_line": 108, "original_start_line": null, "path": "pip/basecommand.py", "st...
45880ffaf6c076cef3d4dade77183a1cb25ea3c5
diff --git a/AUTHORS.txt b/AUTHORS.txt index 7859b7c3109..a0c3d18bf2b 100644 --- a/AUTHORS.txt +++ b/AUTHORS.txt @@ -172,6 +172,7 @@ Lincoln de Sousa <lincoln@comum.org> Lipis <lipiridis@gmail.com> Ludovic Gasc <gmludo@gmail.com> Luke Macken <lmacken@redhat.com> +Luo Jiebin <luo.jiebin@foxmail.com> Marc Abramowitz ...
{ "difficulty": "medium", "estimated_review_effort": 3, "problem_domain": "New Feature Additions" }
pydantic__pydantic-980@6dd6a77
pydantic/pydantic
Python
980
Feature/dataclass schema defaults
## Change Summary * Make use of default_factory lambda when creating pydantic fields * Add separate test for this kind of default * Add field for this kind of default in test_schema ## Related issue number Fixes #968 If fine and complete, lets discuss docs ## Checklist * [X] Unit tests for the changes ex...
2019-11-08T08:06:56Z
dataclass field doesn't change required schema # Bug Please complete: * OS: Mac OS * Python version `import sys; print(sys.version)`: **3.6.7** with dataclasses backport * Pydantic version `import pydantic; print(pydantic.VERSION)`: **1.0** It is known that `@pydantic.dataclasses.dataclass` doesn't fully mimic...
This isn't a bug, but a feature request. ```py class Config: fields = {"b": { "required": False}} ``` Wouldn't work on a normal model. I think what you want is better support for the `field()` function from dataclasses. If so, please describe exactly what parts of `field()` usage you'd like to support i...
[ { "body": "# Bug\r\n\r\nPlease complete:\r\n* OS: Mac OS\r\n* Python version `import sys; print(sys.version)`: **3.6.7** with dataclasses backport\r\n* Pydantic version `import pydantic; print(pydantic.VERSION)`: **1.0**\r\n\r\nIt is known that `@pydantic.dataclasses.dataclass` doesn't fully mimic the `BaseMode...
093474ae27d9e1737d6aa76bd6b75f3918acd2e2
{ "head_commit": "6dd6a77662409c6151de708f0f31ca88f38d2ac2", "head_commit_message": "add docs for dataclass default factory and basemodel access", "patch_to_review": "diff --git a/changes/968-ahirner.md b/changes/968-ahirner.md\nnew file mode 100644\nindex 00000000000..921f08c0539\n--- /dev/null\n+++ b/changes/96...
[ { "diff_hunk": "@@ -0,0 +1,12 @@\n+import dataclasses\n+from typing import List\n+from pydantic.dataclasses import dataclass\n+\n+@dataclass\n+class User:\n+ id: int\n+ name: str = 'John Doe'\n+ friends: List[int] = dataclasses.field(default_factory=lambda: [0])\n+\n+user = User(id='42')\n+print(user._...
7937304a12f39e2cc1222527a01f331b5a2e0bae
diff --git a/changes/968-ahirner.md b/changes/968-ahirner.md new file mode 100644 index 00000000000..921f08c0539 --- /dev/null +++ b/changes/968-ahirner.md @@ -0,0 +1 @@ +Add support for dataclasses default factory diff --git a/docs/examples/dataclasses_default_schema.py b/docs/examples/dataclasses_default_schema.py ne...
{ "difficulty": "medium", "estimated_review_effort": 3, "problem_domain": "Bug Fixes" }
pydantic__pydantic-958@1c66fc9
pydantic/pydantic
Python
958
Add support for mapping types as custom root
## Change Summary Modifies `parse_obj` and `MetaModel` to allow mapping types with a custom root. I needed this to address some of the feedback on #934 ## Related issue number Closes #908 ## Checklist * [x] Unit tests for the changes exist * [x] Tests pass on CI and coverage remains at 100% * [x] D...
2019-11-02T23:31:50Z
Allow dict like types to __root__ Hi @samuelcolvin , Thank you for this amazing library. I am using it with fastapi for defining input models. ``` "preview": { "9:16": { "thumbnail": "", "video": "" }, "16:9": { "thumbnail": "", "video": "" }, "1:1": { "thumbnail": "", "video": "" ...
If you want change the input data to confirm to a more conventional shape, you'd be best of with something like: ```py class ChildModel(BaseModel): thumbnail: str video: str class MainModel(BaseModel): __root__: Dict[str, ChildModel] ``` Then you'll need a validator to check the format of the ke...
[ { "body": "Hi @samuelcolvin , Thank you for this amazing library. I am using it with fastapi for defining input models.\r\n```\r\n\"preview\": {\r\n\t\t\"9:16\": {\r\n\t\t\t\"thumbnail\": \"\",\r\n\t\t\t\"video\": \"\"\r\n\t\t}, \"16:9\": {\r\n\t\t\t\"thumbnail\": \"\",\r\n\t\t\t\"video\": \"\"\r\n\t\t}, \"1:1\...
043186cfcd2d3f6223753f38b2140e3a94194e38
{ "head_commit": "1c66fc946464b95dda6a080e49f40e97e5af7d22", "head_commit_message": "Incorporate more feedback", "patch_to_review": "diff --git a/changes/958-dmontagu.md b/changes/958-dmontagu.md\nnew file mode 100644\nindex 00000000000..b5af62cccbf\n--- /dev/null\n+++ b/changes/958-dmontagu.md\n@@ -0,0 +1 @@\n+A...
[ { "diff_hunk": "@@ -918,6 +918,10 @@ class MyModel(BaseModel):\n \n assert MyModel.parse_obj(['a']).__root__ == ['a']\n assert MyModel.parse_obj({'__root__': ['a']}).__root__ == ['a']\n+ with pytest.raises(ValidationError, match='...'):\n+ MyModel.parse_obj({'__not_root__': ['a']})\n+ with ...
c6b4f349c6cf525e19165f3bcb42e65c96e369e0
diff --git a/changes/958-dmontagu.md b/changes/958-dmontagu.md new file mode 100644 index 00000000000..b5af62cccbf --- /dev/null +++ b/changes/958-dmontagu.md @@ -0,0 +1 @@ +Add support for mapping types for custom root models diff --git a/docs/examples/models_custom_root_field_parse_obj.py b/docs/examples/models_cust...
{ "difficulty": "medium", "estimated_review_effort": 4, "problem_domain": "New Feature Additions" }
pydantic__pydantic-1003@0868ff7
pydantic/pydantic
Python
1,003
Add exclude_none option
## Change Summary - Add `exclude_none` option to `dict()` and friends. The original issue talked about `skip_none`, but since all options are now in the `exclude_x` format, that is also what I've done. ## Related issue number Resolves #587 ## Checklist * [x] Unit tests for the changes exist * [x] Tes...
2019-11-17T15:20:52Z
add skip_none argument # Question / Feature Request Suppose that I have a class like this: ``` class Jake(BaseModel): foo: Optional[str] ``` When I serialize it, I only want to serialize optional values when they are not null. The `skip_defaults` flag does something _similar_ to what I am looking for ...
This behavior is actually **not** a bug (I found it a little confusing at first too) -- it is intended so that you can tell precisely which fields were set on the **specific object instance**, rather than taking the default value based on the class definition. (I've included an example below to show why this might be u...
[ { "body": "# Question / Feature Request \r\n\r\nSuppose that I have a class like this:\r\n\r\n```\r\nclass Jake(BaseModel):\r\n foo: Optional[str]\r\n```\r\n\r\nWhen I serialize it, I only want to serialize optional values when they are not null. The `skip_defaults` flag does something _similar_ to what I a...
c6e192db04cd777629f828e406156c27001adf83
{ "head_commit": "0868ff718a88259beb04979888891ef0ad295be7", "head_commit_message": "run formatter", "patch_to_review": "diff --git a/changes/587-niknetniko.md b/changes/587-niknetniko.md\nnew file mode 100644\nindex 00000000000..326960bb4f7\n--- /dev/null\n+++ b/changes/587-niknetniko.md\n@@ -0,0 +1 @@\n+Add `ex...
[ { "diff_hunk": "@@ -1303,3 +1303,89 @@ class MyModel(BaseModel):\n \n m = MyModel(foo={'x': 'a', 'y': None})\n assert m.foo == {'x': 'a', 'y': None}\n+\n+\n+def test_exclude_none_dict():\n+ class MyModel(BaseModel):\n+ a: Optional[int] = None\n+ b: int = 2\n+\n+ m = MyModel(a=5)\n+ ...
053678eafeaa87e66dc18459198680bd6fafcd11
diff --git a/changes/587-niknetniko.md b/changes/587-niknetniko.md new file mode 100644 index 00000000000..326960bb4f7 --- /dev/null +++ b/changes/587-niknetniko.md @@ -0,0 +1 @@ +Add `exclude_none` option to `dict()` and friends diff --git a/docs/usage/exporting_models.md b/docs/usage/exporting_models.md index 2fb8e1b...
{ "difficulty": "medium", "estimated_review_effort": 3, "problem_domain": "New Feature Additions" }
py-pdf__pypdf-2855@7994a83
py-pdf/pypdf
Python
2,855
BUG: tolerate truncated files and no warning when jumping startxref
closes #2853
2024-09-17T21:16:03Z
Handling of incomplete EOF markers I just stumbled upon a PDF sent by e-mail where the final `OF` of the EOF marker has been missing. Apparently, pdf.js and Evince are able to display it correctly, while *pypdf* fails. ## Environment Which environment were you using when you encountered the problem? ```bash $...
there is one extra point behind that I've detected : If the %%EOF is truncated/missing, pypdf searches further in the file. If the file is linearized or has been incrementally built, a full "section" may be ignored without warning.
[ { "body": "I just stumbled upon a PDF sent by e-mail where the final `OF` of the EOF marker has been missing. Apparently, pdf.js and Evince are able to display it correctly, while *pypdf* fails.\r\n\r\n## Environment\r\n\r\nWhich environment were you using when you encountered the problem?\r\n\r\n```bash\r\n$ p...
c00ec60318e9cfd280a6d383c7a97a222c4a254d
{ "head_commit": "7994a83da70215a21018f10e3b795c4075130355", "head_commit_message": "BUG: tolerate truncated files and no warning when jumping startxref\n\ncloses #2853", "patch_to_review": "diff --git a/pypdf/_reader.py b/pypdf/_reader.py\nindex 9948cbea3..8fc4573cb 100644\n--- a/pypdf/_reader.py\n+++ b/pypdf/_r...
[ { "diff_hunk": "@@ -649,7 +649,23 @@ def _find_eof_marker(self, stream: StreamType) -> None:\n \"\"\"\n HEADER_SIZE = 8 # to parse whole file, Header is e.g. '%PDF-1.6'\n line = b\"\"\n+ first = True\n while line[:5] != b\"%%EOF\":\n+ if line != b\"\" and first...
1511fbb6002519a1cb73f6bc9bf4c2820cb6c622
diff --git a/pypdf/_reader.py b/pypdf/_reader.py index 9948cbea3..08437476c 100644 --- a/pypdf/_reader.py +++ b/pypdf/_reader.py @@ -649,7 +649,23 @@ def _find_eof_marker(self, stream: StreamType) -> None: """ HEADER_SIZE = 8 # to parse whole file, Header is e.g. '%PDF-1.6' line = b"" + ...
{ "difficulty": "medium", "estimated_review_effort": 3, "problem_domain": "Bug Fixes" }
pydantic__pydantic-909@0d9ff1a
pydantic/pydantic
Python
909
get item type in get_annotation_from_field_info
## Change Summary modify `get_annotation_from_field_info` to look at sub-types of typing objects like `Union` or `List` and thus correctly apply validators. ## Related issue number fix #779 ## Checklist * [x] Unit tests for the changes exist * [ ] Tests pass on CI and coverage remains at 100% * [x] Doc...
2019-10-17T11:08:39Z
Optional fields loose some validation # Bug * OS: **Ubuntu 18.04** * Python version: **3.7.3** * Pydantic versions: **0.30(pypi), 1.0a1 (master)** Example code: ```py from pydantic import BaseModel, Schema from typing import Optional class MyModel(BaseModel): my_int: Optional[int] = Schema(..., ge=...
@vdwees I've traced the source of this issue to [this line](https://github.com/samuelcolvin/pydantic/blob/5015a7e48bc869adf99b78eb38075951549e9ea7/pydantic/schema.py#L833). The problem here is that `Optional[X]` is not considered by python to be a `type`. I definitely don't think the way it is currently handled is i...
[ { "body": "# Bug\r\n\r\n* OS: **Ubuntu 18.04**\r\n* Python version: **3.7.3**\r\n* Pydantic versions: **0.30(pypi), 1.0a1 (master)**\r\n\r\nExample code:\r\n\r\n```py\r\nfrom pydantic import BaseModel, Schema\r\nfrom typing import Optional\r\n\r\nclass MyModel(BaseModel):\r\n my_int: Optional[int] = Schema(....
78921da35353c9d875c01acde0dc2c6986810ab5
{ "head_commit": "0d9ff1a4980b15ad219a60732c5f8693520efdf1", "head_commit_message": "Merge branch 'master' into field-validator-fix", "patch_to_review": "diff --git a/changes/909-samuelcolvin.md b/changes/909-samuelcolvin.md\nnew file mode 100644\nindex 00000000000..8024b8295f4\n--- /dev/null\n+++ b/changes/909-s...
[ { "diff_hunk": "@@ -0,0 +1,16 @@\n+from pydantic import BaseModel, Field, PositiveInt\n+\n+try:\n+ # this won't works since PositiveInt takes precedence over the", "line": null, "original_line": 4, "original_start_line": null, "path": "docs/examples/unenforced_constraints.py", "start_line...
9a8a712c8616024530997bab8966bae6cc1402c5
diff --git a/changes/909-samuelcolvin.md b/changes/909-samuelcolvin.md new file mode 100644 index 00000000000..8024b8295f4 --- /dev/null +++ b/changes/909-samuelcolvin.md @@ -0,0 +1,2 @@ +Improve use of `Field` constraints on complex types, raise an error if constraints are not enforceable, +also support tuples with an...
{ "difficulty": "high", "estimated_review_effort": 4, "problem_domain": "Bug Fixes" }
pydantic__pydantic-898@18ae5a3
pydantic/pydantic
Python
898
modify behaviour of the construct method
## Change Summary Change `construct`, fix #897 ## Checklist * [x] Unit tests for the changes exist * [x] Tests pass on CI and coverage remains at 100% * [x] Documentation reflects the changes where applicable * [x] `changes/<pull request or issue id>-<github username>.md` file added describing change (se...
2019-10-15T10:51:27Z
Disable all validations # Question Please complete: * OS: Ubuntu 18.04 * Python version `import sys; print(sys.version)`: 3.7.3 (default, Apr 3 2019, 19:16:38) [GCC 8.0.1 20180414 (experimental) [trunk revision 259383]] * Pydantic version `import pydantic; print(pydantic.VERSION)`: 0.32.2 Hello anyone, It...
I am also very interested in this question, as in many cases in my code I *know* the values are correct and don't require validation. It would also be nice to have an API for initializing a model instance from known-valid inputs without needing to go through the various alias-lookups etc. In general though I wouldn'...
[ { "body": "# Question\r\n\r\nPlease complete:\r\n* OS: Ubuntu 18.04\r\n* Python version `import sys; print(sys.version)`:\r\n3.7.3 (default, Apr 3 2019, 19:16:38) \r\n[GCC 8.0.1 20180414 (experimental) [trunk revision 259383]]\r\n* Pydantic version `import pydantic; print(pydantic.VERSION)`: 0.32.2\r\n\r\nHell...
6b5adcc977a205d56bd8fc106ac2e6b3fd1104b4
{ "head_commit": "18ae5a3a7234a71f31ddfd61b8291f8cd5791f27", "head_commit_message": "modify behaviour of the construct method", "patch_to_review": "diff --git a/pydantic/main.py b/pydantic/main.py\nindex bf41ffb5d64..022874f4aec 100644\n--- a/pydantic/main.py\n+++ b/pydantic/main.py\n@@ -414,13 +414,16 @@ def fro...
[ { "diff_hunk": "@@ -414,13 +414,16 @@ def from_orm(cls: Type['Model'], obj: Any) -> 'Model':\n return m\n \n @classmethod\n- def construct(cls: Type['Model'], values: 'DictAny', fields_set: 'SetStr') -> 'Model':\n+ def construct(cls: Type['Model'], values: 'DictAny', fields_set: Optional['SetS...
974778398c620775064b3b7edeab55d8ee800ea6
diff --git a/changes/898-samuelcolvin.md b/changes/898-samuelcolvin.md new file mode 100644 index 00000000000..70e3728c188 --- /dev/null +++ b/changes/898-samuelcolvin.md @@ -0,0 +1 @@ +Change the signature of `Model.construct()` to be more user-friendly, document `construct()` usage. diff --git a/changes/907-ashears.m...
{ "difficulty": "medium", "estimated_review_effort": 3, "problem_domain": "Bug Fixes" }
py-pdf__pypdf-2505@73e42fd
py-pdf/pypdf
Python
2,505
BUG: Prevent recursive loop in some PDF files
closes #2474 analysis in #2477
2024-03-06T21:07:25Z
BUG: clean_forms function cause infinite looping if elt["/Resources"] have circular relation I have several PDF files from customers, and using remove_text can cause infinite looping. Upon investigation, I discovered a corner case where elt["/Resources"] has a circular relation, which can result in calling clean_forms(...
[ { "body": "I have several PDF files from customers, and using remove_text can cause infinite looping. Upon investigation, I discovered a corner case where elt[\"/Resources\"] has a circular relation, which can result in calling clean_forms(content, stack + [elt]) infinitely.\r\n\r\nI proposed keeping a memory v...
8ef399a15b9a6d0bb5f214b2824d43b3792c2c16
{ "head_commit": "73e42fdc106b1a1ec7e240cd9b861a6ff236b244", "head_commit_message": "Merge branch 'main' into iss2474", "patch_to_review": "diff --git a/pypdf/_writer.py b/pypdf/_writer.py\nindex f408b5161..b7ee25820 100644\n--- a/pypdf/_writer.py\n+++ b/pypdf/_writer.py\n@@ -1923,7 +1923,14 @@ def clean_forms(\n...
[ { "diff_hunk": "@@ -1923,7 +1923,14 @@ def clean_forms(\n elt: DictionaryObject, stack: List[DictionaryObject]\n ) -> Tuple[List[str], List[str]]:\n nonlocal to_delete\n- if elt in stack:\n+ # elt in recursive is a new contentstream object so we have to chec...
bd37bb6ddd1cef976215777c8b078725375ad144
diff --git a/pypdf/_writer.py b/pypdf/_writer.py index f408b5161..0a44ce625 100644 --- a/pypdf/_writer.py +++ b/pypdf/_writer.py @@ -1923,7 +1923,14 @@ def clean_forms( elt: DictionaryObject, stack: List[DictionaryObject] ) -> Tuple[List[str], List[str]]: nonlocal to_delete - ...
{ "difficulty": "medium", "estimated_review_effort": 3, "problem_domain": "Bug Fixes" }
pydantic__pydantic-490@996be3f
pydantic/pydantic
Python
490
Fix dict with extra keys
<!-- Thank you for your contribution! --> <!-- See https://pydantic-docs.helpmanual.io/#contributing-to-pydantic for help on Contributing --> <!-- Don't worry about making lots of commits on a pull request, they'll be squashed on merge anyway --> ## Change Summary This will fix key error that occurs when calling ...
2019-04-24T12:15:15Z
`.dict(by_alias=True)` throws an exception when trying to call with extra keys <!-- Questions, Feature Requests, and Bug Reports are all welcome --> <!-- delete as applicable: --> # Bug * OS: Mac OS * Python version: ``` 3.7.2 (default, Mar 19 2019, 17:39:18) [Clang 10.0.0 (clang-1000.11.45.5)] ``` * Pydan...
thanks for reporting, fix shouldn't be too hard. PR welcome or I'll fix in a week or so.
[ { "body": "<!-- Questions, Feature Requests, and Bug Reports are all welcome -->\r\n<!-- delete as applicable: -->\r\n# Bug\r\n\r\n* OS: Mac OS\r\n* Python version: \r\n```\r\n3.7.2 (default, Mar 19 2019, 17:39:18) \r\n[Clang 10.0.0 (clang-1000.11.45.5)]\r\n```\r\n* Pydantic version: 0.23\r\n\r\nI'm trying to u...
e5b8ec7750d7036d1bc16f9c6c58b521548b0de8
{ "head_commit": "996be3faa93439625a446736742ed696a360bce7", "head_commit_message": "Fix PR number", "patch_to_review": "diff --git a/HISTORY.rst b/HISTORY.rst\nindex dff3e4e5b6e..805c294a8b5 100644\n--- a/HISTORY.rst\n+++ b/HISTORY.rst\n@@ -6,6 +6,7 @@ History\n v0.25 (unreleased)\n ..................\n * Improv...
[ { "diff_hunk": "@@ -576,3 +576,15 @@ class MyModel(BaseModel):\n assert \"json\" in dir(m)\n assert \"attribute_a\" in dir(m)\n assert \"attribute_b\" in dir(m)\n+\n+\n+def test_dict_with_extra_keys():\n+ class MyModel(BaseModel):\n+ a: str = Schema(None, alias='alias_a')\n+\n+ clas...
692896a22af94a61753d125c17044b78bfd19064
diff --git a/HISTORY.rst b/HISTORY.rst index dff3e4e5b6e..805c294a8b5 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -6,6 +6,7 @@ History v0.25 (unreleased) .................. * Improve documentation on self-referencing models and annotations, #487 by @theenglishway +* fix ``.dict()`` with extra keys, #490 by @Jaewon...
{ "difficulty": "low", "estimated_review_effort": 2, "problem_domain": "Bug Fixes" }
pydantic__pydantic-518@e658834
pydantic/pydantic
Python
518
Fix __fields_set__ not using alias field names (#517)
fix #517 <!-- Thank you for your contribution! --> <!-- See https://pydantic-docs.helpmanual.io/#contributing-to-pydantic for help on Contributing --> <!-- Don't worry about making lots of commits on a pull request, they'll be squashed on merge anyway --> ## Change Summary Basically, instead of just setting ...
2019-05-12T04:44:25Z
.dict(skip_defaults=True) skips fields populated by alias <!-- Questions, Feature Requests, and Bug Reports are all welcome --> <!-- delete as applicable: --> # Bug For bugs/questions: * OS: Linux * Python version `import sys; print(sys.version)`: `3.7.3 (default, Mar 26 2019, 21:43:19) [GCC 8.2.1 20181127]` ...
After looking into it a bit, it looks like `.dict()` get's the values of the set fields from `__fields_set__`. `__fields_set__` doesn't contain the name of the field if it was set by the alias. E.g: ```py print(Foo().__values__) # {'a': 1} print(Foo().__fields_set__) # set() print(Foo(a=2).__values__) # {'a': ...
[ { "body": "<!-- Questions, Feature Requests, and Bug Reports are all welcome -->\r\n<!-- delete as applicable: -->\r\n# Bug\r\n\r\nFor bugs/questions:\r\n* OS: Linux\r\n* Python version `import sys; print(sys.version)`: `3.7.3 (default, Mar 26 2019, 21:43:19) [GCC 8.2.1 20181127]`\r\n\r\n* Pydantic version `imp...
9b98d14ff1c534b1f986755962c8cae5091a6a23
{ "head_commit": "e658834b5b1500fdc8c6770e8160a0c15149ac56", "head_commit_message": "Update HISTORY.rst", "patch_to_review": "diff --git a/HISTORY.rst b/HISTORY.rst\nindex 18cdfa118b1..8552e812681 100644\n--- a/HISTORY.rst\n+++ b/HISTORY.rst\n@@ -7,6 +7,7 @@ v0.26 (unreleased)\n ..................\n * fix to sche...
[ { "diff_hunk": "@@ -233,11 +233,7 @@ def __init__(self, **data: Any) -> None:\n self.__values__: Dict[str, Any] = {}\n self.__fields_set__: 'SetStr' = set()\n object.__setattr__(self, '__values__', self._process_values(data))\n- if self.__config__.extra is Extra.allow:\n- ...
d7e0b0c411530d7ed615d9af2cdc00201447e02f
diff --git a/HISTORY.rst b/HISTORY.rst index 0fa71573b79..a9a02c2b6c0 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -8,6 +8,8 @@ v0.26 (unreleased) * fix to schema generation for ``IPvAnyAddress``, ``IPvAnyInterface``, ``IPvAnyNetwork`` #498 by @pilosus * fix variable length tuples support, #495 by @pilosus * fix re...
{ "difficulty": "medium", "estimated_review_effort": 3, "problem_domain": "Bug Fixes" }
py-pdf__pypdf-1952@69377ca
py-pdf/pypdf
Python
1,952
BUG: Prevent updating page contents after merging page (stamping/watermarking)
add also over param in merge_page closes #1951 closes #1953
2023-07-08T17:03:11Z
Huge file produced when merging (watermarking/stamping) ## Environment Which environment were you using when you encountered the problem? ```bash $ python -m platform macOS-13.4.1-arm64-arm-64bit $ python -c "import pypdf;print(pypdf.__version__)" 3.12.0 ``` ## Explanation Good day! 1) Sometimes I...
@ucomru Do you have example files which we could use? I guess your real files are private, but maybe you can re-create one that is not? As a side-note: I've added this kind of use-case to https://github.com/py-pdf/benchmarks#watermarking-speed already and noticed that pdfrw is a lot faster + produces smaller results...
[ { "body": "## Environment\r\n\r\nWhich environment were you using when you encountered the problem?\r\n\r\n```bash\r\n$ python -m platform\r\nmacOS-13.4.1-arm64-arm-64bit\r\n\r\n$ python -c \"import pypdf;print(pypdf.__version__)\"\r\n3.12.0\r\n```\r\n\r\n## Explanation\r\n\r\nGood day!\r\n\r\n1) Sometimes I ne...
8753663ce2cf2344eaa9a4083ea66df2a1045439
{ "head_commit": "69377ca28b68265c57df5bc81895e734c3e49570", "head_commit_message": "Update docs/user/add-watermark.md\n\nCo-authored-by: Martin Thoma <info@martin-thoma.de>", "patch_to_review": "diff --git a/docs/user/add-watermark.md b/docs/user/add-watermark.md\nindex 4e1190156..7fd8e0d44 100644\n--- a/docs/us...
[ { "diff_hunk": "@@ -972,7 +977,9 @@ def replace_contents(\n # this will be fixed with the _add_object\n self[NameObject(PG.CONTENTS)] = content\n \n- def merge_page(self, page2: \"PageObject\", expand: bool = False) -> None:\n+ def merge_page(\n+ self, page2: \"PageO...
7efec4f5b321a6c94a16d3848a9c8254067da525
diff --git a/docs/user/add-watermark.md b/docs/user/add-watermark.md index 4e1190156..7fd8e0d44 100644 --- a/docs/user/add-watermark.md +++ b/docs/user/add-watermark.md @@ -4,80 +4,54 @@ Adding stamps or watermarks are two common ways to manipulate PDF files. A stamp is adding something on top of the document, a water...
{ "difficulty": "medium", "estimated_review_effort": 3, "problem_domain": "Bug Fixes" }
py-pdf__pypdf-2104@f1ccc8a
py-pdf/pypdf
Python
2,104
MAINT: Relax typing_extensions version
This relaxes the version of `typing_extensions` required by PyPDF as proposed in #1950. Please note that this change is not reflected in CI due to the reasons outlined in https://github.com/py-pdf/pypdf/issues/1950#issuecomment-1627387294, but I have tested it locally and some time ago on my fork of the project. ...
2023-08-21T10:54:22Z
Loosen dependency on typing-extensions ## Explanation `pypdf` currently depends on `typing_extensions>=3.10`. Is there any reason for this minimum version? Background: I am currently bound to using 3.7.4.3 to maintain compatibility with some other packages. Running the tests locally with `typing_extensions==3.7.4...
TypeAlias was the reason: https://github.com/py-pdf/pypdf/commit/84460f54aa4721db36452fe510f8063838e358d5 see https://github.com/py-pdf/pypdf/pull/1277 This appears to be wrong, as *TypeAlias* is being defined in https://github.com/python/typing_extensions/blob/3.7.4.3/typing_extensions/src_py3/typing_extensions.py#L20...
[ { "body": "## Explanation\r\n\r\n`pypdf` currently depends on `typing_extensions>=3.10`. Is there any reason for this minimum version?\r\n\r\nBackground: I am currently bound to using 3.7.4.3 to maintain compatibility with some other packages. Running the tests locally with `typing_extensions==3.7.4.3` does not...
89eb626a7a7e22937b9216e817f5882431196b24
{ "head_commit": "f1ccc8aa534bff2e94cbd43804b19e1ed8ee34f5", "head_commit_message": "MAINT: relax typing_extensions version", "patch_to_review": "diff --git a/pyproject.toml b/pyproject.toml\nindex efbf681b0..e75f78c22 100644\n--- a/pyproject.toml\n+++ b/pyproject.toml\n@@ -28,7 +28,7 @@ classifiers = [\n \"T...
[ { "diff_hunk": "@@ -28,7 +28,7 @@ classifiers = [\n \"Typing :: Typed\",\n ]\n dependencies = [\n- \"typing_extensions >= 3.10.0.0; python_version < '3.10'\",\n+ \"typing_extensions >= 3.7.4.2; python_version < '3.10'\",", "line": null, "original_line": 31, "original_start_line": null, ...
b54dcb11327b08c4b3f017c2eed1ff5d69365c5d
diff --git a/pyproject.toml b/pyproject.toml index efbf681b0..8af1ea4d9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -28,7 +28,7 @@ classifiers = [ "Typing :: Typed", ] dependencies = [ - "typing_extensions >= 3.10.0.0; python_version < '3.10'", + "typing_extensions >= 3.7.4.3; python_version < '3.1...
{ "difficulty": "low", "estimated_review_effort": 2, "problem_domain": "Dependency Updates & Env Compatibility" }
pydantic__pydantic-606@89e3a33
pydantic/pydantic
Python
606
fix __post_init__ cause infinite recursion in inheritance
## Change Summary - Move `_pydantic_post_init` into `_process_class`, so it can use the closure feature to capture parent scope `post_init_original` method. - Remove `__post_init_original__` and `__post_init_post_parse__` method. ## Related issue number It will resolve #536 ## Checklist * [x] Unit tests...
2019-06-20T04:24:13Z
Recursion issue with dataclass inheritance <!-- Questions, Feature Requests, and Bug Reports are all welcome --> <!-- delete as applicable: --> # Bug For bugs/questions: * OS: **Ubuntu 19.04** * Python version `3.7.3 (default, Mar 27 2019, 22:11:17) [GCC 7.3.0]` * Pydantic version `0.25` Where possible ple...
However, calling `super().__post_init_original__()` instead of `super().__post_init__()` does seem to work as expected. Is this intended behavior? maybe be possible to fix this, but I can't look into this right now. PR welcome if you can resolve it. pydantic will replace user's `__post_init__` to `_pydantic_post_i...
[ { "body": "<!-- Questions, Feature Requests, and Bug Reports are all welcome -->\r\n<!-- delete as applicable: -->\r\n# Bug\r\n\r\nFor bugs/questions:\r\n* OS: **Ubuntu 19.04**\r\n* Python version `3.7.3 (default, Mar 27 2019, 22:11:17) \r\n[GCC 7.3.0]`\r\n* Pydantic version `0.25`\r\n\r\nWhere possible please ...
dd44fda8a6f6eed961cd03ad1e70049e523cdb40
{ "head_commit": "89e3a33a70d69542af9345c07e7265558b2e326c", "head_commit_message": "update code quote", "patch_to_review": "diff --git a/HISTORY.rst b/HISTORY.rst\nindex e78c5558b3b..9e7911adb60 100644\n--- a/HISTORY.rst\n+++ b/HISTORY.rst\n@@ -3,6 +3,10 @@\n History\n -------\n \n+v0.30 (unreleased)\n+............
[ { "diff_hunk": "@@ -75,15 +63,23 @@ def _process_class(\n post_init_post_parse = getattr(_cls, '__post_init_post_parse__', None)\n if post_init_original and post_init_original.__name__ == '_pydantic_post_init':\n post_init_original = None\n+\n+ def _pydantic_post_init(instance: 'DataclassType...
30d19ba5227f45785a0275db60dcf5d650097f7d
diff --git a/HISTORY.rst b/HISTORY.rst index e78c5558b3b..a1efdeaad37 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -3,6 +3,10 @@ History ------- +v0.30 (unreleased) +.................. +* fix infinite recursion with dataclass inheritance and ``__post_init__``, #606 by @Hanaasagi + v0.29 (2019-06-19) ...............
{ "difficulty": "medium", "estimated_review_effort": 4, "problem_domain": "Bug Fixes" }
py-pdf__pypdf-2288@7393e1f
py-pdf/pypdf
Python
2,288
ROB: MissingWidth is IndirectObject
Fixes #2286
2023-11-09T11:27:25Z
TypeError while loading some documents, caused by _cmap.py, line 93 While using the library I'm getting the following error: `TypeError: unsupported operand type(s) for /: 'IndirectObject' and 'int'` ## Environment Which environment were you using when you encountered the problem? macOS-10.16-x86_64-i386-64bi...
@elhele can you in _cmap.py file, at the end of function `compute_space_width` (line460 normally) ``` if isinstance(sp_width,indirect_object): ## to be added sp_width = sp_width.get_object() ## to be added return sp_width ``` and check weither it fixes the error Hello @pubpub-zz thank ...
[ { "body": "While using the library I'm getting the following error:\r\n`TypeError: unsupported operand type(s) for /: 'IndirectObject' and 'int'`\r\n\r\n## Environment\r\n\r\nWhich environment were you using when you encountered the problem?\r\n\r\nmacOS-10.16-x86_64-i386-64bit\r\npypdf==3.17.0, crypt_provider=...
112bfabd73c2464eb3c969b6cc94138b44acffc5
{ "head_commit": "7393e1fe4bee27eee49cd95240f519dc6b643c31", "head_commit_message": "ROB: MissingWidth is IndirectObject", "patch_to_review": "diff --git a/pypdf/_cmap.py b/pypdf/_cmap.py\nindex 6392805be..8c75baa79 100644\n--- a/pypdf/_cmap.py\n+++ b/pypdf/_cmap.py\n@@ -6,7 +6,7 @@\n from ._codecs import adobe_g...
[ { "diff_hunk": "@@ -457,6 +457,17 @@ def compute_space_width(\n m += x\n cpt += 1\n sp_width = m / max(1, cpt) / 2\n+\n+ if isinstance(sp_width, IndirectObject):\n+ # According to\n+ # 'Table 122 - Entries common to all font descri...
c84f8411108eef59d3fb6ccb8a0996251332ecaf
diff --git a/pypdf/_cmap.py b/pypdf/_cmap.py index 6392805be..2706007c2 100644 --- a/pypdf/_cmap.py +++ b/pypdf/_cmap.py @@ -6,7 +6,7 @@ from ._codecs import adobe_glyphs, charset_encoding from ._utils import b_, logger_warning from .errors import PdfReadWarning -from .generic import DecodedStreamObject, DictionaryO...
{ "difficulty": "medium", "estimated_review_effort": 3, "problem_domain": "Bug Fixes" }
py-pdf__pypdf-2494@62b6fe1
py-pdf/pypdf
Python
2,494
ENH: add get_pages_from_field
closes #2452 requires #2493
2024-03-02T10:36:49Z
Getting the page number of a field ## Explanation I am trying to update each field of a PDF file with some data but I don't know which PageObject to use after getting the list of fields from the function PdfReader.get_field(). ## Code Example > How would your feature be used? (Remove this if it is not applicab...
Thanks for the remark. [The forms documentation](https://pypdf.readthedocs.io/en/latest/user/forms.html) should probably be expanded to explain the relationship between AcroForm and Annotations better. I'm not an exper there myself, but here is what I understood: ## AcroForm and Annotation `/AcroForm` is defined in...
[ { "body": "## Explanation\r\n\r\nI am trying to update each field of a PDF file with some data but I don't know which PageObject to use after getting the list of fields from the function PdfReader.get_field().\r\n\r\n## Code Example\r\n\r\n> How would your feature be used? (Remove this if it is not applicable.)...
f32a964884c86b68ffee28fb5176a21b06d6d4db
{ "head_commit": "62b6fe1a8ba48a3cad1c96028278daaeeae9ec96", "head_commit_message": "code + test", "patch_to_review": "diff --git a/pypdf/_reader.py b/pypdf/_reader.py\nindex a2ec36288..3dbd37265 100644\n--- a/pypdf/_reader.py\n+++ b/pypdf/_reader.py\n@@ -667,6 +667,75 @@ def indexed_key(k: str, fields: Dict[Any,...
[ { "diff_hunk": "@@ -667,6 +667,75 @@ def indexed_key(k: str, fields: Dict[Any, Any]) -> str:\n ff[indexed_key(cast(str, value[\"/T\"]), ff)] = value.get(\"/V\")\n return ff\n \n+ def get_pages_showing_field(\n+ self, field: Union[Field, PdfObject, IndirectObject]\n+ ) ->...
240f49d7f2697c115452e43a044ece50d66e3097
diff --git a/docs/user/forms.md b/docs/user/forms.md index f7336c518..7fb932813 100644 --- a/docs/user/forms.md +++ b/docs/user/forms.md @@ -50,7 +50,7 @@ PDF forms have a dual-nature approach about the fields: Inside it you could find (optional): - some global elements (Fonts, Resources,...) - - some global f...
{ "difficulty": "medium", "estimated_review_effort": 4, "problem_domain": "New Feature Additions" }
pydantic__pydantic-572@9096019
pydantic/pydantic
Python
572
Add support for JSON Schema with circular references in Python 3.7
<!-- Thank you for your contribution! --> <!-- See https://pydantic-docs.helpmanual.io/#contributing-to-pydantic for help on Contributing --> <!-- Don't worry about making lots of commits on a pull request, they'll be squashed on merge anyway --> ## Change Summary Add JSON Schema generation support for models w...
2019-06-03T14:36:49Z
Recursion error when generating schema <!-- Questions, Feature Requests, and Bug Reports are all welcome --> <!-- delete as applicable: --> # Bug For bugs/questions: * OS: **ubuntu 18.04** * Python version `import sys; print(sys.version)`: **3.7.3** * Pydantic version `import pydantic; print(pydantic.VERSION)`:...
I'm not sure what the correct behaviour would be here? Since the model is self referencing, the schema surely is infinitely recursive? @tiangolo do you have an idea about what to do here? Maybe just a more constructive error. Yes, it should be able to create the JSON Schema, assign an ID to it and then reference ...
[ { "body": "<!-- Questions, Feature Requests, and Bug Reports are all welcome -->\r\n<!-- delete as applicable: -->\r\n# Bug\r\n\r\nFor bugs/questions:\r\n* OS: **ubuntu 18.04**\r\n* Python version `import sys; print(sys.version)`: **3.7.3**\r\n* Pydantic version `import pydantic; print(pydantic.VERSION)`: **0.2...
9ffa311f8fd54ad2a5619477a0612f99c7bc7ae4
{ "head_commit": "9096019dbd404da645dccbfea94f415f523b3911", "head_commit_message": "Trigger Travis and others", "patch_to_review": "diff --git a/HISTORY.rst b/HISTORY.rst\nindex eb210788ca8..81214409896 100644\n--- a/HISTORY.rst\n+++ b/HISTORY.rst\n@@ -3,6 +3,10 @@\n History\n -------\n \n+v0.xx (xxxx-xx-xx)\n+....
[ { "diff_hunk": "@@ -376,20 +390,25 @@ def get_flat_models_from_field(field: Field) -> Set[Type['BaseModel']]:\n type ``Baz`` (also subclass of ``BaseModel``), the return value will be ``set([Foo, Bar, Baz])``.\n \n :param field: a Pydantic ``Field``\n+ :param known_models: used to solve circular refe...
35bd4c41ca7924561a3a8708fdae3b729c9f23df
diff --git a/HISTORY.rst b/HISTORY.rst index 96ed35a49bc..ab30c5223c8 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -5,6 +5,7 @@ History v0.28 (unreleased) .................. +* fix support for JSON Schema generation when using models with circular references in Python 3.7, #572 by @tiangolo * support ``__post_ini...
{ "difficulty": "high", "estimated_review_effort": 4, "problem_domain": "Bug Fixes" }
py-pdf__pypdf-1544@8feea5f
py-pdf/pypdf
Python
1,544
BUG: Fix error in cmap extraction
fixes #1533 and late #1091
2023-01-09T19:21:19Z
PyPDF2 throws exception during extract_text() I'm working on a script that is parsing PDF invoices and I'm getting exception during pdf reading. This happens only with a specific type of PDF coming from a tapwater utility service provider company. However, all PDFs from them are failed to be parsed with the same error....
At first glance, Looks like a duplicate of #1091 A PR and a fix is proposed can you try it Thanks! I've tried this [one](https://github.com/py-pdf/pypdf/issues/1091#issuecomment-1371399505) and it seems to be working. However now there is an another issue: the returned text charset seems to be messed up a bit as Hungar...
[ { "body": "I'm working on a script that is parsing PDF invoices and I'm getting exception during pdf reading. This happens only with a specific type of PDF coming from a tapwater utility service provider company. However, all PDFs from them are failed to be parsed with the same error. \r\n\r\n## Environment\r\n...
e7e4ffc7e74fd3f1a191bc63527bee0d7986be1f
{ "head_commit": "8feea5fd35e627a0f5cf6ce235643d989895603f", "head_commit_message": "Merge remote-tracking branch 'py-pdf/main' into indexerr_cmap_1533", "patch_to_review": "diff --git a/pypdf/_cmap.py b/pypdf/_cmap.py\nindex 8c472f87d..bc85c7b4a 100644\n--- a/pypdf/_cmap.py\n+++ b/pypdf/_cmap.py\n@@ -280,13 +280...
[ { "diff_hunk": "@@ -102,3 +103,11 @@ def test_iss1379():\n name = \"02voc.pdf\"\n reader = PdfReader(BytesIO(get_pdf_from_url(url, name=name)))\n reader.pages[2].extract_text()\n+\n+\n+def test_iss1533():", "line": null, "original_line": 108, "original_start_line": 107, "path": "test...
753514d137b926385f301648055fc2c9b2df003e
diff --git a/pypdf/_cmap.py b/pypdf/_cmap.py index 8c472f87d..bc85c7b4a 100644 --- a/pypdf/_cmap.py +++ b/pypdf/_cmap.py @@ -280,13 +280,11 @@ def parse_bfrange( ) -> Union[None, Tuple[int, int]]: lst = [x for x in line.split(b" ") if x] closure_found = False - nbi = max(len(lst[0]), len(lst[1])) - map...
{ "difficulty": "medium", "estimated_review_effort": 3, "problem_domain": "Bug Fixes" }
python-pillow__Pillow-8085@773ff20
python-pillow/Pillow
Python
8,085
Added ImageDraw circle()
Resolves #8083 Implements the ImageDraw.circle feature as described and desired in the issue
2024-05-26T22:24:32Z
Missing ImageDraw.Draw.circle function ### What did you do? I find it frustrating that Pillow's ImageDraw does still not have a function to draw a circle. Every time I come around to do it, I find that I must use ImageDraw.Draw.ellipse instead, which costs time. It must be even more frustrating for beginners who don...
Sounds like a useful shortcut, would you like to propose a PR? Aye, https://github.com/python-pillow/Pillow/pull/8085
[ { "body": "### What did you do?\r\n\r\nI find it frustrating that Pillow's ImageDraw does still not have a function to draw a circle. Every time I come around to do it, I find that I must use ImageDraw.Draw.ellipse instead, which costs time. It must be even more frustrating for beginners who don't know more com...
8b14ed741a1c757734c65535ca1db4ab4162c843
{ "head_commit": "773ff20b762247a9fa717683f5e89349830def7e", "head_commit_message": "Update docs/reference/ImageDraw.rst - move circle method up to indicate it is new\n\nCo-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>", "patch_to_review": "diff --git a/docs/reference/ImageDraw.rst b/do...
[ { "diff_hunk": "@@ -181,6 +181,11 @@ def ellipse(self, xy: Coords, fill=None, outline=None, width=1) -> None:\n if ink is not None and ink != fill and width != 0:\n self.draw.draw_ellipse(xy, ink, 0, width)\n \n+ def circle(self, xy: Coords, radius, fill=None, outline=None, width=1) -> No...
3a34f44bcf77b9075e935b6e03bda794d45d2951
diff --git a/Tests/test_imagedraw.py b/Tests/test_imagedraw.py index 0a699e2ab6a..69d09e03d86 100644 --- a/Tests/test_imagedraw.py +++ b/Tests/test_imagedraw.py @@ -2,6 +2,7 @@ import contextlib import os.path +from typing import Sequence import pytest @@ -265,6 +266,21 @@ def test_chord_too_fat() -> None: ...
{ "difficulty": "medium", "estimated_review_effort": 2, "problem_domain": "New Feature Additions" }
python-pillow__Pillow-6935@5059e5c
python-pillow/Pillow
Python
6,935
Do not raise an error if os.environ does not contain PATH
Resolves #6934 https://github.com/python-pillow/Pillow/blob/7e3bed6834e639cd0f5a410abfd8224d4e5725c5/setup.py#L245-L249 presumes that `os.environ` contains a "PATH" key. This PR changes the code no longer raise an error if it doesn't.
2023-02-09T21:12:37Z
setup.py build fails without PATH ### What did you do? ``` $ env - python3.9 setup.py build ``` ### What did you expect to happen? The build succeeds. ### What actually happened? ```pytb $ env - python3.9 setup.py build ... (skipped many lines) ... writing manifest file 'src/Pillow.egg-info/SOURCES.txt' ...
I'm not sure that we can reasonably expect a build to work if there's no `PATH`? We have to be able to find compilers, linkers, and pkg-config. Are there any binary packages that build with this configuration? @radarhere, https://github.com/radarhere/Pillow/commit/02b976b6be75e3dfbdb48aa2730fecd20387716a fixed the ...
[ { "body": "### What did you do?\r\n```\r\n$ env - python3.9 setup.py build\r\n```\r\n### What did you expect to happen?\r\n\r\nThe build succeeds.\r\n\r\n### What actually happened?\r\n```pytb\r\n$ env - python3.9 setup.py build\r\n... (skipped many lines) ...\r\nwriting manifest file 'src/Pillow.egg-info/SOURC...
d2e77de070ccb0720caf2d2838a9f012a54e0309
{ "head_commit": "5059e5c143ee4b9e625163897a5610611a325bef", "head_commit_message": "Do not raise an error if os.environ does not contain PATH", "patch_to_review": "diff --git a/setup.py b/setup.py\nindex 8f7f223f8cd..0c8b390dec5 100755\n--- a/setup.py\n+++ b/setup.py\n@@ -243,6 +243,8 @@ def _find_include_dir(se...
[ { "diff_hunk": "@@ -243,6 +243,8 @@ def _find_include_dir(self, dirname, include):\n \n \n def _cmd_exists(cmd):\n+ if \"PATH\" not in os.environ:\n+ return", "line": null, "original_line": 247, "original_start_line": 245, "path": "setup.py", "start_line": null, "text": "@user1...
7670736e18026994d521e94a18f34feb194bd7e9
diff --git a/setup.py b/setup.py index 8f7f223f8cd..19bbf85981b 100755 --- a/setup.py +++ b/setup.py @@ -242,7 +242,9 @@ def _find_include_dir(self, dirname, include): return subdir -def _cmd_exists(cmd): +def _cmd_exists(cmd: str) -> bool: + if "PATH" not in os.environ: + return False r...
{ "difficulty": "low", "estimated_review_effort": 2, "problem_domain": "Bug Fixes" }
py-pdf__pypdf-1076@519a615
py-pdf/pypdf
Python
1,076
ROB: Handle outlines without destination
Adjust `PdfReader._build_outline(...)` and `PdfReader._build_destination(...)` to handle outline items with and without valid destinations Closes #193 : PdfReadError: Unexpected destination '/__WKANCHOR_2' Closes #956 : ValueError: Unresolved bookmark #1059 no longer throws an exception, but the outlines are not...
2022-07-08T18:40:07Z
PyPDF2.utils.PdfReadError: Unexpected destination '/__WKANCHOR_2' - PyPDF2 1.24 The exception occurs when building outline for a pdf generated by wkhtmltopdf. ```python from PyPDF2 import PdfFileMerger, PdfFileReader merger = PdfFileMerger() merger.append(PdfFileReader(file('test.pdf', 'rb'))) # Unexpected...
I had the same problem. For a quick and dirty fix I commented out the lines 1225 and 1226 in the file pdf.py of the package PyPDF2 which raise the exception: ``` # if destination found, then create outline if dest: if isinstance(dest, ArrayObject): outline = self._buildDestination(title, de...
[ { "body": "- PyPDF2 1.24\r\n\r\nThe exception occurs when building outline for a pdf generated by wkhtmltopdf. \r\n\r\n```python\r\nfrom PyPDF2 import PdfFileMerger, PdfFileReader\r\n\r\nmerger = PdfFileMerger()\r\nmerger.append(PdfFileReader(file('test.pdf', 'rb'))) # Unexpected destination\r\n\r\n_pdf = PdfF...
f233c1ad5adebe405e1184afa73442c92491aa8f
{ "head_commit": "519a615dd391606853caa70f6c9f000281203b59", "head_commit_message": "Merge branch 'main' into main", "patch_to_review": "diff --git a/PyPDF2/_merger.py b/PyPDF2/_merger.py\nindex 319a47ccd..69fbce90d 100644\n--- a/PyPDF2/_merger.py\n+++ b/PyPDF2/_merger.py\n@@ -540,8 +540,6 @@ def _associate_bookm...
[ { "diff_hunk": "@@ -807,15 +807,31 @@ def _build_destination(\n title: str,\n array: List[Union[NumberObject, IndirectObject, NullObject, DictionaryObject]],\n ) -> Destination:\n- page, typ = array[0:2]\n- array = array[2:]\n- try:\n- return Destination(title...
f0abf9de525d5d93d5f07e2277bbea4237abefe4
diff --git a/PyPDF2/_merger.py b/PyPDF2/_merger.py index 319a47ccd..69fbce90d 100644 --- a/PyPDF2/_merger.py +++ b/PyPDF2/_merger.py @@ -540,8 +540,6 @@ def _associate_bookmarks_to_pages( if pageno is not None: b[NameObject("/Page")] = NumberObject(pageno) - else: - ...
{ "difficulty": "medium", "estimated_review_effort": 4, "problem_domain": "Bug Fixes" }
py-pdf__pypdf-1346@0eb1660
py-pdf/pypdf
Python
1,346
ROB : update_page_form_field_values not failing if no fields
fixes #1343
2022-09-13T20:58:34Z
KeyError: '/Annots' in update_page_form_field_values I'm filling a PDF file with the update_page_form_field_values method but if the PDF file contains at least one page without a field a KeyError was thrown. ## Environment Which environment were you using when you encountered the problem? ```bash $ python -m ...
[ { "body": "I'm filling a PDF file with the update_page_form_field_values method but if the PDF file contains at least one page without a field a KeyError was thrown.\r\n\r\n## Environment\r\n\r\nWhich environment were you using when you encountered the problem?\r\n\r\n```bash\r\n$ python -m platform\r\nLinux-5....
e23b9854e419a66f5b1cba645372cb35be8d6053
{ "head_commit": "0eb16606b62a413116685cb680f5f9295579b439", "head_commit_message": "ROB : update_page_form_field_values not failing if no fields\n\nfixes #1343", "patch_to_review": "diff --git a/PyPDF2/_writer.py b/PyPDF2/_writer.py\nindex 942604f4e..6e2d1b8d6 100644\n--- a/PyPDF2/_writer.py\n+++ b/PyPDF2/_write...
[ { "diff_hunk": "@@ -622,6 +622,8 @@ def update_page_form_field_values(\n \"\"\"\n self.set_need_appearances_writer()\n # Iterate through pages, update field values\n+ if PG.ANNOTS not in page:\n+ return", "line": null, "original_line": 626, "original_start_l...
e48e821a38d461b4f4b574bdcc4748bdec90aa33
diff --git a/PyPDF2/_writer.py b/PyPDF2/_writer.py index 942604f4e..3eddd8b87 100644 --- a/PyPDF2/_writer.py +++ b/PyPDF2/_writer.py @@ -622,6 +622,9 @@ def update_page_form_field_values( """ self.set_need_appearances_writer() # Iterate through pages, update field values + if PG.ANNOTS...
{ "difficulty": "low", "estimated_review_effort": 2, "problem_domain": "Bug Fixes" }
python-pillow__Pillow-6954@0f2a4c1
python-pillow/Pillow
Python
6,954
Added "corners" argument to ImageDraw rounded_rectangle()
Resolves #6953, by adding a `corners` argument to `ImageDraw.rounded_rectangle` - a tuple of booleans for whether or not to round each corner, going clockwise, starting with top left and ending with bottom left.
2023-02-16T09:00:58Z
Add a corners parameter for `ImageDraw.rounded_rectangle`? ### What's your feature request? To add an optional bool tuple parameter (`corners=(True, True, True, True)`), or 4 optional bool parameters (`top_left=True, top_right=True, ...`) describing which corners of a rectangle should be rounded for `ImageDraw.rounde...
[ { "body": "### What's your feature request?\r\nTo add an optional bool tuple parameter (`corners=(True, True, True, True)`), or 4 optional bool parameters (`top_left=True, top_right=True, ...`) describing which corners of a rectangle should be rounded for `ImageDraw.rounded_rectangle` and possibly similar func...
d48dca3dc46947867e5f28d42ed2eb93f5b2e6ae
{ "head_commit": "0f2a4c1ae5d8492280af126dc7fda9eeef9b9d50", "head_commit_message": "Added \"corners\" argument to rounded_rectangle()", "patch_to_review": "diff --git a/Tests/images/imagedraw_rounded_rectangle_corners_nnnn.png b/Tests/images/imagedraw_rounded_rectangle_corners_nnnn.png\nnew file mode 100644\nind...
[ { "diff_hunk": "@@ -296,15 +296,14 @@ def rectangle(self, xy, fill=None, outline=None, width=1):\n self.draw.draw_rectangle(xy, ink, 0, width)\n \n def rounded_rectangle(\n- self, xy, radius=0, fill=None, outline=None, width=1, corners=None\n+ self, xy, radius=0, fill=None, outline...
60208a325083579361eaecc6d388e265aa52bea6
diff --git a/Tests/images/imagedraw_rounded_rectangle_corners_nnnn.png b/Tests/images/imagedraw_rounded_rectangle_corners_nnnn.png new file mode 100644 index 00000000000..3e79e21aedb Binary files /dev/null and b/Tests/images/imagedraw_rounded_rectangle_corners_nnnn.png differ diff --git a/Tests/images/imagedraw_rounded...
{ "difficulty": "medium", "estimated_review_effort": 3, "problem_domain": "New Feature Additions" }
py-pdf__pypdf-1835@5a9f0ab
py-pdf/pypdf
Python
1,835
DOC: Expand file size explanations
Closes https://github.com/py-pdf/pypdf/issues/1786 Changing the viewboxes ("cropping") has no impact on file size Removing complete pages only has an impact if the connected resources are also removed
2023-05-07T04:46:44Z
Disproportionately large file sizes when trying to split large pdf's, output file size is disproportionately large. here is my code ``` def split(path, file_name=""): reader = PdfReader(open(path, 'br')) for (i, page) in enumerate(reader.pages): reader = PdfReader(open(path, 'br')) write...
Can you please provide the pdf file for analysis happens with multiple diferent files. but here is an example https://drive.google.com/file/d/1I4NiKaWQXnNwml8k6GDpdUP88KUbOeUU/view?usp=sharing @pubpub-zz I feel like we should extend pdfly to show more details on the size of the contents of a pdf file (images, attachm...
[ { "body": "when trying to split large pdf's, output file size is disproportionately large.\r\nhere is my code \r\n```\r\ndef split(path, file_name=\"\"):\r\n reader = PdfReader(open(path, 'br'))\r\n for (i, page) in enumerate(reader.pages):\r\n reader = PdfReader(open(path, 'br'))\r\n writer...
6fe1c307c7d19edca34b522ed6912bf4b620289c
{ "head_commit": "5a9f0abdf166af393149b4f3dca3dcece01cfa8f", "head_commit_message": "Update docs/user/file-size.md\n\nCo-authored-by: pubpub-zz <4083478+pubpub-zz@users.noreply.github.com>", "patch_to_review": "diff --git a/docs/user/file-size.md b/docs/user/file-size.md\nindex a7b2d3cc4..7748ce2aa 100644\n--- a/...
[ { "diff_hunk": "@@ -75,3 +75,10 @@ with open(\"out.pdf\", \"wb\") as f:\n \n Using this method, we have seen a reduction by 70% (from 11.8 MB to 3.5 MB)\n with a real PDF.\n+\n+## Removing Sources\n+\n+When a page is deleting (removed from page list), the source will persist(the data may be still be used somewh...
0a09538bf2162d372aa63b6ee168de85f4dc3ef8
diff --git a/docs/user/file-size.md b/docs/user/file-size.md index a7b2d3cc4..b87d3b16b 100644 --- a/docs/user/file-size.md +++ b/docs/user/file-size.md @@ -30,7 +30,7 @@ It depends on the PDF how well this works, but we have seen an 86% file reduction (from 5.7 MB to 0.8 MB) within a real PDF. -## Remove images +...
{ "difficulty": "low", "estimated_review_effort": 1, "problem_domain": "Performance Optimizations" }
py-pdf__pypdf-1201@1dc8f9e
py-pdf/pypdf
Python
1,201
MAINT: Introduce WrongPasswordError / FileNotDecryptedError / EmptyFileError
closes https://github.com/py-pdf/PyPDF2/issues/1200 # Story: - Would be good to have clearer distinction of some well defined errors (that we want to detect) from the generic `PdfReadError`: - WrongPasswordError - FileNotDecryptedError - EmptyFileError - This makes it cleaner for error catching and ...
2022-08-04T11:27:37Z
Clearer distinction of some well defined errors ## Explanation - Would be good to have clearer distinction of some well defined errors (that we want to detect) from the generic `PdfReadError`: - `WrongPasswordError` - `FileNotDecryptedError` - `EmptyFileError` - This makes it cleaner for error catchi...
[ { "body": "## Explanation\r\n\r\n- Would be good to have clearer distinction of some well defined errors (that we want to detect) from the generic `PdfReadError`:\r\n - `WrongPasswordError`\r\n - `FileNotDecryptedError`\r\n - `EmptyFileError`\r\n- This makes it cleaner for error catching and handling (...
4aa9ec9637c8a154d58bf3b49185df79dfbf8e12
{ "head_commit": "1dc8f9e146ec1fea2d77ff35da6722231c05e4fe", "head_commit_message": "address comment", "patch_to_review": "diff --git a/PyPDF2/_reader.py b/PyPDF2/_reader.py\nindex 03c5bac9e..d2a080611 100644\n--- a/PyPDF2/_reader.py\n+++ b/PyPDF2/_reader.py\n@@ -70,7 +70,8 @@\n from .constants import PageAttribu...
[ { "diff_hunk": "@@ -414,9 +414,8 @@ def test_get_page_mode(src, expected):\n \n \n def test_read_empty():\n- with pytest.raises(PdfReadError) as exc:\n+ with pytest.raises(EmptyFileError):\n PdfReader(io.BytesIO())\n- assert exc.value.args[0] == \"Cannot read an empty file\"", "line": 419, ...
1e53be0b8fab3fa2e55d56e1d9c0fe09b828643a
diff --git a/PyPDF2/_reader.py b/PyPDF2/_reader.py index 03c5bac9e..d2a080611 100644 --- a/PyPDF2/_reader.py +++ b/PyPDF2/_reader.py @@ -70,7 +70,8 @@ from .constants import PageAttributes as PG from .constants import PagesAttributes as PA from .constants import TrailerKeys as TK -from .errors import PdfReadError, P...
{ "difficulty": "low", "estimated_review_effort": 2, "problem_domain": "New Feature Additions" }
py-pdf__pypdf-1193@8ffda32
py-pdf/pypdf
Python
1,193
ENH: "with" support for PdfMerger and PdfWriter
Closes #1108 Closes #1117 Co-authored-by: JianzhengLuo <jianzheng.luo.china@gmail.com>
2022-08-01T16:50:45Z
Add `with ... as ...` Usage to `PdfMerger()` ## Explanation As I need to call `write()` and `close()` in `PdfMerger()`, why not add `__enter__` and `__exit__` method to it so I can use it more elegantly. ## Code Example ```python3 from PyPDF2 import PdfMerger with PdfMerger(strict=False) as merger: f...
I like the idea! Do you want to create a pr? I'd like so, but as a middle school student in China, I am still busy even in summer vacation, but I will try my BEST! I noticed that `write()` is also necessary, and it has a parameter called `fileobj`, so I decided to add `fileobj` to the class initialization, now the cod...
[ { "body": "## Explanation\r\n\r\nAs I need to call `write()` and `close()` in `PdfMerger()`, why not add `__enter__` and `__exit__` method to it so I can use it more elegantly.\r\n\r\n## Code Example\r\n\r\n```python3\r\nfrom PyPDF2 import PdfMerger\r\n\r\nwith PdfMerger(strict=False) as merger:\r\n for nam...
0a6676fe064837222d391a7c73c7b0f3df782ac1
{ "head_commit": "8ffda32dd2456f931d24274bb5c5f7b04a458bc6", "head_commit_message": "Add JianzhengLuo to contributors list", "patch_to_review": "diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md\nindex 28d3d9b8d..23f1ee1a7 100644\n--- a/CONTRIBUTORS.md\n+++ b/CONTRIBUTORS.md\n@@ -11,6 +11,7 @@ history and [GitHubs '...
[ { "diff_hunk": "@@ -84,18 +95,38 @@ class PdfMerger:\n :param bool strict: Determines whether user should be warned of all\n problems and also causes some correctable problems to be fatal.\n Defaults to ``False``.\n+ :param fileobj: Output file. Can be a filename or any kind of\n+...
5464bd00bdaeed7b26e723f5e58d0d84a35d05b5
diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 28d3d9b8d..23f1ee1a7 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -11,6 +11,7 @@ history and [GitHubs 'Contributors' feature](https://github.com/py-pdf/PyPDF2/gr ## Contributors to the pyPdf / PyPDF2 project +* [JianzhengLuo](https://github.com/Jianzhen...
{ "difficulty": "medium", "estimated_review_effort": 4, "problem_domain": "New Feature Additions" }
py-pdf__pypdf-1114@42cc11f
py-pdf/pypdf
Python
1,114
BUG: Make reader.get_fields also return dropdowns with options
Adding `/Opt` to the attributes list get_fields() will now add /Opt if it has it. For Combo Box /Ch it will list all of the available options in the drop down menu. Closes #391
2022-07-15T04:14:06Z
PdfReader.get_form_text_fields() not returning dropdown fields I have a pdf form with multiple Form-Fields in it. The function "getFormTextFields()" is only returning a dictionary without the dropdown-fields. The dictionary contains the information of all other fields, but the dropdown-fields are simply missing. ## ...
if you want to get all the values, instead of _.getFormTextFields()_ you can use the following method after opening the pdf file with _PyPDF2.PdfFileReader()_ : **.getFields()** - getFormTextFields() works as pdf form reader but doesn't read the drop down menus or tick boxes - whereas getFields() gets all t...
[ { "body": "I have a pdf form with multiple Form-Fields in it. The function \"getFormTextFields()\" is only returning a dictionary without the dropdown-fields. The dictionary contains the information of all other fields, but the dropdown-fields are simply missing.\r\n\r\n## Minimal Example\r\n\r\n```python\r\nfr...
e1f9772693b788deae6b0fcdcb5ff49577706549
{ "head_commit": "42cc11f4f5fc55c019d4f00bcb0f65a4c31c31c6", "head_commit_message": "removed garbage", "patch_to_review": "diff --git a/PyPDF2/constants.py b/PyPDF2/constants.py\nindex a195c22fe..0e0eddf1c 100644\n--- a/PyPDF2/constants.py\n+++ b/PyPDF2/constants.py\n@@ -302,6 +302,7 @@ class FieldDictionaryAttri...
[ { "diff_hunk": "@@ -302,6 +302,7 @@ class FieldDictionaryAttributes:\n V = \"/V\" # text string, optional\n DV = \"/DV\" # text string, optional\n AA = \"/AA\" # dictionary, optional\n+ Opt = \"/Opt\" # Options, Optional", "line": null, "original_line": 305, "original_start_line": ...
6eeba0459e3ecc1e93d3d935b899ce3a1686d7b9
diff --git a/PyPDF2/_reader.py b/PyPDF2/_reader.py index 15bb2e7c3..1ccdb9c77 100644 --- a/PyPDF2/_reader.py +++ b/PyPDF2/_reader.py @@ -65,7 +65,11 @@ from .constants import CatalogDictionary as CD from .constants import Core as CO from .constants import DocumentInformationAttributes as DI -from .constants import F...
{ "difficulty": "medium", "estimated_review_effort": 3, "problem_domain": "Bug Fixes" }
python-pillow__Pillow-6599@b12672a
python-pillow/Pillow
Python
6,599
Fix Renovate config
Fixes https://github.com/python-pillow/Pillow/issues/6598 Changes proposed in this pull request: * Follow on from https://github.com/python-pillow/Pillow/pull/6564#issuecomment-1251072604 * It can't parse "on the third day of the month" * Let's try "on the 3rd day of the month"
2022-09-19T14:10:03Z
Action Required: Fix Renovate Configuration There is an error with this repository's Renovate configuration that needs to be fixed. As a precaution, Renovate will stop PRs until it is resolved. Location: `.github/renovate.json` Error type: The renovate configuration file contains some invalid settings Message: `Invali...
[ { "body": "There is an error with this repository's Renovate configuration that needs to be fixed. As a precaution, Renovate will stop PRs until it is resolved.\n\nLocation: `.github/renovate.json`\nError type: The renovate configuration file contains some invalid settings\nMessage: `Invalid schedule: 'Invalid ...
59cabc1d97ba3dbfa2904213138e0e8df1f0d0de
{ "head_commit": "b12672a47af2ef04c3e4f2bfad4d8bd7987022e0", "head_commit_message": "Fix Renovate config", "patch_to_review": "diff --git a/.github/renovate.json b/.github/renovate.json\nindex e378ffc7877..ec3ccc8a696 100644\n--- a/.github/renovate.json\n+++ b/.github/renovate.json\n@@ -13,5 +13,5 @@\n ...
[ { "diff_hunk": "@@ -13,5 +13,5 @@\n \"separateMajorMinor\": \"false\"\n }\n ],\n- \"schedule\": [\"on the third day of the month\"]\n+ \"schedule\": [\"the 3rd day of the month\"]", "line": null, "original_line": 16, "original_start_line": null, "path": ".github/ren...
291c23f25014355953b3ad63ad85235a996ac8b3
diff --git a/.github/renovate.json b/.github/renovate.json index e378ffc7877..d1d82433553 100644 --- a/.github/renovate.json +++ b/.github/renovate.json @@ -13,5 +13,5 @@ "separateMajorMinor": "false" } ], - "schedule": ["on the third day of the month"] + "schedule": ["on the 3rd day of...
{ "difficulty": "low", "estimated_review_effort": 1, "problem_domain": "Dependency Updates & Env Compatibility" }
python-pillow__Pillow-4927@27c0747
python-pillow/Pillow
Python
4,927
Allow tuples with one item to give single color value in getink
Resolves #4925 Normally, a user would run `Image.new('F', (100,100), 255)` and `Image.new('I', (100,100), 255)`, providing a single value for `color` for those modes. This PR allows users to also provide that single value inside a tuple, `Image.new('F', (200,100), (255,))` and `Image.new('I', (200,100), (255,))`,...
2020-09-20T04:28:46Z
SystemError on Image.new / fill for 32-bit mode with color tuple The following works smoothly: ```python >>> PIL.Image.new('L', (200,100), (255,)) # accepts tuple ``` However, for 32-bit modes, this does not work: ```python >>> PIL.Image.new('F', (200,100), (255,)) # fails okay Traceback (most recent call la...
Note: always allowing tuple would make it easier to pass values from `ImageStat.Stat().median` etc. (without checking for bands and unlisting) With #4882 in master the last one has a proper error message: ```python >>> PIL.Image.new('I', (200,100), (255,)) Traceback (most recent call last): File "<stdin>", line 1...
[ { "body": "The following works smoothly:\r\n\r\n```python\r\n>>> PIL.Image.new('L', (200,100), (255,)) # accepts tuple\r\n```\r\n\r\nHowever, for 32-bit modes, this does not work:\r\n```python\r\n>>> PIL.Image.new('F', (200,100), (255,)) # fails okay\r\nTraceback (most recent call last):\r\n File \"<stdin>\", ...
c2367400fa8aab47d7752f3780681fced044f0d2
{ "head_commit": "27c074751823d313b1cec59a061f6520ce8cad0a", "head_commit_message": "Allow tuples with one item to give single color value in getink", "patch_to_review": "diff --git a/Tests/test_image.py b/Tests/test_image.py\nindex 89894c9a773..ef0f1477f74 100644\n--- a/Tests/test_image.py\n+++ b/Tests/test_imag...
[ { "diff_hunk": "@@ -533,7 +536,7 @@ getink(PyObject* color, Imaging im, char* ink)\n return NULL;\n }\n } else {\n- PyErr_SetString(PyExc_TypeError, \"color must be int\");\n+ PyErr_SetString(PyExc_TypeError, \"color must be int or tuple\");", "line"...
b304a13bca506f04b18b1cc44074d3ce14896dad
diff --git a/Tests/test_image.py b/Tests/test_image.py index 89894c9a773..ef0f1477f74 100644 --- a/Tests/test_image.py +++ b/Tests/test_image.py @@ -498,6 +498,12 @@ def test_storage_neg(self): with pytest.raises(ValueError): Image.core.fill("RGB", (2, -2), (0, 0, 0)) + def test_one_item_tupl...
{ "difficulty": "low", "estimated_review_effort": 2, "problem_domain": "Bug Fixes" }
python-pillow__Pillow-4599@cc39dba
python-pillow/Pillow
Python
4,599
Fix ImageChops documentation
Many methods were incorrectly documented as requiring mode "1". The remaining ones require *both* images to be mode "1". Documentation only, [ci skip] Fixes #2571
2020-05-01T06:30:21Z
ImageChops: logical_and produces "Image has wrong mode" with 2 RGB images ### What did you do? I tried to apply logical_and between two RGB images ### What did you expect to happen? AND function pixel-by-pixel, color-by-color ### What actually happened? "Image has wrong mode" message. According to the docs, ...
Full traceback with Pillow 4.1.1 and Python 2.7: ``` Traceback (most recent call last): File "1.py", line 12, in <module> main() File "1.py", line 9, in main test_chops() File "1.py", line 5, in test_chops new_img = ImageChops.logical_and(img, img) File "/usr/local/lib/python2.7/site-packag...
[ { "body": "### What did you do?\r\nI tried to apply logical_and between two RGB images\r\n\r\n### What did you expect to happen?\r\nAND function pixel-by-pixel, color-by-color\r\n\r\n### What actually happened?\r\n\"Image has wrong mode\" message. According to the docs, \r\n\"At this time, most channel operatio...
51f31f3f5bf814e6dd97927a8322608766e74957
{ "head_commit": "cc39dbab0e219c4784fd8d03901cc8e6fda745e2", "head_commit_message": "Fix ImageChops documentation.\n\nMany methods were incorrectly documented as requriring mode \"1\". The remaining\nones require *both* images to be mode \"1\".\n\nDocumentation only, [ci skip]", "patch_to_review": "diff --git a/s...
[ { "diff_hunk": "@@ -244,8 +238,10 @@ def subtract_modulo(image1, image2):\n \n \n def logical_and(image1, image2):\n- \"\"\"Logical AND between two images. At least one of the images must have\n- mode \"1\".\n+ \"\"\"Logical AND between two images.\n+\n+ Both of the images must have mode \"1\". For ...
f0871b70e7b06aecd4ed751d570faf2ae8bbd0bb
diff --git a/src/PIL/ImageChops.py b/src/PIL/ImageChops.py index 2d13b529fef..c1a2574e449 100644 --- a/src/PIL/ImageChops.py +++ b/src/PIL/ImageChops.py @@ -54,7 +54,7 @@ def invert(image): def lighter(image1, image2): """ Compares the two images, pixel by pixel, and returns a new image containing - the l...
{ "difficulty": "low", "estimated_review_effort": 1, "problem_domain": "Bug Fixes" }
python-pillow__Pillow-4020@b307fb4
python-pillow/Pillow
Python
4,020
Note a Windows limit on opening fonts
Resolves #3730 The issue reports `OSError: cannot open resource` when opening many fonts on Windows. This is a FreeType error that is thrown, presumably because on Windows, ['The C run-time libraries have a 512 limit for the number of files that can be open at any one time.'](https://docs.microsoft.com/en-us/cpp/c-r...
2019-08-12T10:25:25Z
"OSError: cannot open resource" when trying to load more than exactly 509 ImageFonts ### What did you do? For a data generator, I need to use lots of fonts in different sizes. Randomly one of that is used to generate a sample. Since I didn't want to load a font every time we generate a sample, I created a nested dicti...
When I run your script with a different font on my macOS machine, I have no problems. However, when I run the following code - ```python from PIL import ImageFont test = [] for i in range(1000): print(i) test.append(open("fonts/AbyssinicaSIL-R.ttf", "r")) ``` It stops at 253 with `OSError: [Errno 24] ...
[ { "body": "### What did you do?\r\nFor a data generator, I need to use lots of fonts in different sizes. Randomly one of that is used to generate a sample. Since I didn't want to load a font every time we generate a sample, I created a nested dictionary that dynamicalle loads fonts of a given size when it wasn'...
6de118abd333d5de1679947bd75898b3468ea519
{ "head_commit": "b307fb4808b9c0b879b23c7fdc1f5a1ef29d9baf", "head_commit_message": "Noted a Windows limit on opening fonts [ci skip]", "patch_to_review": "diff --git a/src/PIL/ImageFont.py b/src/PIL/ImageFont.py\nindex e2e6af33254..8279503be28 100644\n--- a/src/PIL/ImageFont.py\n+++ b/src/PIL/ImageFont.py\n@@ -5...
[ { "diff_hunk": "@@ -546,11 +546,20 @@ def truetype(font=None, size=10, index=0, encoding=\"\", layout_engine=None):\n This function loads a font object from the given file or file-like\n object, and creates a font object for a font of the given size.\n \n+ Note that Pillow uses FreeType to open font ...
86c64aafd278f77fa25329c24286a26a6aa1cf56
diff --git a/src/PIL/ImageFont.py b/src/PIL/ImageFont.py index e2e6af33254..16c1052f462 100644 --- a/src/PIL/ImageFont.py +++ b/src/PIL/ImageFont.py @@ -546,11 +546,20 @@ def truetype(font=None, size=10, index=0, encoding="", layout_engine=None): This function loads a font object from the given file or file-like ...
{ "difficulty": "low", "estimated_review_effort": 1, "problem_domain": "Bug Fixes" }
python-pillow__Pillow-4302@fedb040
python-pillow/Pillow
Python
4,302
Raise ValueError for io.StringIO in Image.open
Resolves #4097 The conclusion of discussion in the issue is that StringIO can't be used to pass bytes into Image.open. ```python import io from PIL import Image im = Image.open(io.StringIO("'\x89\x50\x4E\x47\x0D")) ``` ``` OSError: cannot identify image file <_io.StringIO object at 0x104ecdd70> ``` A V...
2019-12-26T02:10:58Z
Loading image from bytes ### What did you do? Convert string or bytes to PIL.Image ### What did you expect to happen? have the PIL.Image instance returned ### What actually happened? Got a Traceback. ### What are your OS, Python and Pillow versions? * OS: Windows 7 x64 * Python: 2.7 and also 3.7 * Pi...
How's this - I find that changing the string declaration to use 'b' (for bytes) makes it work in both Python 2 and 3. ```python import sys from PIL import Image from io import BytesIO # PNG data LEFT_THUMB = ( b'\x89\x50\x4E\x47\x0D\x0A\x1A\x0A\x00\x00\x00\x0D\x49\x48\x44\x52\x00\x00' b'\x00\x13\x00...
[ { "body": "\r\n### What did you do?\r\nConvert string or bytes to PIL.Image\r\n\r\n### What did you expect to happen?\r\nhave the PIL.Image instance returned\r\n\r\n### What actually happened?\r\nGot a Traceback.\r\n\r\n### What are your OS, Python and Pillow versions?\r\n\r\n* OS: Windows 7 x64\r\n* Python: 2....
bbaebe0d20d29328fb20d2e30fa612dcd6b1b87b
{ "head_commit": "fedb0407b4cd14a285fbc641761d9bc6a5348c37", "head_commit_message": "Raise ValueError for io.StringIO in Image.open", "patch_to_review": "diff --git a/Tests/test_image.py b/Tests/test_image.py\nindex 83da76b9604..47e7420efdf 100644\n--- a/Tests/test_image.py\n+++ b/Tests/test_image.py\n@@ -1,3 +1,...
[ { "diff_hunk": "@@ -2690,10 +2690,16 @@ def open(fp, mode=\"r\"):\n :exception FileNotFoundError: If the file cannot be found.\n :exception PIL.UnidentifiedImageError: If the image cannot be opened and\n identified.\n+ :exception ValueError: If the ``mode`` is not \"r\", or if a StringIO\n+ ...
e446b5831704d57aba1529b7cf7f537bb9e4b551
diff --git a/Tests/test_image.py b/Tests/test_image.py index 83da76b9604..47e7420efdf 100644 --- a/Tests/test_image.py +++ b/Tests/test_image.py @@ -1,3 +1,4 @@ +import io import os import shutil import tempfile @@ -91,6 +92,9 @@ def test_invalid_image(self): def test_bad_mode(self): self.assertRaises(...
{ "difficulty": "low", "estimated_review_effort": 2, "problem_domain": "Bug Fixes" }
piskvorky__gensim-3115@04687f0
piskvorky/gensim
Python
3,115
Make LSI dispatcher CLI param for number of jobs optional
Closes #3104.
2021-04-12T13:02:42Z
lsi_dispatcher is not working from command-line when not specifying maxsize argument #### Problem description When running `lsi_dispatcher` from the command-line, if you don't specify the `maxsize` argument explicitly, you get an error for the missing positional argument: ``` usage: lsi_dispatcher.py [-h] maxsiz...
Thanks Rob. Quite possible – the distributed stuff in Gensim is not under automated testing. Are you able to open a PR? Sure, I can do that. See PR #3106. I hope I did it right. :-)
[ { "body": "#### Problem description\r\n\r\nWhen running `lsi_dispatcher` from the command-line, if you don't specify the `maxsize` argument explicitly, you get an error for the missing positional argument:\r\n\r\n```\r\nusage: lsi_dispatcher.py [-h] maxsize\r\nlsi_dispatcher.py: error: the following arguments a...
840df94228d3ea586ff18e42003c7b85caa2155b
{ "head_commit": "04687f0095190d7c21eac8794ffcc071d2ac256c", "head_commit_message": "Make LSI dispatcher CLI param for number of jobs optional", "patch_to_review": "diff --git a/gensim/models/lsi_dispatcher.py b/gensim/models/lsi_dispatcher.py\nindex b593e94cd3..5899739c49 100755\n--- a/gensim/models/lsi_dispatch...
[ { "diff_hunk": "@@ -278,7 +278,11 @@ def exit(self):\n logging.basicConfig(format='%(asctime)s - %(levelname)s - %(message)s', level=logging.INFO)\n parser = argparse.ArgumentParser(description=__doc__[:-135], formatter_class=argparse.RawTextHelpFormatter)\n parser.add_argument(\n- 'maxsize',...
bf88fae1ca1ef92599b1411703f59843d91935e9
diff --git a/gensim/models/lsi_dispatcher.py b/gensim/models/lsi_dispatcher.py index b593e94cd3..2265dc7811 100755 --- a/gensim/models/lsi_dispatcher.py +++ b/gensim/models/lsi_dispatcher.py @@ -278,7 +278,11 @@ def exit(self): logging.basicConfig(format='%(asctime)s - %(levelname)s - %(message)s', level=logging.I...
{ "difficulty": "low", "estimated_review_effort": 2, "problem_domain": "Bug Fixes" }
python-pillow__Pillow-3978@f93a5d0
python-pillow/Pillow
Python
3,978
Added text stroking
Resolves #2209. Replacement for #2224 Adds `strokeWidth` and `strokeFill` arguments, such that - ```python from PIL import Image, ImageDraw, ImageFont font = ImageFont.truetype("Tests/fonts/FreeMono.ttf", 40) font.getsize_multiline("A", strokeWidth=2) font.getsize("ABC\nAaaa", strokeWidth=2) im = Image.n...
2019-07-19T09:09:36Z
ImageFont/ImageDraw should support text stroking Hey, Something that I find myself doing quite often when drawing text to an image is to stroke the text with a high-contrast outline. I find this helps improve readability over cluttered backgrounds. Neither pillow.ImageDraw nor pillow.ImageFont currently includes...
https://github.com/rougier/freetype-py have a few examples doing that. I agree, `ImageFont` could use some love! :s
[ { "body": "Hey,\r\n\r\nSomething that I find myself doing quite often when drawing text to an image is to stroke the text with a high-contrast outline.\r\nI find this helps improve readability over cluttered backgrounds.\r\n\r\nNeither pillow.ImageDraw nor pillow.ImageFont currently includes a function while al...
f3f45cfec50a44970f325e6ef1a2e4eaf2caa89e
{ "head_commit": "f93a5d09728adfa0ea7e3ae52f9234c097d5e824", "head_commit_message": "Added text stroking", "patch_to_review": "diff --git a/Tests/images/imagedraw_stroke_different.png b/Tests/images/imagedraw_stroke_different.png\nnew file mode 100644\nindex 00000000000..e58cbdc4e23\nBinary files /dev/null and b/...
[ { "diff_hunk": "@@ -261,24 +261,95 @@ def _multiline_split(self, text):\n \n return text.split(split_character)\n \n- def text(self, xy, text, fill=None, font=None, anchor=None, *args, **kwargs):\n+ def text(\n+ self,\n+ xy,\n+ text,\n+ fill=None,\n+ font=None,\n...
e790a4066aa77385d13ab68eb1bbd385b9f08fd0
diff --git a/Tests/images/imagedraw_stroke_different.png b/Tests/images/imagedraw_stroke_different.png new file mode 100644 index 00000000000..e58cbdc4e23 Binary files /dev/null and b/Tests/images/imagedraw_stroke_different.png differ diff --git a/Tests/images/imagedraw_stroke_multiline.png b/Tests/images/imagedraw_str...
{ "difficulty": "high", "estimated_review_effort": 4, "problem_domain": "New Feature Additions" }