Skip to main content

Add your description here

Project description

pylynxley

Python Platform License

Python library for reading and writing Windows shortcut files (.lnk).

This project modernizes the pylnk3 approach for current Python and expanded shortcut coverage. It parses .lnk files into a typed Lnk object, supports edits and round-trip saving, and provides convenience constructors for creating new links.

Highlights

  • Parse, inspect, and rewrite existing .lnk files.
  • Create local, UNC, and UWP shortcuts with a unified API.
  • Resolve target paths from LinkInfo, IDList, and ExtraData consistently.
  • Test-backed behavior with local/network/UWP fixture coverage.

Supported scenarios:

  • Local file/folder shortcuts.
  • Remote UNC shortcuts.
  • UWP application shortcuts.
  • Mixed link data where LinkInfo, IDList, and ExtraData are reconciled.

Requirements

  • Python 3.14+

Install

From this repository:

pip install -e .

For development:

pip install -e .[dev]

Quick Start

from pathlib import Path

from pylynxley.lnk import Lnk

lnk = Lnk.from_file(Path("example.lnk"))
print(lnk.path)

created = Lnk.create_local(target=r"C:\\Windows\\explorer.exe", description="Explorer")
created.save(Path("explorer.lnk"))

CLI

The CLI supports parse and create flows for local, remote, and UWP links.

Run it as a module:

python -m pylynxley.lnk --help

Parse existing .lnk file

python -m pylynxley.lnk parse LINK_FILE

Prints core fields (flags, show mode, resolved path, working directory, arguments) and diagnostics for LinkInfo, IDList, and ExtraData.

Create local .lnk file

python -m pylynxley.lnk create-local TARGET OUT_FILE \
  [--desc TEXT] [--args TEXT] [--icon ICON_PATH] [--workdir DIR] \
  [--window {normal,max,min}]

Create remote (UNC) .lnk file

python -m pylynxley.lnk create-remote UNC_PATH OUT_FILE [--desc TEXT]

Create UWP .lnk file

python -m pylynxley.lnk create-uwp PACKAGE_FAMILY TARGET OUT_FILE \
  [--location PATH] [--logo44 PATH] [--desc TEXT]

CLI examples

python -m pylynxley.lnk parse src/pylynxley/tests/examples/local_file.lnk
python -m pylynxley.lnk create-local C:\Windows\explorer.exe explorer.lnk --window max
python -m pylynxley.lnk create-remote \\192.168.1.1\share\file.doc share-doc.lnk
python -m pylynxley.lnk create-uwp Microsoft.WindowsCalculator_8wekyb3d8bbwe Microsoft.WindowsCalculator_8wekyb3d8bbwe!App calc.lnk

Python API

from pathlib import Path

from pylynxley.lnk import Lnk

# Read and inspect an existing shortcut
lnk = Lnk.from_file(Path("example.lnk"))
print(lnk.path)

# Create and save a local shortcut
new_lnk = Lnk.create_local(
    target=r"C:\Windows\explorer.exe",
    description="Explorer",
)
new_lnk.save(Path("explorer.lnk"))

Limitations

  • Windows-focused behavior.
  • This project targets shell link formats covered by the test fixtures, not every shortcut variant in the Windows ecosystem.

Tests

uv run pytest --doctest-modules
uv run pytest --doctest-modules --cov=src/pylynxley --cov-report=term-missing

Notes

  • Behavior is validated against local, network, and UWP fixture shortcuts in src/pylynxley/tests/examples.
  • CLI entrypoint behavior is covered by dedicated tests.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pylynxley-2026.4.10.1.tar.gz (42.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pylynxley-2026.4.10.1-py3-none-any.whl (49.8 kB view details)

Uploaded Python 3

File details

Details for the file pylynxley-2026.4.10.1.tar.gz.

File metadata

  • Download URL: pylynxley-2026.4.10.1.tar.gz
  • Upload date:
  • Size: 42.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pylynxley-2026.4.10.1.tar.gz
Algorithm Hash digest
SHA256 ece89bea513d8055fd0cacf7ee7b69e2ce8c5a4b34ba869da54a05f6e352818c
MD5 f6981e66383148b9841e4365a7d34d4c
BLAKE2b-256 0a47e97637be5990d9f75342ac8ac3641c0376d249c761ede81d86343135dac3

See more details on using hashes here.

Provenance

The following attestation bundles were made for pylynxley-2026.4.10.1.tar.gz:

Publisher: publish-pypi.yml on rbroderi/pylynxley

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pylynxley-2026.4.10.1-py3-none-any.whl.

File metadata

  • Download URL: pylynxley-2026.4.10.1-py3-none-any.whl
  • Upload date:
  • Size: 49.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pylynxley-2026.4.10.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e3f94a9ea34dfdc2145d04245c4de4904cc6966e6597625bc87205988a841f6f
MD5 39f3ea6c6f3ab265fd355092bc87a334
BLAKE2b-256 e629a417d7fb8d57a6cc7a691ffc8a484c24c1072b74bae32f99ff9277fa2bf2

See more details on using hashes here.

Provenance

The following attestation bundles were made for pylynxley-2026.4.10.1-py3-none-any.whl:

Publisher: publish-pypi.yml on rbroderi/pylynxley

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page