Closed mmarchetti closed 4 days ago
@mmarchetti , in testing this, I was surprised by the API response for an entry point file that didn't exist... Shouldn't we get an error?
Note: the file simple2.py
does not exist.
~/dev/publishing-client-PRs mm-entrypoint-in-inspect-api > curl -s -XPOST -d '{}' 'localhost:9001/api/inspect?dir=test/sample-content/fastapi-simple&entrypoint=simple2.py' | jq
[
{
"configuration": {
"comments": [
" Configuration file generated by Posit Publisher.",
" Please review and modify as needed. See the documentation for more options:",
" https://github.com/posit-dev/publisher/blob/main/docs/configuration.md"
],
"$schema": "https://cdn.posit.co/publisher/schemas/posit-publishing-schema-v3.json",
"type": "unknown",
"entrypoint": "simple2.py",
"validate": true,
"hasParameters": false,
"files": [
"*"
],
"title": "fastapi-simple",
"python": {
"version": "3.8.2",
"packageFile": "requirements.txt",
"packageManager": "pip"
},
"r": {
"version": "4.3.2",
"packageFile": "renv.lock",
"packageManager": "renv"
}
},
"projectDir": "test/sample-content/fastapi-simple"
}
]
Intent
This PR adds the
entrypoint
parameter to the POST /api/inspect endpoint.Part of #1847
Type of Change
Approach
Rather than inspecting as usual and then filtering, the entrypoint is passed down to
InferType
so the inspectors can avoid a lot of I/O when an entrypoint is specified.Automated Tests
Added tests for when an entrypoint is specified.
Directions for Reviewers