Skip to content

Commit 16bbc4b

Browse files
authored
Change package layout (#96)
1 parent 5f5ee31 commit 16bbc4b

31 files changed

+112
-50
lines changed

.github/workflows/publish.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,12 @@ jobs:
1212
- uses: actions/checkout@v4
1313
- uses: extractions/setup-just@v2
1414
- uses: astral-sh/setup-uv@v5
15-
with:
16-
cache-dependency-glob: "**/pyproject.toml"
17-
- run: just publish
15+
- if: startsWith(github.ref_name, 'stompman')
16+
run: just publish stompman
17+
env:
18+
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
19+
20+
- if: startsWith(github.ref_name, 'faststream-stomp')
21+
run: just publish faststream-stomp
1822
env:
1923
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}

Dockerfile

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,16 @@ FROM ${PYTHON_IMAGE}
66
RUN pip install uv
77

88
WORKDIR /app
9+
10+
# Copy rarely changing files first
911
COPY pyproject.toml README.md ./
10-
COPY stompman/__init__.py stompman/__init__.py
12+
COPY packages/stompman/stompman/__init__.py packages/stompman/stompman/__init__.py
13+
COPY packages/stompman/pyproject.toml packages/stompman/pyproject.toml
14+
COPY packages/faststream-stomp/README.md packages/faststream-stomp/README.md
15+
COPY packages/faststream-stomp/pyproject.toml packages/faststream-stomp/pyproject.toml
16+
COPY packages/faststream-stomp/faststream_stomp/__init__.py packages/faststream-stomp/faststream_stomp/__init__.py
1117

1218
ENV SETUPTOOLS_SCM_PRETEND_VERSION=0
1319
RUN --mount=type=cache,target=~/.cache/uv \
14-
uv lock && uv sync
20+
ls packages/faststream-stomp && uv lock && uv sync
1521
COPY . .

Justfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ test *args:
1313
test-integration *args:
1414
#!/bin/bash
1515
trap 'echo; docker compose down --remove-orphans' EXIT
16-
docker compose run --build --rm app .venv/bin/pytest tests/integration.py --no-cov {{args}}
16+
docker compose run --build --rm app .venv/bin/pytest packages/stompman/test_stompman/integration.py --no-cov {{args}}
1717

1818
run-artemis:
1919
#!/bin/bash
@@ -26,7 +26,7 @@ run-consumer:
2626
run-producer:
2727
uv run examples/producer.py
2828

29-
publish:
29+
publish package:
3030
rm -rf dist
31-
uv build
31+
uv build --package {{package}}
3232
uv publish --token $PYPI_TOKEN

packages/faststream-stomp/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# FastStream STOMP broker
2+
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
[project]
2+
name = "faststream-stomp"
3+
description = "FastStream STOMP broker"
4+
authors = [{ name = "Lev Vereshchagin", email = "mail@vrslev.com" }]
5+
dependencies = ["faststream>=0.5", "stompman"]
6+
requires-python = ">=3.11"
7+
readme = "README.md"
8+
license = { text = "MIT" }
9+
keywords = ["faststream", "stomp", "artemis", "activemq", "messaging", "jms"]
10+
classifiers = [
11+
"Development Status :: 4 - Beta",
12+
"Natural Language :: English",
13+
"Programming Language :: Python :: Implementation :: CPython",
14+
"Topic :: System :: Networking",
15+
"Typing :: Typed",
16+
]
17+
dynamic = ["version"]
18+
19+
[project.urls]
20+
repository = "https://github.com/vrslev/stompman"
21+
22+
[build-system]
23+
requires = ["hatchling", "hatch-vcs"]
24+
build-backend = "hatchling.build"
25+
26+
[tool.hatch.version]
27+
source = "vcs"
28+
raw-options.root = "../.."
29+
fallback-version = "0"
30+
31+
[tool.hatch.build]
32+
include = ["faststream_stomp"]

