AttributeError: type object Signature has no attribute _encoding
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 42/100
Research direction
Start by running the provided reproduction in the Python 3.9.16 Docker environment with pygit2 v1.12.2 and Ray installed from PyPI, comparing execution with and without Ray. Trace when Signature loses _encoding and identify a focused regression test; done means the reproduced Ray case no longer raises the AttributeError.
Written by the indexing model from the issue text.
Description
Hi folks!
I'm running into this weird error when running my python code with ray.
Basically I get AttributeError: type object 'Signature' has no attribute '_encoding'.
But it works fine when I run my script without ray...
pygit2 version: v1.12.2
environment: python:3.9.16 docker container.
The error can be reproduced with the code below.
Ray can be installed from PyPi: pip install ray
import pygit2
import ray
from pygit2 import Signature
def function_without_ray():
org_name = "libgit2"
repo_name = "pygit2"
repo = pygit2.clone_repository(
f"https://github.com/{org_name}/{repo_name}",
f"/tmp/{repo_name}.git",
)
new_branch = repo.branches.create(
"dummy-branch", repo.revparse_single("HEAD")
)
repo.checkout(new_branch)
index = repo.index
index.add_all()
index.write()
author = Signature("John Doe", "john@doe.com")
ref = repo.head.name
tree = index.write_tree()
parents = [repo.head.target]
repo.create_commit(
ref,
author,
author,
"Just a dummy commit",
tree,
parents,
)
@ray.remote
def function_with_ray():
function_without_ray()
# Comment out one of these function calls to check if it works:
ray.get(function_with_ray.remote())
function_without_ray()
- Dominant language
- Python
- Stars
- 1.7k
- Forks
- 408
- Avg merge
- 2d 57m
- Merged PRs (30d)
- 7
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from libgit2/pygit2
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
-
Difficulty 4/5 3-5 days Newbie friendliness 45/100
-
Difficulty 3/5 1-2 days Newbie friendliness 48/100
-
Difficulty 3/5 1-2 days Newbie friendliness 55/100
Similar issues
-
Add: hunch Open
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
AbdelStark/awesome-typesafe#104 ·
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
DiamondLightSource/dodal#2211 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
openml/openml-python#1749 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
sipyourdrink-ltd/bernstein#6191 ·