mockstack 0.0.5__tar.gz → 0.1.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. {mockstack-0.0.5 → mockstack-0.1.1}/.github/workflows/ci.yml +3 -1
  2. {mockstack-0.0.5 → mockstack-0.1.1}/.github/workflows/publish-to-pypi.yml +1 -1
  3. {mockstack-0.0.5/mockstack.egg-info → mockstack-0.1.1}/PKG-INFO +27 -15
  4. {mockstack-0.0.5 → mockstack-0.1.1}/README.md +24 -14
  5. {mockstack-0.0.5 → mockstack-0.1.1}/mockstack/main.py +24 -3
  6. {mockstack-0.0.5 → mockstack-0.1.1}/mockstack/routers/catchall.py +1 -1
  7. {mockstack-0.0.5 → mockstack-0.1.1/mockstack.egg-info}/PKG-INFO +27 -15
  8. {mockstack-0.0.5 → mockstack-0.1.1}/mockstack.egg-info/SOURCES.txt +2 -1
  9. mockstack-0.1.1/mockstack.egg-info/entry_points.txt +2 -0
  10. {mockstack-0.0.5 → mockstack-0.1.1}/mockstack.egg-info/requires.txt +2 -0
  11. {mockstack-0.0.5 → mockstack-0.1.1}/pyproject.toml +9 -1
  12. {mockstack-0.0.5 → mockstack-0.1.1}/uv.lock +5 -2
  13. {mockstack-0.0.5 → mockstack-0.1.1}/.env.example +0 -0
  14. {mockstack-0.0.5 → mockstack-0.1.1}/.gitignore +0 -0
  15. {mockstack-0.0.5 → mockstack-0.1.1}/.pre-commit-config.yaml +0 -0
  16. {mockstack-0.0.5 → mockstack-0.1.1}/CODE_OF_CONDUCT.md +0 -0
  17. {mockstack-0.0.5 → mockstack-0.1.1}/LICENSE +0 -0
  18. {mockstack-0.0.5 → mockstack-0.1.1}/SECURITY.md +0 -0
  19. {mockstack-0.0.5 → mockstack-0.1.1}/mockstack/__init__.py +0 -0
  20. {mockstack-0.0.5 → mockstack-0.1.1}/mockstack/config.py +0 -0
  21. {mockstack-0.0.5 → mockstack-0.1.1}/mockstack/display.py +0 -0
  22. {mockstack-0.0.5 → mockstack-0.1.1}/mockstack/identifiers.py +0 -0
  23. {mockstack-0.0.5 → mockstack-0.1.1}/mockstack/lifespan.py +0 -0
  24. {mockstack-0.0.5 → mockstack-0.1.1}/mockstack/middleware.py +0 -0
  25. {mockstack-0.0.5 → mockstack-0.1.1}/mockstack/routers/__init__.py +0 -0
  26. {mockstack-0.0.5 → mockstack-0.1.1}/mockstack/routers/homepage.py +0 -0
  27. {mockstack-0.0.5 → mockstack-0.1.1}/mockstack/strategies/__init__.py +0 -0
  28. {mockstack-0.0.5 → mockstack-0.1.1}/mockstack/strategies/base.py +0 -0
  29. {mockstack-0.0.5 → mockstack-0.1.1}/mockstack/strategies/factory.py +0 -0
  30. {mockstack-0.0.5 → mockstack-0.1.1}/mockstack/strategies/filefixtures.py +0 -0
  31. /mockstack-0.0.5/mockstack/opentelemetry.py → /mockstack-0.1.1/mockstack/telemetry.py +0 -0
  32. {mockstack-0.0.5 → mockstack-0.1.1}/mockstack/templating.py +0 -0
  33. {mockstack-0.0.5 → mockstack-0.1.1}/mockstack/tests/__init__.py +0 -0
  34. {mockstack-0.0.5 → mockstack-0.1.1}/mockstack/tests/conftest.py +0 -0
  35. {mockstack-0.0.5 → mockstack-0.1.1}/mockstack/tests/fixtures/templates/__init__.py +0 -0
  36. {mockstack-0.0.5 → mockstack-0.1.1}/mockstack/tests/fixtures/templates/example-template.j2 +0 -0
  37. {mockstack-0.0.5 → mockstack-0.1.1}/mockstack/tests/routers/__init__.py +0 -0
  38. {mockstack-0.0.5 → mockstack-0.1.1}/mockstack/tests/routers/test_catchall.py +0 -0
  39. {mockstack-0.0.5 → mockstack-0.1.1}/mockstack/tests/routers/test_homepage.py +0 -0
  40. {mockstack-0.0.5 → mockstack-0.1.1}/mockstack/tests/strategies/test_filefixtures.py +0 -0
  41. {mockstack-0.0.5 → mockstack-0.1.1}/mockstack/tests/test_display.py +0 -0
  42. {mockstack-0.0.5 → mockstack-0.1.1}/mockstack/tests/test_identifiers.py +0 -0
  43. {mockstack-0.0.5 → mockstack-0.1.1}/mockstack/tests/test_middleware.py +0 -0
  44. {mockstack-0.0.5 → mockstack-0.1.1}/mockstack/tests/test_templating.py +0 -0
  45. {mockstack-0.0.5 → mockstack-0.1.1}/mockstack.egg-info/dependency_links.txt +0 -0
  46. {mockstack-0.0.5 → mockstack-0.1.1}/mockstack.egg-info/top_level.txt +0 -0
  47. {mockstack-0.0.5 → mockstack-0.1.1}/setup.cfg +0 -0
