← All tasks
pythonpypa/flit #588Not a task: already works

Unable to use project name containing hyphens

envgap__pypa__flit-588

01 / FAILURE SIGNATURE

As reported upstream

ValueError: No file/folder found for module my-package
Not a benchmark task.
  • The project already builds and runs before the fix, so there is nothing to repair.

02 / ENVIRONMENT RECIPE

Base commit
f86127764bddb05cb6b5d9a1b6ae4346f786c94a
Manifest
pyproject.toml
Reproduce
Awaiting issue-specific recipe
Run under trace
Awaiting a meaningful runtime command

03 / ORIGINAL ISSUE TEXT

pypa/flit #588 · read the original issue
## Summary



The flit docs say this about the `project.name` attribute in `pyproject.toml`:



> `name`

>

> The name your package will have on PyPI. This field is required. For Flit, this name, with any hyphens replaced by underscores, is also the default value of the import name (see [Module section](https://flit.pypa.io/en/latest/pyproject_toml.html#pyproject-module) if that needs to be different).



However if I try to use a `name` that contains a hyphen, I get an error.



This means I cannot use a distribution name containing a hyphen, even though the [upstream spec](https://packaging.python.org/en/latest/specifications/core-metadata/#name) allows it.



## Steps to reproduce



1. `mkdir testcase && cd $_`

2. `mkdir my_package && touch my_package/__init__.py`

3. Create the `pyproject.toml` using:

    ```

    cat > pyproject.toml<< 'EOF'

    [build-system]

    requires = ["flit_core >=3.2,<4"]

    build-backend = "flit_core.buildapi"

    

    [project]

    name = "my-package"

    version = "0.0.0"

    description = ""

    EOF

    ```

4. `pip install -e .`



## Expected



Pip install succeeds.



## Actual



```

(venv) testcase $ pip install -e .

Obtaining file:///Users/emorley/src/testcase

  Installing build dependencies ... done

  Checking if build backend supports build_editable ... done

  Getting requirements to build editable ... error

  error: subprocess-exited-with-error



  × Getting requirements to build editable did not run successfully.

  │ exit code: 1

  ╰─> [12 lines of output]

      Traceback (most recent call last):

        File "/Users/emorley/src/testcase/venv/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 363, in <module>

          main()

        File "/Users/emorley/src/testcase/venv/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 345, in main

          json_out['return_val'] = hook(**hook_input['kwargs'])

        File "/Users/emorley/src/testcase/venv/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 144, in get_requires_for_build_editable

          return hook(config_settings)

        File "/private/var/folders/kp/1j9qfrqn79b867c9xzshx9kr0000gp/T/pip-build-env-ov8_3n9i/overlay/lib/python3.10/site-packages/flit_core/buildapi.py", line 31, in get_requires_for_build_wheel

          module = Module(info.module, Path.cwd())

        File "/private/var/folders/kp/1j9qfrqn79b867c9xzshx9kr0000gp/T/pip-build-env-ov8_3n9i/overlay/lib/python3.10/site-packages/flit_core/common.py", line 59, in __init__

          raise ValueError("No file/folder found for module {}".format(name))

      ValueError: No file/folder found for module my-package

      [end of output]



  note: This error originates from a subprocess, and is likely not a problem with pip.

error: subprocess-exited-with-error



× Getting requirements to build editable did not run successfully.

```



## Notes



* Using flit 3.7.1, pip 22.2.2, Python 3.10 (from homebrew), macOS

* Flit seems to not be normalising the module name, contrary to what the docs say.

Continue on GitHub ↗

04 / LABELS

Labels from the report text only; not yet run

No supported category has been assigned.

Label rules and the text that matched
[]