packages/stompman/pyproject.toml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
[project]
2+
name = "stompman"
3+
description = "Python STOMP client with pleasant API"
4+
authors = [{ name = "Lev Vereshchagin", email = "mail@vrslev.com" }]
5+
dependencies = []
6+
requires-python = ">=3.11"
7+
license = { text = "MIT" }
8+
keywords = ["stomp", "artemis", "activemq", "messaging", "jms"]
9+
classifiers = [
10+
"Development Status :: 4 - Beta",
11+
"Natural Language :: English",
12+
"Programming Language :: Python :: Implementation :: CPython",
13+
"Topic :: System :: Networking",
14+
"Typing :: Typed",
15+
]
16+
dynamic = ["version", "readme"]
17+
18+
[project.urls]
19+
repository = "https://github.com/vrslev/stompman"
20+
21+
[build-system]
22+
requires = ["hatchling", "hatch-vcs", "hatch-fancy-pypi-readme"]
23+
build-backend = "hatchling.build"
24+
25+
[tool.hatch.version]
26+
source = "vcs"
27+
raw-options.root = "../.."
28+
fallback-version = "0"
29+
30+
[tool.hatch.build]
31+
include = ["stompman"]
32+
33+
[tool.hatch.metadata.hooks.fancy-pypi-readme]
34+
content-type = "text/markdown"
35+
36+
[[tool.hatch.metadata.hooks.fancy-pypi-readme.fragments]]
37+
path = "../../README.md"
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

packages/stompman/test_stompman/__init__.py

Whitespace-only changes.

tests/conftest.py renamed to packages/stompman/test_stompman/conftest.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,8 @@
55
from typing import Any, Literal, Self, TypeVar
66

77
import pytest
8-
from polyfactory.factories.dataclass_factory import DataclassFactory
9-
108
import stompman
9+
from polyfactory.factories.dataclass_factory import DataclassFactory
1110
from stompman.connection import AbstractConnection
1211
from stompman.connection_lifespan import AbstractConnectionLifespan
1312
from stompman.connection_manager import ConnectionManager

tests/integration.py renamed to packages/stompman/test_stompman/integration.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,8 @@
66
from uuid import uuid4
77