@@ -31,7 +31,7 @@ jobs:
31
31
  version: "latest"
32
32
  - name: Install ruff
33
33
  uses: astral-sh/ruff-action@v3
34
- with:
34
+ with:
35
35
  version: "latest"
36
36
  - name: Set up Python ${{ matrix.python-version }}
37
37
  uses: actions/setup-python@v3
@@ -43,5 +43,7 @@ jobs:
43
43
  run: |
44
44
  ruff check
45
45
  ruff format
46
+ - name: Run mypy
47
+ run: uv run mypy mockstack
46
48
  - name: Run tests
47
49
  run: uv run pytest
@@ -1,4 +1,4 @@
1
- name: Publish Python distribution to TestPyPI
1
+ name: Publish to PyPI
2
2
 
3
3
  permissions:
4
4
  contents: read
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mockstack
3
- Version: 0.0.5
3
+ Version: 0.1.1
4
4
  Summary: An API mocking workhorse
5
5
  License-Expression: MIT
6
6
  Project-URL: Homepage, https://github.com/adamhadani/mockstack
@@ -16,12 +16,15 @@ Requires-Dist: opentelemetry-distro[otlp]>=0.53b1
16
16
  Requires-Dist: opentelemetry-instrumentation-fastapi>=0.53b1
17
17
  Requires-Dist: pydantic>=2.11.3
18
18
  Requires-Dist: pydantic-settings>=2.9.1
19
+ Requires-Dist: typer>=0.15.2
20
+ Requires-Dist: uvicorn>=0.34.2
19
21
  Dynamic: license-file
20
22
 
21
23
  # mockstack
22
24
 
