Skip to main content
Archived

This project has been archived by its maintainers, and is no longer receiving any updates.

Swenv

Switch system and application settings based on the detected network environment.

Quick start

Prerequisites: Python (version >= 3.9.2)

To install using the published PyPI package, run:

pip install swenv
swenv configure

To install from the source repositority, run:

git clone https://gitlab.com/ipamo/swenv.git
cd swenv
python -m swenv configure

The application can then be executed directly. Example:

swenv

To view available options, run:

swenv --help

Configuration

Configuration directory is located at APPDATA\Roaming\swenv in your Windows home (or in ~/.local/share/swenv if you use Linux).

An environment is configured using a JSON file in the configuration directory. Example for an environment named mycompany (configuration file APPDATA\Roaming\swenv\mycompany.json on Windows or ~/.local/share/swenv/mycompany.json on Linux):

{
    "dns_servers": [
        "10.0.0.1",
        "10.0.0.2",
    ],

    "proxy_host": "proxy.mycompany.local",
    "proxy_port": 3128,
    "proxy_cafile": "ca-certificates/mycompany-ca-proxy.crt",
    "no_proxy": "10.*,192.168.*,172.16.*,172.17.*,172.18.*,172.19.*,172.20.*,172.21.*,172.22.*,172.23.*,172.24.*,172.25.*,172.26.*,172.27.*,172.28.*,172.29.*,172.30.*,172.31.*,127.*,130.93.17.229,localhost,mycompany.local",

    "apt_repositories": {
        "root": "http://nexus.mycompany.local/repository",
        "http://deb.debian.org/debian": {
            "bookworm": "debian-bookworm",
            "bookworm-updates": "debian-bookworm-updates",
            "bookworm-backports": "debian-bookworm-backports"
        },
        "http://security.debian.org/debian-security": {
            "bookworm-security": "debian-bookworm-security"
        },
        "https://download.docker.com/linux/debian": {
            "bookworm": "debian-bookworm-docker"
        },
        "https://deb.nodesource.com/node_20.x": {
            "nodistro": "nodesource-20.x"
        },
        "https://packagecloud.io/timescale/timescaledb/debian": {
            "bookworm": "timescaledb-bookworm"
        },
        "https://packages.microsoft.com/debian/12/prod": {
            "bookworm": "debian-bookworm-microsoft"
        }
    },
    "git_repositories": [
        "https://gitlab.mycompany.local"
    ],
    "pip_repository": "https://nexus.mycompany.local/repository/pypi-group",
    "npm_repository": "https://nexus.mycompany.local/repository/npm-group"
}

A default fallback environment called direct using no proxy or git/npm/apt repository is always available (it does not require a configuration file).

Contributing

Pull requests are welcome.

See contributing guidelines.

This project is licensed under the terms of the MIT license.

Logo designed by Freepik - Flaticon (free with required attribution).

Metadata

Release files for swenv 1.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for swenv 1.0.2
File Interpreter ABI Platform Actions
swenv-1.0.2-py3-none-any.whl Python 3 none any Details for swenv-1.0.2-py3-none-any.whl

Release files / swenv-1.0.2-py3-none-any.whl

Download URL swenv-1.0.2-py3-none-any.whl
Size 35.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f0c0a9d7267a0c8b49fee83eb4ca23ea5c4f3ef06b002237a51e1f87c36b50e8
BLAKE2b-256 checksum
How to use checksums
d4c6be27678396aaefa71b937e1c5340222438c7258fb942c38058c305635da3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.2

Security for swenv 1.0.2

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page