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

pyproject.toml settings source not being respected #16044

Open
christophjones opened this issue Nov 18, 2024 · 1 comment
Open

pyproject.toml settings source not being respected #16044

christophjones opened this issue Nov 18, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@christophjones
Copy link

christophjones commented Nov 18, 2024

Bug summary

discussed in https://prefect-community.slack.com/archives/CL09KU1K7/p1731690940849709

Prefect does not recognize api.url when included in local pyproject.toml

prefect server start

#  pyproject.toml

[tool.prefect]
logging.level = "DEBUG"
api.url = "http://127.0.0.1:4200/api"
# main.py

@flow(log_prints=True)
def run_pipeline():
    print("hello world")

if __name__ == "__main__":
    run_pipeline.serve(name="initial-deployment", cron="*/3 * * * *")
    

ValueError: No Prefect API URL provided. Please set PREFECT_API_URL to the address of a running Prefect server

Runs w/out error when using
prefect config set PREFECT_API_URL="http://127.0.0.1:4200/api"
or updating .env with PREFECT_API_URL="http://127.0.0.1:4200/api"

Version info

`prefect version`

Version:             3.1.1
API version:         0.8.4
Python version:      3.10.11
Built:               Fri, Nov 8, 2024 12:38 PM
OS/Arch:             win32/AMD64
Profile:             local
Server type:         server
Pydantic version:    2.10.0b1

Additional context

No response

@christophjones christophjones added the bug Something isn't working label Nov 18, 2024
@zzstoatzz
Copy link
Collaborator

zzstoatzz commented Nov 18, 2024

hi @christophjones - thank you for the issue!

hmm what is the file structure you have? I am not able to reproduce this so far (running the flow or using .serve)

» tree
.
├── README.md
├── main.py
├── pyproject.toml
└── uv.lock

1 directory, 4 files
» cat pyproject.toml
[project]
name = "16044"
version = "0.1.0"
description = "Add your description here"
readme = "README.md"
requires-python = ">=3.12"
dependencies = ["prefect>=3.1.2"]

[tool.prefect]
logging.level = "DEBUG"
api.url = "https://api.prefect.cloud/api/accounts/xxx/workspaces/xxx"

» uv run main.py
11:04:11.185 | DEBUG   | prefect.profiles - Using profile 'bleeding'
11:04:11.476 | INFO    | prefect.engine - Created flow run 'refreshing-ammonite' for flow 'run-pipeline'
11:04:11.477 | INFO    | prefect.engine - View at https://app.prefect.cloud/account/xxx/workspace/xxx/runs/flow-run/xxx
11:04:11.684 | DEBUG   | prefect.task_runner.threadpool - Starting task runner
11:04:11.693 | DEBUG   | Flow run 'refreshing-ammonite' - Executing flow 'run-pipeline' for flow run 'refreshing-ammonite'...
11:04:11.699 | INFO    | Flow run 'refreshing-ammonite' - hello world
11:04:11.736 | DEBUG   | prefect.client - Connecting to API at https://api.prefect.cloud/api/accounts/xxx/workspaces/xxx/
11:04:11.817 | DEBUG   | prefect.task_runner.threadpool - Stopping task runner
11:04:11.818 | INFO    | Flow run 'refreshing-ammonite' - Finished in state Completed()

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

2 participants