88
import pytest
9-
from hypothesis import given, strategies
10-
119
import stompman
10+
from hypothesis import given, strategies
1211
from stompman.serde import (
1312
COMMANDS_TO_FRAMES,
1413
NEWLINE,

tests/test_config.py renamed to packages/stompman/test_stompman/test_config.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@
22

33
import faker
44
import pytest
5-
from polyfactory.factories.typed_dict_factory import TypedDictFactory
6-
75
import stompman
6+
from polyfactory.factories.typed_dict_factory import TypedDictFactory
87
from stompman.config import MultiHostHostLike
98

109

tests/test_connection.py renamed to packages/stompman/test_stompman/test_connection.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
from unittest import mock
77

88
import pytest
9-
109
from stompman import (
1110
AnyServerFrame,
1211
BeginFrame,

tests/test_connection_lifespan.py renamed to packages/stompman/test_stompman/test_connection_lifespan.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
import faker
88
import pytest
9-
109
import stompman.connection_lifespan
1110
from stompman import (
1211
AnyServerFrame,
@@ -22,7 +21,8 @@
2221
ReceiptFrame,
2322
UnsupportedProtocolVersion,
2423
)
25-
from tests.conftest import (
24+
25+
from test_stompman.conftest import (
2626
BaseMockConnection,
2727
EnrichedClient,
2828
build_dataclass,

tests/test_connection_manager.py renamed to packages/stompman/test_stompman/test_connection_manager.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
from unittest import mock
66

77
import pytest
8-
98
from stompman import (
109
AnyServerFrame,
1110
ConnectedFrame,
@@ -18,7 +17,8 @@
1817
MessageFrame,
1918
)
2019
from stompman.connection_manager import ActiveConnectionState
21-
from tests.conftest import BaseMockConnection, EnrichedConnectionManager, NoopLifespan, build_dataclass
20+
21+
from test_stompman.conftest import BaseMockConnection, EnrichedConnectionManager, NoopLifespan, build_dataclass
2222

2323
pytestmark = [pytest.mark.anyio, pytest.mark.usefixtures("mock_sleep")]
2424

tests/test_errors.py renamed to packages/stompman/test_stompman/test_errors.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
from typing import Any
22

33
import pytest
4-
54
import stompman
6-
from tests.conftest import build_dataclass
5+
6+
from test_stompman.conftest import build_dataclass
77

88

99
@pytest.mark.parametrize(

tests/test_frame_serde.py renamed to packages/stompman/test_stompman/test_frame_serde.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import pytest
2-
32
from stompman import (
43
AckFrame,
54
AnyClientFrame,

tests/test_subscription.py renamed to packages/stompman/test_stompman/test_subscription.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66
import faker
77
import pytest
8-
98
import stompman.subscription
109
from stompman import (
1110
AckFrame,
@@ -21,7 +20,8 @@
2120
SubscribeFrame,
2221
UnsubscribeFrame,
2322
)
24-
from tests.conftest import (
23+
24+
from test_stompman.conftest import (
2525
CONNECT_FRAME,
2626
CONNECTED_FRAME,
2727
EnrichedClient,

tests/test_transaction.py renamed to packages/stompman/test_stompman/test_transaction.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@
55

66
import faker
77
import pytest
8-
98
import stompman.transaction
109
from stompman import (
1110
AbortFrame,
1211
BeginFrame,
1312
CommitFrame,
1413
SendFrame,
1514
)
16-
from tests.conftest import (
15+
16+
from test_stompman.conftest import (
1717
CONNECT_FRAME,
1818
CONNECTED_FRAME,
1919
EnrichedClient,

pyproject.toml

Lines changed: 10 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,7 @@
11
[project]
2-
name = "stompman"
3-
description = "Python STOMP client with pleasant API"
4-
authors = [{ name = "Lev Vereshchagin", email = "mail@vrslev.com" }]
5-
dependencies = []
2+
name = "stompman-workspace"
63
requires-python = ">=3.11"
7-
readme = "README.md"
8-
license = { text = "MIT" }
9-
keywords = ["stomp", "artemis", "activemq", "messaging", "jms"]
10-
classifiers = [
11-
"Development Status :: 4 - Beta",
12-
"Natural Language :: English",
13-
"Programming Language :: Python :: Implementation :: CPython",
14-
"Topic :: System :: Networking",
15-
"Typing :: Typed",
16-
]
17-
dynamic = ["version"]
18-
19-
[project.urls]
20-
repository = "https://github.com/vrslev/stompman"
4+
version = "0"
215

226
[dependency-groups]
237
dev = [
@@ -32,12 +16,14 @@ dev = [
3216
"uvloop==0.21.0",
3317
]
3418

35-
[build-system]
36-
requires = ["hatchling", "hatch-vcs"]
37-
build-backend = "hatchling.build"
19+
[tool.uv]
20+
package = false
21+
22+
[tool.uv.workspace]
23+
members = ["packages/*"]
3824

39-
[tool.hatch.version]
40-
source = "vcs"
25+
[tool.uv.sources]
26+
stompman = { workspace = true }
4127

4228

4329
[tool.mypy]
@@ -66,7 +52,7 @@ ignore = [
6652
"PLC2801",
6753
"PLR0913",
6854
]
69-
extend-per-file-ignores = { "tests/*" = ["S101", "SLF001", "ARG", "PLR6301"] }
55+
extend-per-file-ignores = { "*/test_*/*" = ["S101", "SLF001", "ARG", "PLR6301"] }
7056

7157
[tool.pytest.ini_options]
7258
addopts = "--cov -s -vv"

0 commit comments

Comments
 (0)