mockstack 0.9.1__tar.gz → 0.9.2__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 (92) hide show
  1. mockstack-0.9.2/.github/ISSUE_TEMPLATE/bug_report.md +38 -0
  2. mockstack-0.9.2/.github/ISSUE_TEMPLATE/feature_request.md +20 -0
  3. {mockstack-0.9.1 → mockstack-0.9.2}/.gitignore +3 -0
  4. {mockstack-0.9.1 → mockstack-0.9.2}/.pre-commit-config.yaml +2 -1
  5. mockstack-0.9.2/CONTRIBUTING.md +136 -0
  6. {mockstack-0.9.1 → mockstack-0.9.2}/PKG-INFO +1 -1
  7. {mockstack-0.9.1 → mockstack-0.9.2}/mockstack/intent.py +3 -2
  8. {mockstack-0.9.1 → mockstack-0.9.2}/mockstack/main.py +1 -1
  9. {mockstack-0.9.1 → mockstack-0.9.2}/mockstack/strategies/proxyrules.py +1 -1
  10. mockstack-0.9.2/mockstack/tests/routers/__init__.py +0 -0
  11. mockstack-0.9.2/mockstack/tests/strategies/__init__.py +0 -0
  12. {mockstack-0.9.1 → mockstack-0.9.2}/mockstack/tests/test_intent.py +0 -2
  13. {mockstack-0.9.1 → mockstack-0.9.2}/mockstack.egg-info/PKG-INFO +1 -1
  14. {mockstack-0.9.1 → mockstack-0.9.2}/mockstack.egg-info/SOURCES.txt +5 -0
  15. {mockstack-0.9.1 → mockstack-0.9.2}/.dockerignore +0 -0
  16. {mockstack-0.9.1 → mockstack-0.9.2}/.env.example +0 -0
  17. {mockstack-0.9.1 → mockstack-0.9.2}/.github/workflows/ci.yml +0 -0
  18. {mockstack-0.9.1 → mockstack-0.9.2}/.github/workflows/publish-docs.yml +0 -0
  19. {mockstack-0.9.1 → mockstack-0.9.2}/.github/workflows/publish-to-dockerhub.yml +0 -0
  20. {mockstack-0.9.1 → mockstack-0.9.2}/.github/workflows/publish-to-pypi.yml +0 -0
  21. {mockstack-0.9.1 → mockstack-0.9.2}/CODE_OF_CONDUCT.md +0 -0
  22. {mockstack-0.9.1 → mockstack-0.9.2}/Dockerfile +0 -0
  23. {mockstack-0.9.1 → mockstack-0.9.2}/LICENSE +0 -0
  24. {mockstack-0.9.1 → mockstack-0.9.2}/README.md +0 -0
  25. {mockstack-0.9.1 → mockstack-0.9.2}/SECURITY.md +0 -0
  26. {mockstack-0.9.1 → mockstack-0.9.2}/docker-entrypoint.sh +0 -0
  27. {mockstack-0.9.1 → mockstack-0.9.2}/docs/assets/favicon.ico +0 -0
  28. {mockstack-0.9.1 → mockstack-0.9.2}/docs/assets/logo.png +0 -0
  29. {mockstack-0.9.1 → mockstack-0.9.2}/docs/assets/mockstack.png +0 -0
  30. {mockstack-0.9.1 → mockstack-0.9.2}/docs/configuration.md +0 -0
  31. {mockstack-0.9.1 → mockstack-0.9.2}/docs/ollama.md +0 -0
  32. {mockstack-0.9.1 → mockstack-0.9.2}/docs/strategies/base.md +0 -0
  33. {mockstack-0.9.1 → mockstack-0.9.2}/docs/strategies/filefixtures.md +0 -0
  34. {mockstack-0.9.1 → mockstack-0.9.2}/docs/strategies/proxyrules.md +0 -0
  35. {mockstack-0.9.1 → mockstack-0.9.2}/examples/filefixtures-with-templates/.env.example +0 -0
  36. {mockstack-0.9.1 → mockstack-0.9.2}/examples/filefixtures-with-templates/README.md +0 -0
  37. {mockstack-0.9.1 → mockstack-0.9.2}/examples/filefixtures-with-templates/templates/servicename-api-v1-items.j2 +0 -0
  38. {mockstack-0.9.1 → mockstack-0.9.2}/examples/filefixtures-with-templates/templates/servicename2-api-v2-user.533ec889-7c68-45c8-b21e-4a7e455d1234.j2 +0 -0
  39. {mockstack-0.9.1 → mockstack-0.9.2}/examples/llm/README.md +0 -0
  40. {mockstack-0.9.1 → mockstack-0.9.2}/examples/llm/mockstack-langchain-example.ipynb +0 -0
  41. {mockstack-0.9.1 → mockstack-0.9.2}/examples/llm/templates/ollama-openai-v1-chat-completions.j2 +0 -0
  42. {mockstack-0.9.1 → mockstack-0.9.2}/examples/llm/templates/openai-v1-chat-completions.j2 +0 -0
  43. {mockstack-0.9.1 → mockstack-0.9.2}/examples/llm/templates/openai-v1-deployments-gpt-4o-chat-completions.j2 +0 -0
  44. {mockstack-0.9.1 → mockstack-0.9.2}/examples/proxyrules-with-rules-file/.env.example +0 -0
  45. {mockstack-0.9.1 → mockstack-0.9.2}/examples/proxyrules-with-rules-file/README.md +0 -0
  46. {mockstack-0.9.1 → mockstack-0.9.2}/examples/proxyrules-with-rules-file/rules.yml +0 -0
  47. {mockstack-0.9.1 → mockstack-0.9.2}/mkdocs.yml +0 -0
  48. {mockstack-0.9.1 → mockstack-0.9.2}/mockstack/__init__.py +0 -0
  49. {mockstack-0.9.1 → mockstack-0.9.2}/mockstack/config.py +0 -0
  50. {mockstack-0.9.1 → mockstack-0.9.2}/mockstack/constants.py +0 -0
  51. {mockstack-0.9.1 → mockstack-0.9.2}/mockstack/display.py +0 -0
  52. {mockstack-0.9.1 → mockstack-0.9.2}/mockstack/exceptions.py +0 -0
  53. {mockstack-0.9.1 → mockstack-0.9.2}/mockstack/identifiers.py +0 -0
  54. {mockstack-0.9.1 → mockstack-0.9.2}/mockstack/lifespan.py +0 -0
  55. {mockstack-0.9.1 → mockstack-0.9.2}/mockstack/llm/__init__.py +0 -0
  56. {mockstack-0.9.1 → mockstack-0.9.2}/mockstack/llm/ollama.py +0 -0
  57. {mockstack-0.9.1 → mockstack-0.9.2}/mockstack/middleware.py +0 -0
  58. {mockstack-0.9.1 → mockstack-0.9.2}/mockstack/routers/__init__.py +0 -0
  59. {mockstack-0.9.1 → mockstack-0.9.2}/mockstack/routers/catchall.py +0 -0
  60. {mockstack-0.9.1 → mockstack-0.9.2}/mockstack/routers/homepage.py +0 -0
  61. {mockstack-0.9.1 → mockstack-0.9.2}/mockstack/strategies/__init__.py +0 -0
  62. {mockstack-0.9.1 → mockstack-0.9.2}/mockstack/strategies/base.py +0 -0
  63. {mockstack-0.9.1 → mockstack-0.9.2}/mockstack/strategies/create_mixin.py +0 -0
  64. {mockstack-0.9.1 → mockstack-0.9.2}/mockstack/strategies/factory.py +0 -0
  65. {mockstack-0.9.1 → mockstack-0.9.2}/mockstack/strategies/filefixtures.py +0 -0
  66. {mockstack-0.9.1 → mockstack-0.9.2}/mockstack/telemetry.py +0 -0
  67. {mockstack-0.9.1 → mockstack-0.9.2}/mockstack/templating.py +0 -0
  68. {mockstack-0.9.1 → mockstack-0.9.2}/mockstack/tests/__init__.py +0 -0
  69. {mockstack-0.9.1 → mockstack-0.9.2}/mockstack/tests/conftest.py +0 -0
  70. {mockstack-0.9.1/mockstack/tests/fixtures/templates → mockstack-0.9.2/mockstack/tests/fixtures}/__init__.py +0 -0
  71. {mockstack-0.9.1 → mockstack-0.9.2}/mockstack/tests/fixtures/proxyrules.yml +0 -0
  72. {mockstack-0.9.1/mockstack/tests/llm → mockstack-0.9.2/mockstack/tests/fixtures/templates}/__init__.py +0 -0
  73. {mockstack-0.9.1 → mockstack-0.9.2}/mockstack/tests/fixtures/templates/example-template.j2 +0 -0
  74. {mockstack-0.9.1/mockstack/tests/routers → mockstack-0.9.2/mockstack/tests/llm}/__init__.py +0 -0
  75. {mockstack-0.9.1 → mockstack-0.9.2}/mockstack/tests/llm/test_ollama.py +0 -0
  76. {mockstack-0.9.1 → mockstack-0.9.2}/mockstack/tests/routers/test_catchall.py +0 -0
  77. {mockstack-0.9.1 → mockstack-0.9.2}/mockstack/tests/routers/test_homepage.py +0 -0
  78. {mockstack-0.9.1 → mockstack-0.9.2}/mockstack/tests/strategies/test_create_mixin.py +0 -0
  79. {mockstack-0.9.1 → mockstack-0.9.2}/mockstack/tests/strategies/test_filefixtures.py +0 -0
  80. {mockstack-0.9.1 → mockstack-0.9.2}/mockstack/tests/strategies/test_proxyrules.py +0 -0
  81. {mockstack-0.9.1 → mockstack-0.9.2}/mockstack/tests/test_display.py +0 -0
  82. {mockstack-0.9.1 → mockstack-0.9.2}/mockstack/tests/test_identifiers.py +0 -0
  83. {mockstack-0.9.1 → mockstack-0.9.2}/mockstack/tests/test_middleware.py +0 -0
  84. {mockstack-0.9.1 → mockstack-0.9.2}/mockstack/tests/test_telemetry.py +0 -0
  85. {mockstack-0.9.1 → mockstack-0.9.2}/mockstack/tests/test_templating.py +0 -0
  86. {mockstack-0.9.1 → mockstack-0.9.2}/mockstack.egg-info/dependency_links.txt +0 -0
  87. {mockstack-0.9.1 → mockstack-0.9.2}/mockstack.egg-info/entry_points.txt +0 -0
  88. {mockstack-0.9.1 → mockstack-0.9.2}/mockstack.egg-info/requires.txt +0 -0
  89. {mockstack-0.9.1 → mockstack-0.9.2}/mockstack.egg-info/top_level.txt +0 -0
  90. {mockstack-0.9.1 → mockstack-0.9.2}/pyproject.toml +0 -0
  91. {mockstack-0.9.1 → mockstack-0.9.2}/setup.cfg +0 -0
  92. {mockstack-0.9.1 → mockstack-0.9.2}/uv.lock +0 -0
