mockstack 0.0.3__tar.gz → 0.0.5__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.
- mockstack-0.0.5/.env.example +7 -0
- mockstack-0.0.5/.github/workflows/ci.yml +47 -0
- mockstack-0.0.5/.github/workflows/publish-to-pypi.yml +109 -0
- mockstack-0.0.5/.gitignore +166 -0
- mockstack-0.0.5/.pre-commit-config.yaml +35 -0
- mockstack-0.0.5/CODE_OF_CONDUCT.md +128 -0
- mockstack-0.0.5/PKG-INFO +82 -0
- mockstack-0.0.5/SECURITY.md +14 -0
- mockstack-0.0.5/mockstack/tests/fixtures/templates/example-template.j2 +5 -0
- mockstack-0.0.5/mockstack.egg-info/PKG-INFO +82 -0
- {mockstack-0.0.3 → mockstack-0.0.5}/mockstack.egg-info/SOURCES.txt +9 -0
- {mockstack-0.0.3 → mockstack-0.0.5}/pyproject.toml +14 -1
- mockstack-0.0.5/uv.lock +1332 -0
- mockstack-0.0.3/PKG-INFO +0 -13
- mockstack-0.0.3/mockstack.egg-info/PKG-INFO +0 -13
- {mockstack-0.0.3 → mockstack-0.0.5}/LICENSE +0 -0
- {mockstack-0.0.3 → mockstack-0.0.5}/README.md +0 -0
- {mockstack-0.0.3 → mockstack-0.0.5}/mockstack/__init__.py +0 -0
- {mockstack-0.0.3 → mockstack-0.0.5}/mockstack/config.py +0 -0
- {mockstack-0.0.3 → mockstack-0.0.5}/mockstack/display.py +0 -0
- {mockstack-0.0.3 → mockstack-0.0.5}/mockstack/identifiers.py +0 -0
- {mockstack-0.0.3 → mockstack-0.0.5}/mockstack/lifespan.py +0 -0
- {mockstack-0.0.3 → mockstack-0.0.5}/mockstack/main.py +0 -0
- {mockstack-0.0.3 → mockstack-0.0.5}/mockstack/middleware.py +0 -0
- {mockstack-0.0.3 → mockstack-0.0.5}/mockstack/opentelemetry.py +0 -0
- {mockstack-0.0.3 → mockstack-0.0.5}/mockstack/routers/__init__.py +0 -0
- {mockstack-0.0.3 → mockstack-0.0.5}/mockstack/routers/catchall.py +0 -0
- {mockstack-0.0.3 → mockstack-0.0.5}/mockstack/routers/homepage.py +0 -0
- {mockstack-0.0.3 → mockstack-0.0.5}/mockstack/strategies/__init__.py +0 -0
- {mockstack-0.0.3 → mockstack-0.0.5}/mockstack/strategies/base.py +0 -0
- {mockstack-0.0.3 → mockstack-0.0.5}/mockstack/strategies/factory.py +0 -0
- {mockstack-0.0.3 → mockstack-0.0.5}/mockstack/strategies/filefixtures.py +0 -0
- {mockstack-0.0.3 → mockstack-0.0.5}/mockstack/templating.py +0 -0
- {mockstack-0.0.3 → mockstack-0.0.5}/mockstack/tests/__init__.py +0 -0
- {mockstack-0.0.3 → mockstack-0.0.5}/mockstack/tests/conftest.py +0 -0
- {mockstack-0.0.3 → mockstack-0.0.5}/mockstack/tests/fixtures/templates/__init__.py +0 -0
- {mockstack-0.0.3 → mockstack-0.0.5}/mockstack/tests/routers/__init__.py +0 -0
- {mockstack-0.0.3 → mockstack-0.0.5}/mockstack/tests/routers/test_catchall.py +0 -0
- {mockstack-0.0.3 → mockstack-0.0.5}/mockstack/tests/routers/test_homepage.py +0 -0
- {mockstack-0.0.3 → mockstack-0.0.5}/mockstack/tests/strategies/test_filefixtures.py +0 -0
- {mockstack-0.0.3 → mockstack-0.0.5}/mockstack/tests/test_display.py +0 -0
- {mockstack-0.0.3 → mockstack-0.0.5}/mockstack/tests/test_identifiers.py +0 -0
- {mockstack-0.0.3 → mockstack-0.0.5}/mockstack/tests/test_middleware.py +0 -0
- {mockstack-0.0.3 → mockstack-0.0.5}/mockstack/tests/test_templating.py +0 -0
- {mockstack-0.0.3 → mockstack-0.0.5}/mockstack.egg-info/dependency_links.txt +0 -0
- {mockstack-0.0.3 → mockstack-0.0.5}/mockstack.egg-info/requires.txt +0 -0
- {mockstack-0.0.3 → mockstack-0.0.5}/mockstack.egg-info/top_level.txt +0 -0
- {mockstack-0.0.3 → mockstack-0.0.5}/setup.cfg +0 -0
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
|
|
2
|
+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
|
|
3
|
+
|
|
4
|
+
name: CI
|
|
5
|
+
|
|
6
|
+
permissions:
|
|
7
|
+
contents: read
|
|
8
|
+
pull-requests: write
|
|
9
|
+
|
|
10
|
+
on:
|
|
11
|
+
push:
|
|
12
|
+
branches: [ "main" ]
|
|
13
|
+
pull_request:
|
|
14
|
+
branches: [ "main" ]
|
|
15
|
+
|
|
16
|
+
jobs:
|
|
17
|
+
build:
|
|
18
|
+
|
|
19
|
+
runs-on: ubuntu-latest
|
|
20
|
+
strategy:
|
|
21
|
+
fail-fast: false
|
|
22
|
+
matrix:
|
|
23
|
+
python-version: ["3.11", "3.12", "3.13"]
|
|
24
|
+
|
|
25
|
+
steps:
|
|
26
|
+
- uses: actions/checkout@v4
|
|
27
|
+
- name: Install uv and set the python version
|
|
28
|
+
uses: astral-sh/setup-uv@v5
|
|
29
|
+
with:
|
|
30
|
+
python-version: ${{ matrix.python-version }}
|
|
31
|
+
version: "latest"
|
|
32
|
+
- name: Install ruff
|
|
33
|
+
uses: astral-sh/ruff-action@v3
|
|
34
|
+
with:
|
|
35
|
+
version: "latest"
|
|
36
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
37
|
+
uses: actions/setup-python@v3
|
|
38
|
+
with:
|
|
39
|
+
python-version: ${{ matrix.python-version }}
|
|
40
|
+
- name: Install the project
|
|
41
|
+
run: uv sync --all-extras --dev
|
|
42
|
+
- name: Run ruff lint and formatting checks
|
|
43
|
+
run: |
|
|
44
|
+
ruff check
|
|
45
|
+
ruff format
|
|
46
|
+
- name: Run tests
|
|
47
|
+
run: uv run pytest
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
name: Publish Python distribution to TestPyPI
|
|
2
|
+
|
|
3
|
+
permissions:
|
|
4
|
+
contents: read
|
|
5
|
+
pull-requests: write
|
|
6
|
+
|
|
7
|
+
on: push
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
build:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
steps:
|
|
13
|
+
- uses: actions/checkout@v4
|
|
14
|
+
with:
|
|
15
|
+
persist-credentials: false
|
|
16
|
+
- name: Set up Python
|
|
17
|
+
uses: actions/setup-python@v5
|
|
18
|
+
with:
|
|
19
|
+
python-version: "3.x"
|
|
20
|
+
- name: Install pypa/build
|
|
21
|
+
run: >-
|
|
22
|
+
python3 -m pip install build --user
|
|
23
|
+
- name: Build a binary wheel and a source tarball
|
|
24
|
+
run: python3 -m build
|
|
25
|
+
- name: Store the distribution packages
|
|
26
|
+
uses: actions/upload-artifact@v4
|
|
27
|
+
with:
|
|
28
|
+
name: python-package-distributions
|
|
29
|
+
path: dist/
|
|
30
|
+
|
|
31
|
+
publish-to-pypi:
|
|
32
|
+
name: >-
|
|
33
|
+
Publish Python distribution to PyPI
|
|
34
|
+
if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
|
|
35
|
+
needs:
|
|
36
|
+
- build
|
|
37
|
+
runs-on: ubuntu-latest
|
|
38
|
+
environment:
|
|
39
|
+
name: pypi
|
|
40
|
+
url: https://pypi.org/p/mockstack
|
|
41
|
+
permissions:
|
|
42
|
+
id-token: write # IMPORTANT: mandatory for trusted publishing
|
|
43
|
+
steps:
|
|
44
|
+
- name: Download all the dists
|
|
45
|
+
uses: actions/download-artifact@v4
|
|
46
|
+
with:
|
|
47
|
+
name: python-package-distributions
|
|
48
|
+
path: dist/
|
|
49
|
+
- name: Publish distribution to PyPI
|
|
50
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
51
|
+
with:
|
|
52
|
+
verbose: true
|
|
53
|
+
|
|
54
|
+
github-release:
|
|
55
|
+
name: >-
|
|
56
|
+
Sign the Python distribution with Sigstore and upload them to GitHub Release
|
|
57
|
+
needs:
|
|
58
|
+
- publish-to-pypi
|
|
59
|
+
runs-on: ubuntu-latest
|
|
60
|
+
permissions:
|
|
61
|
+
contents: write # IMPORTANT: mandatory for making GitHub Releases
|
|
62
|
+
id-token: write # IMPORTANT: mandatory for sigstore
|
|
63
|
+
steps:
|
|
64
|
+
- name: Download all the dists
|
|
65
|
+
uses: actions/download-artifact@v4
|
|
66
|
+
with:
|
|
67
|
+
name: python-package-distributions
|
|
68
|
+
path: dist/
|
|
69
|
+
- name: Create GitHub Release
|
|
70
|
+
env:
|
|
71
|
+
GITHUB_TOKEN: ${{ github.token }}
|
|
72
|
+
run: >-
|
|
73
|
+
gh release create
|
|
74
|
+
"$GITHUB_REF_NAME"
|
|
75
|
+
--repo "$GITHUB_REPOSITORY"
|
|
76
|
+
--notes ""
|
|
77
|
+
- name: Upload artifact signatures to GitHub Release
|
|
78
|
+
env:
|
|
79
|
+
GITHUB_TOKEN: ${{ github.token }}
|
|
80
|
+
# Upload to GitHub Release using the `gh` CLI.
|
|
81
|
+
# `dist/` contains the built packages, and the
|
|
82
|
+
# sigstore-produced signatures and certificates.
|
|
83
|
+
run: >-
|
|
84
|
+
gh release upload
|
|
85
|
+
"$GITHUB_REF_NAME" dist/**
|
|
86
|
+
--repo "$GITHUB_REPOSITORY"
|
|
87
|
+
|
|
88
|
+
publish-to-testpypi:
|
|
89
|
+
name: Publish Python distribution to TestPyPI
|
|
90
|
+
if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
|
|
91
|
+
needs:
|
|
92
|
+
- build
|
|
93
|
+
runs-on: ubuntu-latest
|
|
94
|
+
environment:
|
|
95
|
+
name: testpypi
|
|
96
|
+
url: https://test.pypi.org/p/mockstack
|
|
97
|
+
permissions:
|
|
98
|
+
id-token: write # IMPORTANT: mandatory for trusted publishing
|
|
99
|
+
steps:
|
|
100
|
+
- name: Download all the dists
|
|
101
|
+
uses: actions/download-artifact@v4
|
|
102
|
+
with:
|
|
103
|
+
name: python-package-distributions
|
|
104
|
+
path: dist/
|
|
105
|
+
- name: Publish distribution 📦 to TestPyPI
|
|
106
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
107
|
+
with:
|
|
108
|
+
repository-url: https://test.pypi.org/legacy/
|
|
109
|
+
verbose: true
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
lib/
|
|
18
|
+
lib64/
|
|
19
|
+
parts/
|
|
20
|
+
sdist/
|
|
21
|
+
var/
|
|
22
|
+
wheels/
|
|
23
|
+
share/python-wheels/
|
|
24
|
+
*.egg-info/
|
|
25
|
+
.installed.cfg
|
|
26
|
+
*.egg
|
|
27
|
+
MANIFEST
|
|
28
|
+
|
|
29
|
+
# PyInstaller
|
|
30
|
+
# Usually these files are written by a python script from a template
|
|
31
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
32
|
+
*.manifest
|
|
33
|
+
*.spec
|
|
34
|
+
|
|
35
|
+
# Installer logs
|
|
36
|
+
pip-log.txt
|
|
37
|
+
pip-delete-this-directory.txt
|
|
38
|
+
|
|
39
|
+
# Unit test / coverage reports
|
|
40
|
+
htmlcov/
|
|
41
|
+
.tox/
|
|
42
|
+
.nox/
|
|
43
|
+
.coverage
|
|
44
|
+
.coverage.*
|
|
45
|
+
.cache
|
|
46
|
+
nosetests.xml
|
|
47
|
+
coverage.xml
|
|
48
|
+
*.cover
|
|
49
|
+
*.py,cover
|
|
50
|
+
.hypothesis/
|
|
51
|
+
.pytest_cache/
|
|
52
|
+
cover/
|
|
53
|
+
|
|
54
|
+
# Translations
|
|
55
|
+
*.mo
|
|
56
|
+
*.pot
|
|
57
|
+
|
|
58
|
+
# Django stuff:
|
|
59
|
+
*.log
|
|
60
|
+
local_settings.py
|
|
61
|
+
db.sqlite3
|
|
62
|
+
db.sqlite3-journal
|
|
63
|
+
|
|
64
|
+
# Flask stuff:
|
|
65
|
+
instance/
|
|
66
|
+
.webassets-cache
|
|
67
|
+
|
|
68
|
+
# Scrapy stuff:
|
|
69
|
+
.scrapy
|
|
70
|
+
|
|
71
|
+
# Sphinx documentation
|
|
72
|
+
docs/_build/
|
|
73
|
+
|
|
74
|
+
# PyBuilder
|
|
75
|
+
.pybuilder/
|
|
76
|
+
target/
|
|
77
|
+
|
|
78
|
+
# Jupyter Notebook
|
|
79
|
+
.ipynb_checkpoints
|
|
80
|
+
|
|
81
|
+
# IPython
|
|
82
|
+
profile_default/
|
|
83
|
+
ipython_config.py
|
|
84
|
+
|
|
85
|
+
# pyenv
|
|
86
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
87
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
88
|
+
# .python-version
|
|
89
|
+
|
|
90
|
+
# pipenv
|
|
91
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
92
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
93
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
94
|
+
# install all needed dependencies.
|
|
95
|
+
#Pipfile.lock
|
|
96
|
+
|
|
97
|
+
# poetry
|
|
98
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
99
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
100
|
+
# commonly ignored for libraries.
|
|
101
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
102
|
+
#poetry.lock
|
|
103
|
+
|
|
104
|
+
# pdm
|
|
105
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
106
|
+
#pdm.lock
|
|
107
|
+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
|
|
108
|
+
# in version control.
|
|
109
|
+
# https://pdm.fming.dev/latest/usage/project/#working-with-version-control
|
|
110
|
+
.pdm.toml
|
|
111
|
+
.pdm-python
|
|
112
|
+
.pdm-build/
|
|
113
|
+
|
|
114
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
115
|
+
__pypackages__/
|
|
116
|
+
|
|
117
|
+
# Celery stuff
|
|
118
|
+
celerybeat-schedule
|
|
119
|
+
celerybeat.pid
|
|
120
|
+
|
|
121
|
+
# SageMath parsed files
|
|
122
|
+
*.sage.py
|
|
123
|
+
|
|
124
|
+
# Environments
|
|
125
|
+
.python-version
|
|
126
|
+
.env
|
|
127
|
+
.venv
|
|
128
|
+
env/
|
|
129
|
+
venv/
|
|
130
|
+
ENV/
|
|
131
|
+
env.bak/
|
|
132
|
+
venv.bak/
|
|
133
|
+
|
|
134
|
+
# Spyder project settings
|
|
135
|
+
.spyderproject
|
|
136
|
+
.spyproject
|
|
137
|
+
|
|
138
|
+
# Rope project settings
|
|
139
|
+
.ropeproject
|
|
140
|
+
|
|
141
|
+
# mkdocs documentation
|
|
142
|
+
/site
|
|
143
|
+
|
|
144
|
+
# mypy
|
|
145
|
+
.mypy_cache/
|
|
146
|
+
.dmypy.json
|
|
147
|
+
dmypy.json
|
|
148
|
+
|
|
149
|
+
# Pyre type checker
|
|
150
|
+
.pyre/
|
|
151
|
+
|
|
152
|
+
# pytype static type analyzer
|
|
153
|
+
.pytype/
|
|
154
|
+
|
|
155
|
+
# Cython debug symbols
|
|
156
|
+
cython_debug/
|
|
157
|
+
|
|
158
|
+
# PyCharm
|
|
159
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
160
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
161
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
162
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
163
|
+
#.idea/
|
|
164
|
+
|
|
165
|
+
# do not check in any user templates
|
|
166
|
+
templates/*.j2
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
fail_fast: true
|
|
2
|
+
repos:
|
|
3
|
+
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|
4
|
+
rev: v5.0.0
|
|
5
|
+
hooks:
|
|
6
|
+
- id: check-added-large-files
|
|
7
|
+
- id: fix-byte-order-marker
|
|
8
|
+
- id: check-case-conflict
|
|
9
|
+
- id: check-json
|
|
10
|
+
- id: check-yaml
|
|
11
|
+
- id: detect-aws-credentials
|
|
12
|
+
- id: detect-private-key
|
|
13
|
+
- id: end-of-file-fixer
|
|
14
|
+
- id: trailing-whitespace
|
|
15
|
+
- repo: https://github.com/astral-sh/ruff-pre-commit
|
|
16
|
+
# Ruff version.
|
|
17
|
+
rev: v0.5.0
|
|
18
|
+
hooks:
|
|
19
|
+
# Run the linter.
|
|
20
|
+
- id: ruff
|
|
21
|
+
args: [ --fix ]
|
|
22
|
+
# Run the formatter.
|
|
23
|
+
- id: ruff-format
|
|
24
|
+
- repo: https://github.com/pre-commit/mirrors-mypy
|
|
25
|
+
rev: v1.15.0
|
|
26
|
+
hooks:
|
|
27
|
+
- id: mypy
|
|
28
|
+
- repo: local
|
|
29
|
+
hooks:
|
|
30
|
+
- id: pytest
|
|
31
|
+
name: pytest [with coverage, without slow]
|
|
32
|
+
entry: bash -ec "uv run python -m pytest --cov=mockstack mockstack/tests --cov-fail-under='75' -m 'not slow'"
|
|
33
|
+
language: system
|
|
34
|
+
types: [python]
|
|
35
|
+
pass_filenames: false
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
|
2
|
+
|
|
3
|
+
## Our Pledge
|
|
4
|
+
|
|
5
|
+
We as members, contributors, and leaders pledge to make participation in our
|
|
6
|
+
community a harassment-free experience for everyone, regardless of age, body
|
|
7
|
+
size, visible or invisible disability, ethnicity, sex characteristics, gender
|
|
8
|
+
identity and expression, level of experience, education, socio-economic status,
|
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity
|
|
10
|
+
and orientation.
|
|
11
|
+
|
|
12
|
+
We pledge to act and interact in ways that contribute to an open, welcoming,
|
|
13
|
+
diverse, inclusive, and healthy community.
|
|
14
|
+
|
|
15
|
+
## Our Standards
|
|
16
|
+
|
|
17
|
+
Examples of behavior that contributes to a positive environment for our
|
|
18
|
+
community include:
|
|
19
|
+
|
|
20
|
+
* Demonstrating empathy and kindness toward other people
|
|
21
|
+
* Being respectful of differing opinions, viewpoints, and experiences
|
|
22
|
+
* Giving and gracefully accepting constructive feedback
|
|
23
|
+
* Accepting responsibility and apologizing to those affected by our mistakes,
|
|
24
|
+
and learning from the experience
|
|
25
|
+
* Focusing on what is best not just for us as individuals, but for the
|
|
26
|
+
overall community
|
|
27
|
+
|
|
28
|
+
Examples of unacceptable behavior include:
|
|
29
|
+
|
|
30
|
+
* The use of sexualized language or imagery, and sexual attention or
|
|
31
|
+
advances of any kind
|
|
32
|
+
* Trolling, insulting or derogatory comments, and personal or political attacks
|
|
33
|
+
* Public or private harassment
|
|
34
|
+
* Publishing others' private information, such as a physical or email
|
|
35
|
+
address, without their explicit permission
|
|
36
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
|
37
|
+
professional setting
|
|
38
|
+
|
|
39
|
+
## Enforcement Responsibilities
|
|
40
|
+
|
|
41
|
+
Community leaders are responsible for clarifying and enforcing our standards of
|
|
42
|
+
acceptable behavior and will take appropriate and fair corrective action in
|
|
43
|
+
response to any behavior that they deem inappropriate, threatening, offensive,
|
|
44
|
+
or harmful.
|
|
45
|
+
|
|
46
|
+
Community leaders have the right and responsibility to remove, edit, or reject
|
|
47
|
+
comments, commits, code, wiki edits, issues, and other contributions that are
|
|
48
|
+
not aligned to this Code of Conduct, and will communicate reasons for moderation
|
|
49
|
+
decisions when appropriate.
|
|
50
|
+
|
|
51
|
+
## Scope
|
|
52
|
+
|
|
53
|
+
This Code of Conduct applies within all community spaces, and also applies when
|
|
54
|
+
an individual is officially representing the community in public spaces.
|
|
55
|
+
Examples of representing our community include using an official e-mail address,
|
|
56
|
+
posting via an official social media account, or acting as an appointed
|
|
57
|
+
representative at an online or offline event.
|
|
58
|
+
|
|
59
|
+
## Enforcement
|
|
60
|
+
|
|
61
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
|
62
|
+
reported to the community leaders responsible for enforcement at
|
|
63
|
+
<name of this repo> at gmail dot com.
|
|
64
|
+
All complaints will be reviewed and investigated promptly and fairly.
|
|
65
|
+
|
|
66
|
+
All community leaders are obligated to respect the privacy and security of the
|
|
67
|
+
reporter of any incident.
|
|
68
|
+
|
|
69
|
+
## Enforcement Guidelines
|
|
70
|
+
|
|
71
|
+
Community leaders will follow these Community Impact Guidelines in determining
|
|
72
|
+
the consequences for any action they deem in violation of this Code of Conduct:
|
|
73
|
+
|
|
74
|
+
### 1. Correction
|
|
75
|
+
|
|
76
|
+
**Community Impact**: Use of inappropriate language or other behavior deemed
|
|
77
|
+
unprofessional or unwelcome in the community.
|
|
78
|
+
|
|
79
|
+
**Consequence**: A private, written warning from community leaders, providing
|
|
80
|
+
clarity around the nature of the violation and an explanation of why the
|
|
81
|
+
behavior was inappropriate. A public apology may be requested.
|
|
82
|
+
|
|
83
|
+
### 2. Warning
|
|
84
|
+
|
|
85
|
+
**Community Impact**: A violation through a single incident or series
|
|
86
|
+
of actions.
|
|
87
|
+
|
|
88
|
+
**Consequence**: A warning with consequences for continued behavior. No
|
|
89
|
+
interaction with the people involved, including unsolicited interaction with
|
|
90
|
+
those enforcing the Code of Conduct, for a specified period of time. This
|
|
91
|
+
includes avoiding interactions in community spaces as well as external channels
|
|
92
|
+
like social media. Violating these terms may lead to a temporary or
|
|
93
|
+
permanent ban.
|
|
94
|
+
|
|
95
|
+
### 3. Temporary Ban
|
|
96
|
+
|
|
97
|
+
**Community Impact**: A serious violation of community standards, including
|
|
98
|
+
sustained inappropriate behavior.
|
|
99
|
+
|
|
100
|
+
**Consequence**: A temporary ban from any sort of interaction or public
|
|
101
|
+
communication with the community for a specified period of time. No public or
|
|
102
|
+
private interaction with the people involved, including unsolicited interaction
|
|
103
|
+
with those enforcing the Code of Conduct, is allowed during this period.
|
|
104
|
+
Violating these terms may lead to a permanent ban.
|
|
105
|
+
|
|
106
|
+
### 4. Permanent Ban
|
|
107
|
+
|
|
108
|
+
**Community Impact**: Demonstrating a pattern of violation of community
|
|
109
|
+
standards, including sustained inappropriate behavior, harassment of an
|
|
110
|
+
individual, or aggression toward or disparagement of classes of individuals.
|
|
111
|
+
|
|
112
|
+
**Consequence**: A permanent ban from any sort of public interaction within
|
|
113
|
+
the community.
|
|
114
|
+
|
|
115
|
+
## Attribution
|
|
116
|
+
|
|
117
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
|
118
|
+
version 2.0, available at
|
|
119
|
+
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
|
|
120
|
+
|
|
121
|
+
Community Impact Guidelines were inspired by [Mozilla's code of conduct
|
|
122
|
+
enforcement ladder](https://github.com/mozilla/diversity).
|
|
123
|
+
|
|
124
|
+
[homepage]: https://www.contributor-covenant.org
|
|
125
|
+
|
|
126
|
+
For answers to common questions about this code of conduct, see the FAQ at
|
|
127
|
+
https://www.contributor-covenant.org/faq. Translations are available at
|
|
128
|
+
https://www.contributor-covenant.org/translations.
|
mockstack-0.0.5/PKG-INFO
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: mockstack
|
|
3
|
+
Version: 0.0.5
|
|
4
|
+
Summary: An API mocking workhorse
|
|
5
|
+
License-Expression: MIT
|
|
6
|
+
Project-URL: Homepage, https://github.com/adamhadani/mockstack
|
|
7
|
+
Project-URL: Issues, https://github.com/adamhadani/mockstack/issues
|
|
8
|
+
Keywords: mocking,integration-testing,testing,microservices,api
|
|
9
|
+
Requires-Python: >=3.11
|
|
10
|
+
Description-Content-Type: text/markdown
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Requires-Dist: colorama>=0.4.6
|
|
13
|
+
Requires-Dist: fastapi[standard]>=0.115.12
|
|
14
|
+
Requires-Dist: jinja2>=3.1.6
|
|
15
|
+
Requires-Dist: opentelemetry-distro[otlp]>=0.53b1
|
|
16
|
+
Requires-Dist: opentelemetry-instrumentation-fastapi>=0.53b1
|
|
17
|
+
Requires-Dist: pydantic>=2.11.3
|
|
18
|
+
Requires-Dist: pydantic-settings>=2.9.1
|
|
19
|
+
Dynamic: license-file
|
|
20
|
+
|
|
21
|
+
# mockstack
|
|
22
|
+
|
|
23
|
+
[](https://github.com/adamhadani/mockstack/actions/workflows/ci.yml)
|
|
24
|
+

|
|
25
|
+
|
|
26
|
+
An API mocking workhorse :racehorse:
|
|
27
|
+
|
|
28
|
+
Enabling a sane development lifecycle for microservice-oriented architectures.
|
|
29
|
+
|
|
30
|
+
Highlights include:
|
|
31
|
+
|
|
32
|
+
* Multiple strategies for handling requests such as Jinja2 template files with intelligent URL request-to-template routing, proxy strategy, and mixed strategies. :game_die:
|
|
33
|
+
* Observability via OpenTelemetry integration. Get detailed traces of your sessions instantly reported to backends such as Grafana, Jaeger, Zipkin, etc. :eyes:
|
|
34
|
+
* Configurability via `pydantic-settings` supports customizing behaviour via environment variables and a `.env` file. :flags:
|
|
35
|
+
* Comprehensive unit-tests, linting and formatting coverage as well as vulnerabilities and security scanning with full CI automation to ensure stability and a high-quality codebase for production-grade use. :+1:
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
## Installation
|
|
39
|
+
|
|
40
|
+
Install using [uv](https://docs.astral.sh/uv/). This will create a virtualenv for you and install all dependencies:
|
|
41
|
+
|
|
42
|
+
uv sync
|
|
43
|
+
uv pip install -e .
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
## Usage
|
|
47
|
+
|
|
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):
|
|
51
|
+
|
|
52
|
+
uv run fastapi dev mockstack/main.py
|
|
53
|
+
|
|
54
|
+
Or, run in production mode:
|
|
55
|
+
|
|
56
|
+
uv run fastapi run mockstack/main.py
|
|
57
|
+
|
|
58
|
+
Available configuration options are [here](./mockstack/config.py). Setting individual options can be done with env. variables as in the following example:
|
|
59
|
+
|
|
60
|
+
MOCKSTACK__OPENTELEMETRY__ENABLED=true MOCKSTACK__OPENTELEMETRY__CAPTURE_RESPONSE_BODY=true uv run fastapi run mockstack/main.py
|
|
61
|
+
|
|
62
|
+
Out of the box, you get the following behavior when using the default `filefixtures` strategy:
|
|
63
|
+
|
|
64
|
+
- The HTTP request `GET /someservice/api/v1/user/c27f5b2b-6e81-420d-a4e4-6426e1c32db8` will try to find `<templates_dir>/someservice-api-v1-user.c27f5b2b-6e81-420d-a4e4-6426e1c32db8.j2`,
|
|
65
|
+
and will fallback to `<templates_dir>/someservice-api-v1-user.j2` (and finally to `index.j2` if exists). These are j2 files that have access to request body context variables.
|
|
66
|
+
- The HTTP request `POST /someservice/api/v2/item` with a JSON body will attempt to intelligently simulate the creation of a resource, returning the appropriate status code and will echo back the provided request resource, after injecting additional metadata fields based on strategy configuration. This is useful for services that expect fields such as `id` and `created_at` on returned created resources.
|
|
67
|
+
- HTTP requests for `DELETE` / `PUT` / `PATCH` are a no-op by default, simply returning the appropriate status code.
|
|
68
|
+
- The HTTP request `POST /someservice/api/v2/embedding_search` will be handled as a search request rather than a resource creation, returning an appropriate http status code and mock results based on user-configurable formatting.
|
|
69
|
+
|
|
70
|
+
Overall, the design philosophy is that things "just work". The framework attempts to intelligently deduce the intent of the request as much as possible and act accordingly,
|
|
71
|
+
while leaving room for advanced users to go in and customize behavior using the configuration options.
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
## Testing
|
|
75
|
+
|
|
76
|
+
Invoke unit-tests with:
|
|
77
|
+
|
|
78
|
+
uv run python -m pytest
|
|
79
|
+
|
|
80
|
+
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
|
+
|
|
82
|
+
pre-commit run --all-files
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# Security policy
|
|
2
|
+
|
|
3
|
+
## Reporting a vulnerability
|
|
4
|
+
|
|
5
|
+
If you have found a possible vulnerability, please open an Issue and label it with the tag `security`.
|
|
6
|
+
|
|
7
|
+
## Bug bounties
|
|
8
|
+
|
|
9
|
+
We do not currently run any bug bounty programs.
|
|
10
|
+
|
|
11
|
+
## Vulnerability disclosures
|
|
12
|
+
|
|
13
|
+
Critical vulnerabilities will be disclosed via GitHub's
|
|
14
|
+
[security advisory](https://github.com/adamhadani/mockstack/security) system.
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: mockstack
|
|
3
|
+
Version: 0.0.5
|
|
4
|
+
Summary: An API mocking workhorse
|
|
5
|
+
License-Expression: MIT
|
|
6
|
+
Project-URL: Homepage, https://github.com/adamhadani/mockstack
|
|
7
|
+
Project-URL: Issues, https://github.com/adamhadani/mockstack/issues
|
|
8
|
+
Keywords: mocking,integration-testing,testing,microservices,api
|
|
9
|
+
Requires-Python: >=3.11
|
|
10
|
+
Description-Content-Type: text/markdown
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Requires-Dist: colorama>=0.4.6
|
|
13
|
+
Requires-Dist: fastapi[standard]>=0.115.12
|
|
14
|
+
Requires-Dist: jinja2>=3.1.6
|
|
15
|
+
Requires-Dist: opentelemetry-distro[otlp]>=0.53b1
|
|
16
|
+
Requires-Dist: opentelemetry-instrumentation-fastapi>=0.53b1
|
|
17
|
+
Requires-Dist: pydantic>=2.11.3
|
|
18
|
+
Requires-Dist: pydantic-settings>=2.9.1
|
|
19
|
+
Dynamic: license-file
|
|
20
|
+
|
|
21
|
+
# mockstack
|
|
22
|
+
|
|
23
|
+
[](https://github.com/adamhadani/mockstack/actions/workflows/ci.yml)
|
|
24
|
+

|
|
25
|
+
|
|
26
|
+
An API mocking workhorse :racehorse:
|
|
27
|
+
|
|
28
|
+
Enabling a sane development lifecycle for microservice-oriented architectures.
|
|
29
|
+
|
|
30
|
+
Highlights include:
|
|
31
|
+
|
|
32
|
+
* Multiple strategies for handling requests such as Jinja2 template files with intelligent URL request-to-template routing, proxy strategy, and mixed strategies. :game_die:
|
|
33
|
+
* Observability via OpenTelemetry integration. Get detailed traces of your sessions instantly reported to backends such as Grafana, Jaeger, Zipkin, etc. :eyes:
|
|
34
|
+
* Configurability via `pydantic-settings` supports customizing behaviour via environment variables and a `.env` file. :flags:
|
|
35
|
+
* Comprehensive unit-tests, linting and formatting coverage as well as vulnerabilities and security scanning with full CI automation to ensure stability and a high-quality codebase for production-grade use. :+1:
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
## Installation
|
|
39
|
+
|
|
40
|
+
Install using [uv](https://docs.astral.sh/uv/). This will create a virtualenv for you and install all dependencies:
|
|
41
|
+
|
|
42
|
+
uv sync
|
|
43
|
+
uv pip install -e .
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
## Usage
|
|
47
|
+
|
|
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):
|
|
51
|
+
|
|
52
|
+
uv run fastapi dev mockstack/main.py
|
|
53
|
+
|
|
54
|
+
Or, run in production mode:
|
|
55
|
+
|
|
56
|
+
uv run fastapi run mockstack/main.py
|
|
57
|
+
|
|
58
|
+
Available configuration options are [here](./mockstack/config.py). Setting individual options can be done with env. variables as in the following example:
|
|
59
|
+
|
|
60
|
+
MOCKSTACK__OPENTELEMETRY__ENABLED=true MOCKSTACK__OPENTELEMETRY__CAPTURE_RESPONSE_BODY=true uv run fastapi run mockstack/main.py
|
|
61
|
+
|
|
62
|
+
Out of the box, you get the following behavior when using the default `filefixtures` strategy:
|
|
63
|
+
|
|
64
|
+
- The HTTP request `GET /someservice/api/v1/user/c27f5b2b-6e81-420d-a4e4-6426e1c32db8` will try to find `<templates_dir>/someservice-api-v1-user.c27f5b2b-6e81-420d-a4e4-6426e1c32db8.j2`,
|
|
65
|
+
and will fallback to `<templates_dir>/someservice-api-v1-user.j2` (and finally to `index.j2` if exists). These are j2 files that have access to request body context variables.
|
|
66
|
+
- The HTTP request `POST /someservice/api/v2/item` with a JSON body will attempt to intelligently simulate the creation of a resource, returning the appropriate status code and will echo back the provided request resource, after injecting additional metadata fields based on strategy configuration. This is useful for services that expect fields such as `id` and `created_at` on returned created resources.
|
|
67
|
+
- HTTP requests for `DELETE` / `PUT` / `PATCH` are a no-op by default, simply returning the appropriate status code.
|
|
68
|
+
- The HTTP request `POST /someservice/api/v2/embedding_search` will be handled as a search request rather than a resource creation, returning an appropriate http status code and mock results based on user-configurable formatting.
|
|
69
|
+
|
|
70
|
+
Overall, the design philosophy is that things "just work". The framework attempts to intelligently deduce the intent of the request as much as possible and act accordingly,
|
|
71
|
+
while leaving room for advanced users to go in and customize behavior using the configuration options.
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
## Testing
|
|
75
|
+
|
|
76
|
+
Invoke unit-tests with:
|
|
77
|
+
|
|
78
|
+
uv run python -m pytest
|
|
79
|
+
|
|
80
|
+
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
|
+
|
|
82
|
+
pre-commit run --all-files
|