Skip to main content

pyautostart

PyAutostart is a Python library for making all sorts of executables files be run after the user logged in into his computer for macOS, Linux and Windows.

Please note that Linux is not yet being supported.

Installation

Use the package manager pip to install PyAutostart.

pip install pyautostart

Usage

Platform independent

Make a file be run after login

The options dict must contain args which has to be a list that usually contain the path to the executable file. The name parameter of autostart.enable sets the name of the file which will then be created by the platform dependent implementation.

from pyautostart import SmartAutostart

autostart = SmartAutostart()
options = {
    "args": [
        "/path/to/executable/file"
    ]
}
autostart.enable(name="com.example.myapplication", options=options)

Disable automatic execution

Calling autostart.disable will delete the file which is being created by autostart.enable. The name parameter has to be the one set during autostart.enable.

from pyautostart import SmartAutostart

autostart = SmartAutostart()
autostart.disable(name="com.example.myapplication")

macOS

Make a file be run after login

The options dict contains the configuration for launchd. For a list of all valid options and their meanings, go to the Wikipedia article of launchd. The name parameter of autostart.enable sets the name of the file which will be stored in /Users/<username>/Library/LaunchAgents if not changed.

from pyautostart import MacAutostart

autostart = MacAutostart()
options = {
    "Label": "Name of",
    "ProgramArguments": [
        "python3",
        "/path/to/your/file.py"
    ]
}
autostart.enable(name="com.example.myapplication", options=options)

Disable automatic execution

Calling autostart.disable will delete the file which is being created by autostart.enable. The name parameter has to be the one set during autostart.enable.

from pyautostart import MacAutostart

autostart = MacAutostart()
autostart.disable(name="com.example.myapplication")

Windows

Make a file be run after login

The options dict must contain executable, which has to store to path to your executable file. autostart.enable will then create a .bat file which by default contains start "" <executable>".

This file will be stored inside C:\\Users\\<username>\\AppData\\Roaming\\Microsoft\\Windows\\Start Menu\\Programs\\Startup.

If you want to replace the start "" command. Add command: "<command>" to the options dict.

from pyautostart import WindowsAutostart

autostart = WindowsAutostart()
options = {
    "executable": "C:\\path\\to\\your\\executable",
}
autostart.enable(name="com.example.myapplication", options=options)

Disable automatic execution

Calling autostart.disable will delete the file which is being created by autostart.enable. The name parameter has to be the one set during autostart.enable.

from pyautostart import WindowsAutostart

autostart = WindowsAutostart()
autostart.disable(name="com.example.myapplication")

Linux

Linux is not supported yet.

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

GNU GENERAL PUBLIC LICENSE

Metadata

Release files for pyautostart 0.1.2

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

Source distribution (sdist)

Source distribution for pyautostart 0.1.2
File Size Uploaded Provenance Actions
pyautostart-0.1.2.tar.gz 17.0 kB Without provenance Details for pyautostart-0.1.2.tar.gz

Built distribution (wheel)

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

Total release size: 33.1 kB

Release files / pyautostart-0.1.2.tar.gz

Download URL pyautostart-0.1.2.tar.gz
Size 17.0 kB
Tags Source
SHA-256 checksum
How to use checksums
9054d6d8aadef670dc64c5ed5531538fbb1d186ab847f2bde09d90aa1682d4d8
BLAKE2b-256 checksum
How to use checksums
4ffe8703f79531dee1f3b3695db815b28f22bdcb26a6aaec375437cee4bc9f83
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.8.1

Release files / pyautostart-0.1.2-py3-none-any.whl

Download URL pyautostart-0.1.2-py3-none-any.whl
Size 16.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
924d78f87b8c87ec8ba7a1f43a30f4eecbd74887872776ec72d77d7388c2493d
BLAKE2b-256 checksum
How to use checksums
bebd8004332a879950b16ebdebe3a03b4ff943668c46167204a95b1270ec70cc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.8.1

Security for pyautostart 0.1.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