@@ -0,0 +1,38 @@
1
+ ---
2
+ name: Bug report
3
+ about: Create a report to help us improve
4
+ title: ''
5
+ labels: ''
6
+ assignees: ''
7
+
8
+ ---
9
+
10
+ **Describe the bug**
11
+ A clear and concise description of what the bug is.
12
+
13
+ **To Reproduce**
14
+ Steps to reproduce the behavior:
15
+ 1. Go to '...'
16
+ 2. Click on '....'
17
+ 3. Scroll down to '....'
18
+ 4. See error
19
+
20
+ **Expected behavior**
21
+ A clear and concise description of what you expected to happen.
22
+
23
+ **Screenshots**
24
+ If applicable, add screenshots to help explain your problem.
25
+
26
+ **Desktop (please complete the following information):**
27
+ - OS: [e.g. iOS]
28
+ - Browser [e.g. chrome, safari]
29
+ - Version [e.g. 22]
30
+
31
+ **Smartphone (please complete the following information):**
32
+ - Device: [e.g. iPhone6]
33
+ - OS: [e.g. iOS8.1]
34
+ - Browser [e.g. stock browser, safari]
35
+ - Version [e.g. 22]
36
+
37
+ **Additional context**
38
+ Add any other context about the problem here.
@@ -0,0 +1,20 @@
1
+ ---
2
+ name: Feature request
3
+ about: Suggest an idea for this project
4
+ title: ''
5
+ labels: ''
6
+ assignees: ''
7
+
8
+ ---
9
+
10
+ **Is your feature request related to a problem? Please describe.**
11
+ A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
12
+
13
+ **Describe the solution you'd like**
14
+ A clear and concise description of what you want to happen.
15
+
16
+ **Describe alternatives you've considered**
17
+ A clear and concise description of any alternative solutions or features you've considered.
18
+
19
+ **Additional context**
20
+ Add any other context or screenshots about the feature request here.
@@ -127,6 +127,9 @@ celerybeat.pid
127
127
  # SageMath parsed files
128
128
  *.sage.py
129
129
 
130
+ # direnv
131
+ .envrc
132
+
130
133
  # Environments
131
134
  .python-version
132
135
  .env
@@ -19,11 +19,12 @@ repos:
19
19
  - id: check-yaml
20
20
  args: [ --unsafe ]
21
21
  - id: detect-aws-credentials
22
+ args: [ --allow-missing-credentials ]
22
23
  - id: detect-private-key
23
24
  - id: end-of-file-fixer
24
25
  - id: trailing-whitespace
25
26
  - repo: https://github.com/astral-sh/ruff-pre-commit
26
- rev: v0.5.0
27
+ rev: v0.11.9
27
28
  hooks:
28
29
  # Run the linter.
29
30
  - id: ruff
@@ -0,0 +1,136 @@
1
+ # Contributing to mockstack
2
+
3
+ Thank you for your interest in contributing to mockstack! We welcome contributions from the community and appreciate your help in making this project better.
4
+
5
+ ## Getting Started
6
+
7
+ ### Prerequisites
8
+
9
+ - Python 3.11 or higher
10
+ - Git
11
+ - A GitHub account
12
+
13
+ ### Setting Up Your Development Environment
14
+
15
+ 1. Fork the repository on GitHub
16
+ 2. Clone your fork locally:
17
+ ```bash
18
+ git clone https://github.com/YOUR_USERNAME/mockstack.git
19
+ cd mockstack
20
+ ```
21
+ 3. Create a virtual environment:
22
+ ```bash
23
+ uv venv
24
+ source .venv/bin/activate # On Windows: venv\Scripts\activate
25
+ ```
26
+ 4. Install the package in development mode:
27
+ ```bash
28
+ uv sync
29
+ pip install -e .
30
+ ```
31
+
32
+ ## How to Contribute
33
+
34
+ ### Reporting Bugs
35
+
36
+ If you find a bug, please create an issue using our **Bug Report** template. This helps us understand and reproduce the issue quickly. Include:
37
+
38
+ - A clear description of the problem
39
+ - Steps to reproduce the issue
40
+ - Expected vs actual behavior
41
+ - Your environment details (Python version, pytest version, etc.)
42
+ - Any relevant code snippets or error messages
43
+
44
+ ### Suggesting Features
45
+
46
+ We welcome feature suggestions! Please use our **Feature Request** template when creating an issue. Help us understand:
47
+
48
+ - The problem your feature would solve
49
+ - How you envision the feature working
50
+ - Any alternatives you've considered
51
+ - Whether you're willing to help implement it
52
+
53
+ ### Contributing Code
54
+
55
+ 1. **Create a branch** for your work:
56
+ ```bash
57
+ git checkout -b feature/your-feature-name
58
+ ```
59
+
60
+ 2. **Make your changes** following our coding standards:
61
+ - Write clear, readable code
62
+ - Follow PEP 8 style guidelines
63
+ - Add docstrings to new functions and classes
64
+ - Keep commits focused and atomic
65
+
66
+ 3. **Add tests** for your changes:
67
+ - All new functionality should include tests
68
+ - Ensure existing tests still pass
69
+ - Aim for good test coverage
70
+
71
+ 4. **Run the test suite**:
72
+ ```bash
73
+ pytest
74
+ ```
75
+
76
+ 5. **Commit your changes**:
77
+ ```bash
78
+ git add .
79
+ git commit -m "Clear description of your changes"
80
+ ```
81
+
82
+ 6. **Push to your fork**:
83
+ ```bash
84
+ git push origin feature/your-feature-name
85
+ ```
86
+
87
+ 7. **Create a Pull Request** on GitHub with:
88
+ - A clear title and description
89
+ - Reference to any related issues
90
+ - Description of what you changed and why
91
+
92
+ ### Code Style
93
+
94
+ - Follow PEP 8 Python style guidelines. We use `ruff` for linting and formatting.
95
+ - Use meaningful variable and function names
96
+ - Write clear commit messages
97
+ - Keep line length reasonable (ideally under 120 characters)
98
+ - Use type hints where appropriate
99
+
100
+ ### Testing
101
+
102
+ - Write tests for all new functionality
103
+ - Ensure all tests pass before submitting a PR
104
+ - Include both positive and negative test cases
105
+ - Test edge cases and error conditions
106
+
107
+ ## Development Workflow
108
+
109
+ 1. Check existing issues and PRs to avoid duplicate work
110
+ 2. For significant changes, consider opening an issue first to discuss the approach
111
+ 3. Create a focused branch for each feature or bug fix
112
+ 4. Write clear, descriptive commit messages
113
+ 5. Keep PRs reasonably sized and focused
114
+ 6. Be responsive to feedback during code review
115
+
116
+ ## Getting Help
117
+
118
+ - Check existing issues and documentation first
119
+ - Create a new issue if you need help or have questions
120
+ - Be patient and respectful in all interactions
121
+
122
+ ## Code of Conduct
123
+
124
+ Please be respectful and constructive in all interactions. We're all here to learn and improve the project together.
125
+
126
+ See our CODE_OF_CONDUCT.md file in this repository for further details.
127
+
128
+ ## License
129
+
130
+ By contributing to mockstack, you agree that your contributions will be licensed under the same license as the project.
131
+
132
+ See our LICENSE file in this repository for further details.
133
+
134
+ ---
135
+
136
+ Thank you for contributing to mockstack! 🎉
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mockstack
3
- Version: 0.9.1
3
+ Version: 0.9.2
4
4
  Summary: An API mocking workhorse
5
5
  Author-email: Adam Ever-Hadani <mockstack.contact@gmail.com>
6
6
  License-Expression: MIT
@@ -28,6 +28,7 @@ def looks_like_a_search(request: Request) -> bool:
28
28
  request.url.path.endswith("_search"),
29
29
  request.url.path.endswith("/search"),
30
30
  request.url.path.endswith("_query"),
31
+ request.url.path.endswith("/query"),
31
32
  )
32
33
  )
33
34
 
@@ -43,8 +44,8 @@ def looks_like_a_command(request: Request) -> bool:
43
44
  (
44
45
  request.url.path.endswith("_command"),
45
46
  request.url.path.endswith("/command"),
46
- request.url.path.endswith("_request"),
47
- request.url.path.endswith("/request"),
47
+ request.url.path.endswith("_cmd"),
48
+ request.url.path.endswith("/cmd"),
48
49
  request.url.path.endswith("_run"),
49
50
  request.url.path.endswith("/run"),
50
51
  request.url.path.endswith("_execute"),
@@ -47,4 +47,4 @@ def version():
47
47
  from importlib.metadata import version
48
48
 
49
49
  pkg_version = version("mockstack")
50
- print(f"mockstack {pkg_version}")
50
+ print(f"mockstack v{pkg_version}")
@@ -130,7 +130,7 @@ class ProxyRulesStrategy(BaseStrategy, CreateMixin):
130
130
  )
131
131
 
132
132
  url = rule.apply(request)
133
- self.logger.info(f"Redirecting to: {url}")
133
+ self.logger.info(f"[rule:{rule.name}] Redirecting to: {url}")
134
134
  self.update_opentelemetry(request, rule, url)
135
135
 
136
136
  match self.redirect_via:
File without changes
File without changes
@@ -68,8 +68,6 @@ def command_paths():
68
68
  return [
69
69
  "/api/_command",
70
70
  "/api/command",
71
- "/api/_request",
72
- "/api/request",
73
71
  "/api/_run",
74
72
  "/api/run",
75
73
  "/api/_execute",
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mockstack
3
- Version: 0.9.1
3
+ Version: 0.9.2
4
4
  Summary: An API mocking workhorse
5
5
  Author-email: Adam Ever-Hadani <mockstack.contact@gmail.com>
6
6
  License-Expression: MIT
@@ -3,6 +3,7 @@
3
3
  .gitignore
4
4
  .pre-commit-config.yaml
5
5
  CODE_OF_CONDUCT.md
6
+ CONTRIBUTING.md
6
7
  Dockerfile
7
8
  LICENSE
8
9
  README.md
@@ -11,6 +12,8 @@ docker-entrypoint.sh
11
12
  mkdocs.yml
12
13
  pyproject.toml
13
14
  uv.lock
15
+ .github/ISSUE_TEMPLATE/bug_report.md
16
+ .github/ISSUE_TEMPLATE/feature_request.md
14
17
  .github/workflows/ci.yml
15
18
  .github/workflows/publish-docs.yml
16
19
  .github/workflows/publish-to-dockerhub.yml
@@ -72,6 +75,7 @@ mockstack/tests/test_intent.py
72
75
  mockstack/tests/test_middleware.py
73
76
  mockstack/tests/test_telemetry.py
74
77
  mockstack/tests/test_templating.py
78
+ mockstack/tests/fixtures/__init__.py
75
79
  mockstack/tests/fixtures/proxyrules.yml
76
80
  mockstack/tests/fixtures/templates/__init__.py
77
81
  mockstack/tests/fixtures/templates/example-template.j2
@@ -80,6 +84,7 @@ mockstack/tests/llm/test_ollama.py
80
84
  mockstack/tests/routers/__init__.py
81
85
  mockstack/tests/routers/test_catchall.py
82
86
  mockstack/tests/routers/test_homepage.py
87
+ mockstack/tests/strategies/__init__.py
83
88
  mockstack/tests/strategies/test_create_mixin.py
84
89
  mockstack/tests/strategies/test_filefixtures.py
85
90
  mockstack/tests/strategies/test_proxyrules.py
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes