ya-mori / python-monorepo Goto Github PK
View Code? Open in Web Editor NEWmonorepo sample using python and poetry
monorepo sample using python and poetry
How do you manage relative paths in pyproject.toml
when you dockerize the project? For example in project-one there is
lib-one = {path = "../../libs/lib-one"}
This of course makes docker build
fail with a simple Dockerfile like the following
FROM python:3.9
WORKDIR /code
RUN pip install poetry==1.1.13
COPY ./pyproject.toml ./poetry.lock* /code/
RUN poetry install --no-dev
COPY ./src /code
Thaks for the great code example.
the command to start example 2 API is
poetry run python api
Hope this help someone
I am trying to build project-one. However, when it tries to build lib-one, it also needs to build the logging lib, which fails.
I think, it has to do with the relative paths, that don't match depending from where you build the porject.
Can you tell me what I am doing wrong?
Steps to reproduce
poetry install
cd projects/project-one
poetry install
• Installing lib-one (0.1.0 xxx/python-monorepo/libs/lib-one): Failed
EnvCommandError
Command ['/xxx/.cache/pypoetry/virtualenvs/project-one-fVJqddUj-py3.8/bin/pip', 'install', '--no-deps', '-U', 'xxx/python-monorepo/libs/lib-one'] errored with the following return code 1, and output:
Looking in indexes: xxx (private repo)
Processing xxx/python-monorepo/libs/lib-one
Installing build dependencies: started
Installing build dependencies: finished with status 'done'
Getting requirements to build wheel: started
Getting requirements to build wheel: finished with status 'done'
Preparing wheel metadata: started
Preparing wheel metadata: finished with status 'error'
ERROR: Command errored out with exit status 1:
command: xxx/.cache/pypoetry/virtualenvs/project-one-fVJqddUj-py3.8/bin/python xxx/.cache/pypoetry/virtualenvs/project-one-fVJqddUj-py3.8/lib/python3.8/site-packages/pip/_vendor/pep517/_in_process.py prepare_metadata_for_build_wheel /tmp/tmp_wre553_
cwd: /tmp/pip-req-build-4beifv24
Complete output (16 lines):
Traceback (most recent call last):
File "xxx/.cache/pypoetry/virtualenvs/project-one-fVJqddUj-py3.8/lib/python3.8/site-packages/pip/_vendor/pep517/_in_process.py", line 280, in <module>
main()
File "xxx/.cache/pypoetry/virtualenvs/project-one-fVJqddUj-py3.8/lib/python3.8/site-packages/pip/_vendor/pep517/_in_process.py", line 263, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File "xxx/.cache/pypoetry/virtualenvs/project-one-fVJqddUj-py3.8/lib/python3.8/site-packages/pip/_vendor/pep517/_in_process.py", line 133, in prepare_metadata_for_build_wheel
return hook(metadata_directory, config_settings)
File "/tmp/pip-build-env-i0p3l6n2/overlay/lib/python3.8/site-packages/poetry/core/masonry/api.py", line 34, in prepare_metadata_for_build_wheel
poetry = Factory().create_poetry(Path(".").resolve())
File "/tmp/pip-build-env-i0p3l6n2/overlay/lib/python3.8/site-packages/poetry/core/factory.py", line 91, in create_poetry
self.create_dependency(name, constraint, root_dir=package.root_dir)
File "/tmp/pip-build-env-i0p3l6n2/overlay/lib/python3.8/site-packages/poetry/core/factory.py", line 242, in create_dependency
dependency = DirectoryDependency(
File "/tmp/pip-build-env-i0p3l6n2/overlay/lib/python3.8/site-packages/poetry/core/packages/directory_dependency.py", line 36, in __init__
raise ValueError("Directory {} does not exist".format(self._path))
ValueError: Directory ../logger does not exist
----------------------------------------
ERROR: Command errored out with exit status 1: xxx/.cache/pypoetry/virtualenvs/project-one-fVJqddUj-py3.8/bin/python xxx/.cache/pypoetry/virtualenvs/project-one-fVJqddUj-py3.8/lib/python3.8/site-packages/pip/_vendor/pep517/_in_process.py prepare_metadata_for_build_wheel /tmp/tmp_wre553_ Check the logs for full command output.
at ~/.local/lib/python3.8/site-packages/poetry/utils/env.py:948 in _run
944│ output = subprocess.check_output(
945│ cmd, stderr=subprocess.STDOUT, **kwargs
946│ )
947│ except CalledProcessError as e:
→ 948│ raise EnvCommandError(e, input=input_)
949│
950│ return decode(output)
951│
952│ def execute(self, bin, *args, **kwargs):
I'm surprised more projects (e.g. poetry, pip, jupyter, ipython) don't use and encourage monorepos
Do you know any open source python projects using monorepos?
Hi,
I found this repo to be interesting I have a few questions:
How do you add another language as a microservice using this structure?
Ex a JS FrontEnd, another Go backend service
How do you handle linting and commitizen with pre-commit hooks for this project?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.