23
25
  [![CI](https://github.com/adamhadani/mockstack/actions/workflows/ci.yml/badge.svg)](https://github.com/adamhadani/mockstack/actions/workflows/ci.yml)
24
- ![GitHub License](https://img.shields.io/github/license/adamhadani/mockstack)
26
+ [![GitHub License](https://img.shields.io/github/license/adamhadani/mockstack)](https://github.com/adamhadani/mockstack/blob/main/LICENSE)
27
+ [![PyPI - Version](https://img.shields.io/pypi/v/mockstack)](https://pypi.org/project/mockstack/)
25
28
 
26
29
  An API mocking workhorse :racehorse:
27
30
 
@@ -37,27 +40,20 @@ Highlights include:
37
40
 
38
41
  ## Installation
39
42
 
40
- Install using [uv](https://docs.astral.sh/uv/). This will create a virtualenv for you and install all dependencies:
43
+ Install using [uv](https://docs.astral.sh/uv/). This package conforms the concept of a [tool](https://docs.astral.sh/uv/concepts/tools/) and hence can simply install / run with `uvx`:
41
44
 
42
- uv sync
43
- uv pip install -e .
44
-
45
-
46
- ## Usage
45
+ uvx mockstack
47
46
 
48
- Copy the included [.env.example](.env.example) file to `.env` and fill in configuration as needed based on the given examples.
49
-
50
- Run in development mode (for live-reload of changes when developing):
47
+ or install into a persistent environment and add it to the PATH with:
51
48
 
52
- uv run fastapi dev mockstack/main.py
49
+ uv tool install mockstack
53
50
 
54
- Or, run in production mode:
55
51
 
56
- uv run fastapi run mockstack/main.py
52
+ ## Usage
57
53
 
58
54
  Available configuration options are [here](./mockstack/config.py). Setting individual options can be done with env. variables as in the following example:
59
55
 
60
- MOCKSTACK__OPENTELEMETRY__ENABLED=true MOCKSTACK__OPENTELEMETRY__CAPTURE_RESPONSE_BODY=true uv run fastapi run mockstack/main.py
56
+ MOCKSTACK__OPENTELEMETRY__ENABLED=true MOCKSTACK__OPENTELEMETRY__CAPTURE_RESPONSE_BODY=true uv run
61
57
 
62
58
  Out of the box, you get the following behavior when using the default `filefixtures` strategy:
63
59
 
@@ -80,3 +76,19 @@ Invoke unit-tests with:
80
76
  Linting, formatting, static type checks etc. are all managed via [pre-commit](https://pre-commit.com/) hooks. These will run automatically on every commit. You can invoke these manually on all files with:
81
77
 
82
78
  pre-commit run --all-files
79
+
80
+
81
+ ## Contributing
82
+
83
+ If you are contributing to development, you will want to clone this project, and can then install it locally with:
84
+
85
+ gh repo clone adamhadani/mockstack
86
+ cd mockstack/
87
+ uv sync
88
+ uv pip install -e .
89
+
90
+ Copy the included [.env.example](.env.example) file to `.env` and fill in configuration as needed based on the given examples.
91
+
92
+ Run in development mode (for live-reload of changes when developing):
93
+
94
+ uv run uvicorn --factory mockstack.main:create_app --reload
@@ -1,7 +1,8 @@
1
1
  # mockstack
2
2
 
3
3
  [![CI](https://github.com/adamhadani/mockstack/actions/workflows/ci.yml/badge.svg)](https://github.com/adamhadani/mockstack/actions/workflows/ci.yml)
4
- ![GitHub License](https://img.shields.io/github/license/adamhadani/mockstack)
4
+ [![GitHub License](https://img.shields.io/github/license/adamhadani/mockstack)](https://github.com/adamhadani/mockstack/blob/main/LICENSE)
5
+ [![PyPI - Version](https://img.shields.io/pypi/v/mockstack)](https://pypi.org/project/mockstack/)
5
6
 
6
7
  An API mocking workhorse :racehorse:
7
8
 
@@ -17,27 +18,20 @@ Highlights include:
17
18
 
18
19
  ## Installation
19
20
 
20
- Install using [uv](https://docs.astral.sh/uv/). This will create a virtualenv for you and install all dependencies:
21
+ Install using [uv](https://docs.astral.sh/uv/). This package conforms the concept of a [tool](https://docs.astral.sh/uv/concepts/tools/) and hence can simply install / run with `uvx`:
21
22
 
22
- uv sync
23
- uv pip install -e .
24
-
25
-
26
- ## Usage
23
+ uvx mockstack
27
24
 
28
- Copy the included [.env.example](.env.example) file to `.env` and fill in configuration as needed based on the given examples.
29
-
30
- Run in development mode (for live-reload of changes when developing):
25
+ or install into a persistent environment and add it to the PATH with:
31
26
 
32
- uv run fastapi dev mockstack/main.py
27
+ uv tool install mockstack
33
28
 
34
- Or, run in production mode:
35
29
 
36
- uv run fastapi run mockstack/main.py
30
+ ## Usage
37
31
 
38
32
  Available configuration options are [here](./mockstack/config.py). Setting individual options can be done with env. variables as in the following example:
39
33
 
40
- MOCKSTACK__OPENTELEMETRY__ENABLED=true MOCKSTACK__OPENTELEMETRY__CAPTURE_RESPONSE_BODY=true uv run fastapi run mockstack/main.py
34
+ MOCKSTACK__OPENTELEMETRY__ENABLED=true MOCKSTACK__OPENTELEMETRY__CAPTURE_RESPONSE_BODY=true uv run
41
35
 
42
36
  Out of the box, you get the following behavior when using the default `filefixtures` strategy:
43
37
 
@@ -60,3 +54,19 @@ Invoke unit-tests with:
60
54
  Linting, formatting, static type checks etc. are all managed via [pre-commit](https://pre-commit.com/) hooks. These will run automatically on every commit. You can invoke these manually on all files with:
61
55
 
62
56
  pre-commit run --all-files
57
+
58
+
59
+ ## Contributing
60
+
61
+ If you are contributing to development, you will want to clone this project, and can then install it locally with:
62
+
63
+ gh repo clone adamhadani/mockstack
64
+ cd mockstack/
65
+ uv sync
66
+ uv pip install -e .
67
+
68
+ Copy the included [.env.example](.env.example) file to `.env` and fill in configuration as needed based on the given examples.
69
+
70
+ Run in development mode (for live-reload of changes when developing):
71
+
72
+ uv run uvicorn --factory mockstack.main:create_app --reload
@@ -1,14 +1,17 @@
1
1
  """Application entrypoints."""
2
2
 
3
3
  from fastapi import FastAPI
4
+ from typer import Typer
4
5
 
5
6
  from mockstack.config import settings_provider
6
7
  from mockstack.lifespan import lifespan_provider
7
8
  from mockstack.middleware import middleware_provider
8
- from mockstack.opentelemetry import opentelemetry_provider
9
9
  from mockstack.routers.catchall import catchall_router_provider
10
10
  from mockstack.routers.homepage import homepage_router_provider
11
11
  from mockstack.strategies.factory import strategy_provider
12
+ from mockstack.telemetry import opentelemetry_provider
13
+
14
+ cli = Typer()
12
15
 
13
16
 
14
17
  def create_app() -> FastAPI:
@@ -27,5 +30,23 @@ def create_app() -> FastAPI:
27
30
  return app
28
31
 
29
32
 
30
- # expose top-level app object for fastapi cli
31
- app = create_app()
33
+ @cli.command()
34
+ def run(host: str = "0.0.0.0", port: int = 8000):
35
+ """mockstack run CLI entrypoint."""
36
+ import uvicorn
37
+
38
+ app = create_app()
39
+ uvicorn.run(app, host=host, port=port)
40
+
41
+
42
+ @cli.command()
43
+ def version():
44
+ """mockstack version CLI entrypoint."""
45
+ from importlib.metadata import version
46
+
47
+ pkg_version = version("mockstack")
48
+ print(f"mockstack {pkg_version}")
49
+
50
+
51
+ if __name__ == "__main__":
52
+ cli()
@@ -5,7 +5,7 @@ from opentelemetry import trace
5
5
  from opentelemetry.propagate import extract
6
6
 
7
7
  from mockstack.config import Settings
8
- from mockstack.opentelemetry import span_name_for
8
+ from mockstack.telemetry import span_name_for
9
9
 
10
10
 
11
11
  def catchall_router_provider(app: FastAPI, settings: Settings) -> None:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mockstack
3
- Version: 0.0.5
3
+ Version: 0.1.1
4
4
  Summary: An API mocking workhorse
5
5
  License-Expression: MIT
6
6
  Project-URL: Homepage, https://github.com/adamhadani/mockstack
@@ -16,12 +16,15 @@ Requires-Dist: opentelemetry-distro[otlp]>=0.53b1
16
16
  Requires-Dist: opentelemetry-instrumentation-fastapi>=0.53b1
17
17
  Requires-Dist: pydantic>=2.11.3
18
18
  Requires-Dist: pydantic-settings>=2.9.1
19
+ Requires-Dist: typer>=0.15.2
20
+ Requires-Dist: uvicorn>=0.34.2
19
21
  Dynamic: license-file
20
22
 
21
23
  # mockstack
22
24
 
23
25
  [![CI](https://github.com/adamhadani/mockstack/actions/workflows/ci.yml/badge.svg)](https://github.com/adamhadani/mockstack/actions/workflows/ci.yml)
24
- ![GitHub License](https://img.shields.io/github/license/adamhadani/mockstack)
26
+ [![GitHub License](https://img.shields.io/github/license/adamhadani/mockstack)](https://github.com/adamhadani/mockstack/blob/main/LICENSE)
27
+ [![PyPI - Version](https://img.shields.io/pypi/v/mockstack)](https://pypi.org/project/mockstack/)
25
28
 
26
29
  An API mocking workhorse :racehorse:
27
30
 
@@ -37,27 +40,20 @@ Highlights include:
37
40
 
38
41
  ## Installation
39
42
 
40
- Install using [uv](https://docs.astral.sh/uv/). This will create a virtualenv for you and install all dependencies:
43
+ Install using [uv](https://docs.astral.sh/uv/). This package conforms the concept of a [tool](https://docs.astral.sh/uv/concepts/tools/) and hence can simply install / run with `uvx`:
41
44
 
42
- uv sync
43
- uv pip install -e .
44
-
45
-
46
- ## Usage
45
+ uvx mockstack
47
46
 
48
- Copy the included [.env.example](.env.example) file to `.env` and fill in configuration as needed based on the given examples.
49
-
50
- Run in development mode (for live-reload of changes when developing):
47
+ or install into a persistent environment and add it to the PATH with:
51
48
 
52
- uv run fastapi dev mockstack/main.py
49
+ uv tool install mockstack
53
50
 
54
- Or, run in production mode:
55
51
 
56
- uv run fastapi run mockstack/main.py
52
+ ## Usage
57
53
 
58
54
  Available configuration options are [here](./mockstack/config.py). Setting individual options can be done with env. variables as in the following example:
59
55
 
60
- MOCKSTACK__OPENTELEMETRY__ENABLED=true MOCKSTACK__OPENTELEMETRY__CAPTURE_RESPONSE_BODY=true uv run fastapi run mockstack/main.py
56
+ MOCKSTACK__OPENTELEMETRY__ENABLED=true MOCKSTACK__OPENTELEMETRY__CAPTURE_RESPONSE_BODY=true uv run
61
57
 
62
58
  Out of the box, you get the following behavior when using the default `filefixtures` strategy:
63
59
 
@@ -80,3 +76,19 @@ Invoke unit-tests with:
80
76
  Linting, formatting, static type checks etc. are all managed via [pre-commit](https://pre-commit.com/) hooks. These will run automatically on every commit. You can invoke these manually on all files with:
81
77
 
82
78
  pre-commit run --all-files
79
+
80
+
81
+ ## Contributing
82
+
83
+ If you are contributing to development, you will want to clone this project, and can then install it locally with:
84
+
85
+ gh repo clone adamhadani/mockstack
86
+ cd mockstack/
87
+ uv sync
88
+ uv pip install -e .
89
+
90
+ Copy the included [.env.example](.env.example) file to `.env` and fill in configuration as needed based on the given examples.
91
+
92
+ Run in development mode (for live-reload of changes when developing):
93
+
94
+ uv run uvicorn --factory mockstack.main:create_app --reload
@@ -16,11 +16,12 @@ mockstack/identifiers.py
16
16
  mockstack/lifespan.py
17
17
  mockstack/main.py
18
18
  mockstack/middleware.py
19
- mockstack/opentelemetry.py
19
+ mockstack/telemetry.py
20
20
  mockstack/templating.py
21
21
  mockstack.egg-info/PKG-INFO
22
22
  mockstack.egg-info/SOURCES.txt
23
23
  mockstack.egg-info/dependency_links.txt
24
+ mockstack.egg-info/entry_points.txt
24
25
  mockstack.egg-info/requires.txt
25
26
  mockstack.egg-info/top_level.txt
26
27
  mockstack/routers/__init__.py
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ mockstack = mockstack.main:cli
@@ -5,3 +5,5 @@ opentelemetry-distro[otlp]>=0.53b1
5
5
  opentelemetry-instrumentation-fastapi>=0.53b1
6
6
  pydantic>=2.11.3
7
7
  pydantic-settings>=2.9.1
8
+ typer>=0.15.2
9
+ uvicorn>=0.34.2
@@ -4,7 +4,6 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "mockstack"
7
- version = "0.0.5"
8
7
  description = "An API mocking workhorse"
9
8
  readme = "README.md"
10
9
  license = "MIT"
@@ -19,12 +18,18 @@ dependencies = [
19
18
  "opentelemetry-instrumentation-fastapi>=0.53b1",
20
19
  "pydantic>=2.11.3",
21
20
  "pydantic-settings>=2.9.1",
21
+ "typer>=0.15.2",
22
+ "uvicorn>=0.34.2",
22
23
  ]
24
+ dynamic = ["version"]
23
25
 
24
26
  [project.urls]
25
27
  Homepage = "https://github.com/adamhadani/mockstack"
26
28
  Issues = "https://github.com/adamhadani/mockstack/issues"
27
29
 
30
+ [project.scripts]
31
+ mockstack = "mockstack.main:cli"
32
+
28
33
  [dependency-groups]
29
34
  dev = [
30
35
  "mypy>=1.15.0",
@@ -33,6 +38,9 @@ dev = [
33
38
  "pytest-cov>=6.1.1",
34
39
  ]
35
40
 
41
+ [tool.setuptools_scm]
42
+ # can be empty if no extra settings are needed, presence enables setuptools-scm
43
+
36
44
  [tool.mypy]
37
45
  namespace_packages = true
38
46
 
@@ -477,8 +477,7 @@ wheels = [
477
477
 
478
478
  [[package]]
479
479
  name = "mockstack"
480
- version = "0.2.0"
481
- source = { virtual = "." }
480
+ source = { editable = "." }
482
481
  dependencies = [
483
482
  { name = "colorama" },
484
483
  { name = "fastapi", extra = ["standard"] },
@@ -487,6 +486,8 @@ dependencies = [
487
486
  { name = "opentelemetry-instrumentation-fastapi" },
488
487
  { name = "pydantic" },
489
488
  { name = "pydantic-settings" },
489
+ { name = "typer" },
490
+ { name = "uvicorn" },
490
491
  ]
491
492
 
492
493
  [package.dev-dependencies]
@@ -506,6 +507,8 @@ requires-dist = [
506
507
  { name = "opentelemetry-instrumentation-fastapi", specifier = ">=0.53b1" },
507
508
  { name = "pydantic", specifier = ">=2.11.3" },
508
509
  { name = "pydantic-settings", specifier = ">=2.9.1" },
510
+ { name = "typer", specifier = ">=0.15.2" },
511
+ { name = "uvicorn", specifier = ">=0.34.2" },
509
512
  ]
510
513
 
511
514
  [package.metadata.requires-dev]
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes