I'm working on a project where I have both a `/frontend` and a `/backend` structure. Inside my backend, there's a `pyproject.toml` file, but I'm running into issues because the `uv` command seems to require my backend code to be in a `/src/backend` structure. When I try to remove this `/src` directory and keep everything in the root `/backend` folder, I get an error saying that the source directory is missing. I want to know if the `/src/{project}` folder structure is fixed or if I can change it. My ultimate goal is to have `uv` recognize the app logic correctly from the root `/backend` folder.
4 Answers
The need for a `/src` folder usually depends on whether you're developing a library or an application. In your case, since you have a full app, maybe you don’t need to adhere strictly to that structure. You could consider using tools like `arkalos`, which help set up the project structure for applications and might avoid this issue altogether!
You can actually modify the folder structure! According to the documentation, you can set the build path to point to your custom directory instead of sticking to the default `/src`. This gives you the flexibility to organize your project how you want, whether it’s in the root folder or elsewhere. Check out the relevant settings for that!
Thanks for the tip! I’ll look into the documentation to make those adjustments.
I noticed you might be missing your current directory's path in your setup. Be sure to check the `tool.setuptools.packages.find` setting in your `pyproject.toml`. This could help resolve the pathing issues you’re experiencing!
But isn’t OP using `uv` instead of `setuptools`?
If your backend is separate from your frontend, you might want to treat them as two different projects altogether. It could simplify things for you in the long run.
So it's mainly for libraries? That makes sense! I appreciate the clarification.