Azure / Azure/azure-cli

Missing `__init__.py` leads to `ModuleNotFoundError: No module named 'xxx'`

Open
#28,464 2 comments 0 reactions 1 assignee Claimed by @jsntcy View on GitHub
Azure CLI Team feature-request
Dominant language
Python
Stars
4.6k
Forks
3.5k
Avg merge
3d 2h
Merged PRs (30d)
60

Description

According https://docs.python.org/3/reference/import.html#regular-packages,

> A regular package is typically implemented as a directory containing an `__init__.py` file.

If a directory contains no `__init__.py`, it won't be packaged into the built wheel, leading to `ModuleNotFoundError` when executed. This frequently causes CI failures, such as

```
E ModuleNotFoundError: No module named 'azure.cli.core.sdk'
```

Previous occurrences:

1. https://github.com/Azure/azure-cli/pull/17817
2. https://github.com/Azure/azure-cli/pull/19285
3. (Similar but not exactly the same) https://github.com/Azure/azure-cli/pull/28462#issuecomment-1965911403

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.