Skip to content

"poetry build" command is logging "fatal" errors when not inside a git repo #8728

@kevinpauli

Description

@kevinpauli
  • Poetry version: 1.7.1
  • Python version: 3.11.5
  • OS version and name: macOS 14.1.1
  • pyproject.toml:
  • I am on the latest stable Poetry version, installed using a recommended method.
  • I have searched the issues of this repo and believe that this is not a duplicate.
  • I have consulted the FAQ and blog for any relevant entries or release notes.
  • If an exception occurs when executing a command, I executed it again in debug mode (-vvv option) and have included the output below.

Issue

Consider this very simple project:

.
├── dummy
│   └── __init__.py
└── pyproject.toml

The python file can be totally empty.

The pyproject.toml is

[tool.poetry]
name = "dummy"
version = "0.1.0"
description = ""
authors = ["Me"]
packages = [{ include = "dummy", from = "." }]


[tool.poetry.dependencies]
python = "^3.11"


[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"

Note this is NOT a git repo, there is no .git folder. Now when I execute poetry build -vvv I get these "fatal" errors complaining about the fact that we are not in a git repo:

Using virtualenv: /Users/kpauli/opt/miniconda3/envs/dev
Building dummy (0.1.0)
  - Building sdist
fatal: not a git repository (or any of the parent directories): .git
  - Adding: /Users/kpauli/projects/dummy/__init__.py
  - Adding: pyproject.toml
  - Built dummy-0.1.0.tar.gz
  - Building wheel
fatal: not a git repository (or any of the parent directories): .git
  - Adding: /Users/kpauli/projects/dummy/dummy/__init__.py
Skipping: /Users/kpauli/projects/dummy/COPYING
Skipping: /Users/kpauli/projects/dummy/LICENSE
  - Built dummy-0.1.0-py3-none-any.whl

It looks like it still produced the targets however the fatal errors are tripping devops warning bells and causing me headaches.

If I just do a git init then the problem goes away.

Why would poetry build care if it is running inside a git repo or not?

This happens with multiple releases of poetry (1.7.1, 1.6.1) and in various environments (in Docker containers, and in my mac in a conda environment) so I think it must be something fundamental I am not understanding, or else considered a bug that maybe nobody has noticed?

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugSomething isn't working as expected

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions