Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fly launch can't detect a Python FastAPI app with a dependency group specifier #4078

Open
xavdid opened this issue Nov 23, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@xavdid
Copy link

xavdid commented Nov 23, 2024

Describe the bug

I'm making a FastAPI Python project and saw in this post that non-poetry projects are supported. But, running fly launch doesn't recognize my code as a FastAPI project. I'm not using poetry, but do have a valid pyproject.toml.

The issue is that I'm using the default dependency specifier from the FastAPI Docs: fastapi[standard].

flyctl correctly finds and parses my pyproject.toml, this function doesn't correctly handle the [standard] extra:

flyctl/scanner/python.go

Lines 93 to 108 in 09e201b

func parsePyDep(dep string) string {
// remove all version constraints from a python dependency
// e.g. "fastapi>=0.1.0" -> "fastapi"
// e.g. "flask" -> "flask"
// e.g. "pytest < 5.0.0" -> "pytest"
// e.g. "numpy~=1.19.2" -> "numpy"
// e.g. "django>2.1; os_name != 'nt'" -> "django"
dep = strings.ToLower(dep)
dep = strings.Split(dep, ";")[0]
dep = strings.Split(dep, " ")[0]
dep = strings.Split(dep, "==")[0]
dep = strings.Split(dep, ">")[0]
dep = strings.Split(dep, "<")[0]
dep = strings.Split(dep, "~=")[0]
return dep
}

When I change my dependency from "fastapi[standard] == 0.115.5" to "fastapi == 0.115.5", it all works as expected.

  • Operating system: macOS Ventura
  • fly v0.3.40 darwin/arm64 Commit: 0a5966dcd8a4a7ae3a71623f9f04371a3e7f27ae BuildDate: 2024-11-19T20:46:55Z

Paste your fly.toml

N/A, trying to create one

Command output:

fly launch --no-deploy
Scanning source code
INFO Detected pyproject.toml
WARN No supported Python frameworks found
Could not find a Dockerfile, nor detect a runtime or framework from source code. Continuing with a blank app.
@xavdid xavdid added the bug Something isn't working label Nov 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant