Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add namespace for integrations #24

Merged
merged 2 commits into from
Aug 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ repos:
- id: black

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.0.283
rev: v0.0.284
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
Expand Down
4 changes: 1 addition & 3 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@ Read on in *{doc}`why`*, if you find that intriguing!

why
core-concepts
flask
pyramid
custom
integrations/index
typing-caveats
glossary
security
Expand Down
4 changes: 2 additions & 2 deletions docs/custom.md → docs/integrations/custom.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Custom Integrations
# Write Your Own!

Once you've understood how registries and containers interact (see {doc}`core-concepts` if not), you already know how to write your own integrations!
Once you've understood how registries and containers interact (see {doc}`../core-concepts` if not), you already know how to write your own integrations!

All you need to do is:

Expand Down
2 changes: 1 addition & 1 deletion docs/flask.md → docs/integrations/flask.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def index() -> flask.ResponseValue:
The {func}`svcs.flask.get_pings` helper will transparently pick the container from `g`.
So, if you would like a [health endpoint](https://kubernetes.io/docs/reference/using-api/health-checks/), it could look like this:

```{literalinclude} examples/health_check_flask.py
```{literalinclude} ../examples/health_check_flask.py
```

(flask-testing)=
Expand Down
12 changes: 12 additions & 0 deletions docs/integrations/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Integrations

Framework integrations are the main way to use *svcs*.
Here's documentation on those we ship and how you can write your own.

```{toctree}
:maxdepth: 2

flask
pyramid
custom
```
File renamed without changes.
6 changes: 3 additions & 3 deletions docs/why.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,8 @@ If you're still interested, learn about our [core concepts](core-concepts) first

Once you've understood the life cycles of registries and containers, you can look our framework integrations that get you started in no time:

- [Flask](flask.md)
- [Pyramid](pyramid.md)
- Or learn to write [your own](custom.md)!
- [Flask](integrations/flask.md)
- [Pyramid](integrations/pyramid.md)
- Or learn to write [your own](integrations/custom.md)!

If you get overwhelmed by the jargon, we have put much effort into our [glossary](glossary)!
Empty file added tests/integrations/__init__.py
Empty file.
4 changes: 2 additions & 2 deletions tests/test_flask.py → tests/integrations/test_flask.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@

import svcs

from .fake_factories import nop
from .ifaces import AnotherService, Interface, Service
from tests.fake_factories import nop
from tests.ifaces import AnotherService, Interface, Service


try:
Expand Down
4 changes: 2 additions & 2 deletions tests/test_pyramid.py → tests/integrations/test_pyramid.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

import svcs

from .fake_factories import int_factory
from .ifaces import AnotherService, Service
from tests.fake_factories import int_factory
from tests.ifaces import AnotherService, Service


try:
Expand Down
7 changes: 7 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ deps =
optional: webtest
commands = coverage run -m pytest {posargs}

[testenv:py312-optional]
deps =
coverage[toml]
flask


[testenv:pre-commit]
description = Run all pre-commit hooks.
Expand Down Expand Up @@ -82,7 +87,9 @@ package = editable
base_python = {[testenv:docs]base_python}
extras = {[testenv:docs]extras}
deps = watchfiles
allowlist_externals = rm
commands =
rm -rf docs/_build/html
watchfiles \
--ignore-paths docs/_build/ \
'sphinx-build -W -n --jobs auto -b html -d {envtmpdir}/doctrees docs docs/_build/html' \
Expand Down