Can't build Poetry project in a shared monorepo
I've been trying to setup Railway with a NX based Monorepo for most of the day and I'm about to give up. So I was hoping there was a kind soul in here who could help me out π
- Automatic detection seems to be very poorly supported in Monorepos. I'm using NX but it does not seem to pick that up on its own
- It probably wouldn't work anyways, because it's assumed that NX is Node only. I have a python project in my NX monorepo in this instance.
- No problem! I'll just setup my own railway.toml and nixpacks.toml and solve it that way
- The "python" provider will only install poetry if there's a pyproject.toml in your app folder. Which isn't the case when you're in a monorepo
- No issue! I'll just install poetry myself... only, it doesn't catch the poetry install between phases
So... my question is:
How can I build a poetry project that resides in a shared monorepo?
12 Replies
Project ID:
bbb255bd-ad51-4f8e-801d-ad19617fceb5
bbb255bd-ad51-4f8e-801d-ad19617fceb5
why not set the root directory to
/apps/backends/python/api
?If I do that it doesn't have access to the dependencies outside of that.
Eg: the API depends on a few shared dependencies in libs
is the
python:install
phase even running?It is - and it finishes installing all the dependencies.
My suspicion is that everything it does isn't transfered over to the next step because there's no logic that caches it (and reloads it from the cache)
I notice that the python provider in nixpacks sets a cache, but it only does that if it finds the respective python files in the root folder.
it's likely that the venv is no longer active in the next stage somehow, nothing to do with cache.
maybe a dockerfile would serve you better in this instance?
Yeah, probably. Wonder why that is though - I'm guessing it works just fine in autodected python builds.
I can write a multistage docker build for it.
Or use GitHub actions...
But it slowly starts to remove the key USP of railway vs some of the other providers where I'd have to do the same.
have you tried modifying your start command to fire up the venv before running your npx start command?
Solution
.venv/Scripts/activate; npx β¦
no... but let me try that right away
re-replicating this step:
did the trick. now I just need to get the start command working. Thank you @Adam and @Brody!
No prob! Let me know if you run into any other issues