Conexao
A connection helper. Current features:
- Management of multiple remote MongoDB connection profiles.
- Faster permanent remote Docker connections.
- SSH port forward proxies.
Django (ORM)
Add a JSON file to ~/.config/conexao/config.json.
Example:
{
"profiles": {
"myapp": {
"django": {"settings": "myapp.settings"},
"ssh": {
"host": "my-vps.example.com",
"forwards": ["localhost:5432:localhost:5432"]
}
}
}
}
The Django project must be installed in the used Python environment. Maybe doing pip install -e . , from the Django project's folder.
Then use:
from conexao.django import configure
configure('myapp') # Must come before model import!
from myapp.models import MyModel
MyModel.objects.all()
or:
from conexao.django.auto import myapp # Must come before model import!
from myapp.models import MyModel
MyModel.objects.all()
MongoDB
Add a JSON file to ~/.config/conexao/config.json.
Example:
{
"profiles": {
"simpleMongo": {
"mongo": {
"host": "simple-mongo.example.com"
},
},
"mongoInsideDockerVPS": {
"mongo": {
"host": "127.0.0.1"
},
"ssh": {
"host": "my-vps.example.com",
"forwards": ["127.0.0.1:27017:123.docker.container.ip.456:27017"]
}
}
}
}
Then use:
from conexao.mongodb import create_client
client1 = create_client('simpleMongo')
client2 = create_client('mongoInsideDockerVPS')
or:
from conexao.mongodb.auto import simpleMongo as client1, mongoInsideDockerVPS as client2
Docker
Opens a permanent SSH forward for faster remote Docker command execution. Based on: https://forums.docker.com/t/setting-docker-host-to-ssh-results-in-slow-workflow-can-ssh-connection-be-reused/98754
conexao docker <host>
This feature doesn't use the config.json file.
Limitations
This program uses a Python Shelve to store SSH PIDs of all running forwards. Shelve isn't concurrent safe, so avoid calling this program multiple times in parallel. Once the program returns it should be safe to call it again to add more connections.
Development
Install locally using symlinks:
pip install -e .
Build:
python -m build
Publish (need auth):
twine upload dist/*
Metadata
Release files for conexao 0.0.11
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| conexao-0.0.11.tar.gz | 18.1 kB | Without provenance | Details for conexao-0.0.11.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| conexao-0.0.11-py3-none-any.whl | Python 3 | none | any | Details for conexao-0.0.11-py3-none-any.whl |
Total release size: 37.2 kB
Release files / conexao-0.0.11.tar.gz
| Download URL | conexao-0.0.11.tar.gz |
|---|---|
| Size | 18.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
816f454124a81a4e02f77c93c888bd7b4afb26763476268d20ae1dabde3e4189
|
|
BLAKE2b-256 checksum How to use checksums |
079a2ca12edd7e1f948330e0e4f9e157fdc9add7585a168a955527acaa88e461
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.2
|
Release files / conexao-0.0.11-py3-none-any.whl
| Download URL | conexao-0.0.11-py3-none-any.whl |
|---|---|
| Size | 19.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c563788dc3c1113ea6ac31d4dc45fe166646e10a42e5fd041ba81a0cd1df4c48
|
|
BLAKE2b-256 checksum How to use checksums |
d7536890ba18578c91c3825287a82797f0d86b897a33bfffc5b2f4ac69b7922c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.2
|
Security for conexao 0.0.11
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.