Skip to content

[Bug] a365 deploy overwrites requirements.txt for Python projects without pyproject.toml #252

@pratapladhani

Description

@pratapladhani

Description

When running a365 deploy for a Python project that has a requirements.txt but no pyproject.toml or setup.py, the CLI overwrites the project's requirements.txt with:

--find-links dist
--pre
-e .

This causes the Azure Oryx build to fail with:

ERROR: file:///tmp/8de6a0cc7ececaa (from -r requirements.txt (line 3)) does not appear to be a Python project: neither 'setup.py' nor 'pyproject.toml' found.

Steps to Reproduce

  1. Create a Python agent project with only requirements.txt (no pyproject.toml or setup.py)
  2. Run a365 deploy --verbose
  3. Observe that publish/requirements.txt is overwritten with -e .
  4. Azure deployment fails because there's no pyproject.toml

Expected Behavior

The CLI should detect the project structure:

  • If pyproject.toml or setup.py exists: Use -e . approach (editable install)
  • If only requirements.txt exists: Copy the existing requirements.txt to the publish folder as-is

Actual Behavior

The CLI always overwrites requirements.txt with -e ., regardless of whether pyproject.toml exists.

Code Location

src/Microsoft.Agents.A365.DevTools.Cli/Services/PythonBuilder.cs - CreateAzureRequirementsTxt() method:

private async Task CreateAzureRequirementsTxt(string publishPath, bool verbose)
{
    var requirementsTxt = Path.Combine(publishPath, "requirements.txt");

    // Azure-native requirements.txt that mirrors local workflow
    // --pre allows installation of pre-release versions
    var content = "--find-links dist\n--pre\n-e .\n";

    await File.WriteAllTextAsync(requirementsTxt, content);
    _logger.LogInformation("Created requirements.txt for Azure deployment");
}

Proposed Fix

Check for pyproject.toml or setup.py before deciding which approach to use. Will submit a PR with the fix.

Environment

  • CLI Version: 1.1.62-preview
  • OS: Windows 11
  • Python: 3.12

Workaround

Manually copy the original requirements.txt to the publish/ folder after a365 deploy creates it, then redeploy with az webapp deploy.

Metadata

Metadata

Assignees

Labels

P2High prioritybugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions