28 Sep, 2023
Assuming you've read Poetry Git Submodules and Plugins with Poetry.
There are two tricks to getting this working nicely:
setuptools
doesn't auto discover it. I've done that by calling the directory private-packages
because the -
in the middle means the directories underneath aren't detected.pip
doesn't then try to fetch them from the internetI prefer this approach because pip
and setuptools
come with most distributions of Python 3.11 anyway, so there isn't any need to install anything else.
Here are the files in the serve
repo:
serve
- same as before
tests
- same as before
.gitignore
:
*.egg-info
__pycache__
README.md
- empty, same as before
pyproject.toml
:
[project]
name = "serve"
version = "0.1.0"
[project.entry-points."blog.serve_msg"]
serve_msg_plugin = "serve:serve_msg"
And here are the files in the blog
git repo:
blog
- same as before
tests
- same as before
private-packages
- created when you run git -c protocol.file.allow=always submodule add ../serve private-packages/serve
to install from the local serve
git repo
README.md
:
# Instructions
Install:
```
python3 -m venv .venv && .venv/bin/pip install -e private-packages/* && .venv/bin/pip install .
```
Every time metadata is changed, or submodules are updated:
```
git -c protocol.file.allow=always submodule update --remote && .venv/bin/pip install -e private-packages/*
```
To run:
```sh
.venv/bin/python3 blog/__init__.py serve_msg_plugin
```
```
Hello from serve
```
.gitignore
:
*.egg-info
.venv
__pycache__
build
pyproject.toml
:
[project]
name = "blog"
version = "0.1.0"
dependencies = [
'serve'
]
See Declaring Project Metadata for other metadata available.
A lot simpler overall I think.
You can specify dev dependencies like this:
[project.optional-dependencies]
dev = [
'black==23.9.1',
'uvicorn==0.23.2',
'isort==5.12.0',
'autoflake==2.2.1',
]
Then:
.venv/bin/pip install '.[dev]'
Be the first to comment.
Copyright James Gardner 1996-2020 All Rights Reserved. Admin.