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

Undocumented settings.py behaviour #603

Open
AlexFF000 opened this issue Oct 28, 2023 · 2 comments
Open

Undocumented settings.py behaviour #603

AlexFF000 opened this issue Oct 28, 2023 · 2 comments

Comments

@AlexFF000
Copy link

When Ursina loads, it automatically looks for a file called "settings.py" in the project root and runs it. This behaviour isn't properly documented anywhere; the only reference to it seems to be in the samples here.

While this behaviour could be useful for loading in settings, it causes some problems if people are unaware of it and coincidentally create an unrelated settings.py file in the root dir.

Related lines in Ursina source code:
main.py
application.py

P.S. I don't use Python much, so please forgive my ignorance if this is a common pattern in Python that I'm unaware of. But even so, it would be useful to have it documented :)

@pokepetter
Copy link
Owner

I kind of agree actually. What would be a better solution? I like users being able to configure the game/program for settings and whatnot, and for developers to have local settings, like custom window position for example.

@AlexFF000
Copy link
Author

Not sure what the best solution is, but definitely start by documenting the behaviour.

Do the settings need to be in a python file? Perhaps the settings file could use a file extension other than .py. Though that may be a little misleading admittedly, as people wouldn't expect it to run code.

Alternatively, if settings.py is just for configuration options, perhaps it doesn't need to run any code at all. It could just be a JSON file and ursina could read in the options and set them automatically.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants