-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial checkin of directory structure for future use with poetry / c…
…make. Based on: https://github.com/adriangb/python-monorepo See: python-poetry/poetry#6850
- Loading branch information
0 parents
commit ba696ee
Showing
24 changed files
with
231 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
workspaces/*/.venv | ||
workspaces/*/poetry.lock | ||
workspaces/*/poetry.toml | ||
.poetry.toml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
PROJECTS := $(notdir $(wildcard workspaces/*)) | ||
|
||
|
||
.clean-venv: | ||
rm -rf .venv | ||
|
||
.venv: | ||
pipx run poetry config virtualenvs.create true --local | ||
pipx run poetry install --sync | ||
|
||
init: .clean-venv .venv | ||
|
||
test-%: .venv | ||
pipx run poetry install --sync --with $* | ||
pipx run poetry run pytest workspaces/$* | ||
|
||
tests: .venv $(addprefix test-, $(PROJECTS)) | ||
|
||
test-isolated-%: .venv | ||
pipx run poetry install --sync --only $* | ||
pipx run poetry run pytest workspaces/$* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
[virtualenvs] | ||
in-project = true | ||
create = true | ||
path = ".venv" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
[tool.poetry] | ||
name = "alphamelts" | ||
version = "0.1.0" | ||
description = "" | ||
authors = [] | ||
readme = "README.md" | ||
packages = [] | ||
|
||
[tool.poetry.group.main.dependencies] | ||
python = "^3.10" | ||
|
||
[tool.poetry.group.app.dependencies] | ||
alphamelts-app = { path = "workspaces/app", develop = true} | ||
|
||
[tool.poetry.group.lib.dependencies] | ||
alphamelts-lib = { path = "workspaces/lib", develop = true} | ||
|
||
[tool.poetry.group.lib-test.dependencies] | ||
alphamelts-lib = { path = "workspaces/lib", develop = true, extras=["test"]} | ||
|
||
[tool.poetry.group.cli.dependencies] | ||
alphamelts-cli = { path = "workspaces/cli", develop = true} | ||
|
||
[tool.poetry.group.app.dependencies] | ||
alphamelts-mat = { path = "workspaces/mat", develop = true} | ||
|
||
[tool.poetry.group.app.dependencies] | ||
alphamelts-py = { path = "workspaces/py", develop = true} | ||
|
||
[build-system] | ||
requires = ["poetry-core", "setuptools", "setuptools-cpp"] | ||
build-backend = "poetry.core.masonry.api" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
[tool.poetry] | ||
name = "alphamelts-app" | ||
version = "0.0.0" | ||
description = "" | ||
authors = [] | ||
packages = [{include = "alphamelts", from = "src"}] | ||
|
||
[tool.poetry.dependencies] | ||
python = "^3.10" | ||
orjson = "^3.8.0" | ||
alphamelts-cli = { path = "../cli"} | ||
|
||
[build-system] | ||
requires = ["poetry-core"] | ||
build-backend = "poetry.core.masonry.api" |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
from time import sleep | ||
|
||
import orjson | ||
|
||
from alphamelts.lib import Foo | ||
|
||
|
||
def main(max_iters: float | None) -> None: | ||
iter = 0 | ||
if max_iters is None: | ||
max_iters = float("inf") | ||
while iter < max_iters: | ||
iter +=1 | ||
print(orjson.dumps(Foo(name="app").dict()).decode()) | ||
sleep(1) | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
def test_import(): | ||
from alphamelts.app.main import main # type: ignore | ||
main(1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
[tool.poetry] | ||
name = "alphamelts-cli" | ||
version = "0.0.0" | ||
description = "" | ||
authors = [] | ||
packages = [{include = "alphamelts", from = "src"}] | ||
|
||
[tool.poetry.dependencies] | ||
python = "^3.10" | ||
rich = "^12.6.0" | ||
alphamelts-lib = { path = "../lib"} | ||
|
||
[build-system] | ||
requires = ["poetry-core"] | ||
build-backend = "poetry.core.masonry.api" |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
from rich import print | ||
|
||
from alphamelts.lib import Foo | ||
|
||
|
||
def main() -> None: | ||
print(Foo(name="cli")) | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
def test_import(): | ||
from alpahmelts.cli.main import main # type: ignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
[tool.poetry] | ||
name = "alphamelts-lib" | ||
version = "0.0.0" | ||
description = "" | ||
authors = [] | ||
packages = [{include = "alphamelts", from = "src"}] | ||
|
||
[tool.poetry.dependencies] | ||
python = ">=3.7" | ||
pydantic = { extras = ["email"], version = ">=1.10.2"} | ||
pytest = { version = "*", optional = true } | ||
|
||
[tool.poetry.extras] | ||
test = ["pytest"] | ||
|
||
[build-system] | ||
requires = ["poetry-core"] | ||
build-backend = "poetry.core.masonry.api" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
from pydantic import BaseModel | ||
|
||
|
||
class Foo(BaseModel): | ||
name: str |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import json | ||
from alphamelts.lib import Foo | ||
|
||
|
||
def test_foo() -> None: | ||
got = json.loads(Foo(name="adrian").json()) | ||
expected = {"name": "adrian"} | ||
assert got == expected |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
[tool.poetry] | ||
name = "alphamelts-mat" | ||
version = "0.0.0" | ||
description = "" | ||
authors = [] | ||
packages = [{include = "alphamelts", from = "src"}] | ||
|
||
[tool.poetry.dependencies] | ||
python = "^3.10" | ||
orjson = "^3.8.0" | ||
alphamelts-lib = { path = "../lib"} | ||
|
||
[build-system] | ||
requires = ["poetry-core"] | ||
build-backend = "poetry.core.masonry.api" |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
from time import sleep | ||
|
||
import orjson | ||
|
||
from alphamelts.lib import Foo | ||
|
||
|
||
def main(max_iters: float | None) -> None: | ||
iter = 0 | ||
if max_iters is None: | ||
max_iters = float("inf") | ||
while iter < max_iters: | ||
iter +=1 | ||
print(orjson.dumps(Foo(name="app").dict()).decode()) | ||
sleep(1) | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
def test_import(): | ||
from alphamelts.mat.main import main # type: ignore | ||
main(1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
[tool.poetry] | ||
name = "alphamelts-py" | ||
version = "0.0.0" | ||
description = "" | ||
authors = [] | ||
packages = [{include = "alphamelts", from = "src"}] | ||
|
||
[tool.poetry.dependencies] | ||
python = "^3.10" | ||
orjson = "^3.8.0" | ||
alphamelts-lib = { path = "../lib"} | ||
|
||
[build-system] | ||
requires = ["poetry-core"] | ||
build-backend = "poetry.core.masonry.api" |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
from time import sleep | ||
|
||
import orjson | ||
|
||
from alphamelts.lib import Foo | ||
|
||
|
||
def main(max_iters: float | None) -> None: | ||
iter = 0 | ||
if max_iters is None: | ||
max_iters = float("inf") | ||
while iter < max_iters: | ||
iter +=1 | ||
print(orjson.dumps(Foo(name="app").dict()).decode()) | ||
sleep(1) | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
def test_import(): | ||
from alphamelts.py.main import main # type: ignore | ||
main(1) |