Skip to main content

Sharedfile

Easily let multiple Python processes read from and write to the same file at once.

A simple, cross-platform Python extension that makes it safe and easy for different processes to open and use the same file at the same time—perfect for logging, sharing data, or coordinating between programs.

Features

  • Super simple API: sharedfile.open(path, mode="r", share="rw")
  • Works on Windows and POSIX (Linux/macOS)
  • Lets you control how files are shared (Windows)
  • Uses advisory locking for safe sharing on POSIX systems
  • Feels just like Python’s built-in open

Installation

Install directly from PyPI:

pip install sharedfile

View on PyPI

Or build and install manually:

python setup.py build
python setup.py install

Usage Example

Let two processes write to and read from the same file:

import multiprocessing
import time
import sharedfile

def writer():
    with sharedfile.open("shared_test.txt", mode="w", share="rw") as f:
        for i in range(5):
            line = f"Writer line {i}\n"
            f.write(line)
            f.flush()
            print(f"[Writer] wrote: {line.strip()}")
            time.sleep(1)

def reader():
    time.sleep(0.5)  # Let writer start first
    with sharedfile.open("shared_test.txt", mode="r", share="rw") as f:
        for _ in range(5):
            f.seek(0)
            content = f.read()
            print(f"[Reader] read:\n{content.strip()}")
            time.sleep(1)

if __name__ == "__main__":
    p1 = multiprocessing.Process(target=writer)
    p2 = multiprocessing.Process(target=reader)
    p1.start()
    p2.start()
    p1.join()
    p2.join()

API

sharedfile.open(path, mode="r", share="rw")
  • path: File path.
  • mode: File mode ("r", "w", "a", "r+", etc.).
  • share: (Windows only) Control who else can access the file:
    • "r": Let others read
    • "w": Let others write
    • "rw": Let others read and write
    • (Ignored on POSIX; uses advisory locking)

Returns: A Python file-like object.

Platform Details

  • Windows: Uses native Win32 APIs for explicit read/write sharing.
  • POSIX: Uses advisory fcntl locking for cooperative sharing.

License

Licensed under the Apache License, Version 2.0. See LICENSE for details.

Author

Jan Bremec

Release files for sharedfile 0.8

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

Built distributions (wheels)

Table of built distributions (wheels) for sharedfile 0.8
File
sharedfile-0.8-cp314-cp314t-win_amd64.whl CPython 3.14 CPython 3.14 free-threading Windows x86-64 Details
sharedfile-0.8-cp314-cp314t-win32.whl CPython 3.14 CPython 3.14 free-threading Windows x86-32 Details
sharedfile-0.8-cp314-cp314-win_amd64.whl CPython 3.14 CPython 3.14 Windows x86-64 Details
sharedfile-0.8-cp314-cp314-win32.whl CPython 3.14 CPython 3.14 Windows x86-32 Details
sharedfile-0.8-cp313-cp313-win_amd64.whl CPython 3.13 CPython 3.13 Windows x86-64 Details
sharedfile-0.8-cp313-cp313-win32.whl CPython 3.13 CPython 3.13 Windows x86-32 Details
sharedfile-0.8-cp312-cp312-win_amd64.whl CPython 3.12 CPython 3.12 Windows x86-64 Details
sharedfile-0.8-cp312-cp312-win32.whl CPython 3.12 CPython 3.12 Windows x86-32 Details
sharedfile-0.8-cp311-cp311-win_amd64.whl CPython 3.11 CPython 3.11 Windows x86-64 Details
sharedfile-0.8-cp311-cp311-win32.whl CPython 3.11 CPython 3.11 Windows x86-32 Details
sharedfile-0.8-cp310-cp310-win_amd64.whl CPython 3.10 CPython 3.10 Windows x86-64 Details
sharedfile-0.8-cp310-cp310-win32.whl CPython 3.10 CPython 3.10 Windows x86-32 Details
sharedfile-0.8-cp39-cp39-win_amd64.whl CPython 3.9 CPython 3.9 Windows x86-64 Details
sharedfile-0.8-cp39-cp39-win32.whl CPython 3.9 CPython 3.9 Windows x86-32 Details
sharedfile-0.8-cp38-cp38-win_amd64.whl CPython 3.8 CPython 3.8 Windows x86-64 Details
sharedfile-0.8-cp38-cp38-win32.whl CPython 3.8 CPython 3.8 Windows x86-32 Details

Total release size: 191.3 kB

Release files / sharedfile-0.8-cp314-cp314t-win_amd64.whl

Download URL sharedfile-0.8-cp314-cp314t-win_amd64.whl
Size 12.3 kB
Tags CPython 3.14 CPython 3.14 free-threading Windows x86-64
SHA-256 checksum
How to use checksums
4c49b6fed7a3d4cc8a3a798878619b044cc71caa6656d8ca60dc09e77148ef90
BLAKE2b-256 checksum
How to use checksums
fa3358c385619e4abe5bebd3afc6f8dd65e66c4e1db3094be7074709b8a76eab
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 25, 2025.

Transparency log

Release files / sharedfile-0.8-cp314-cp314t-win32.whl

Download URL sharedfile-0.8-cp314-cp314t-win32.whl
Size 11.8 kB
Tags CPython 3.14 CPython 3.14 free-threading Windows x86-32
SHA-256 checksum
How to use checksums
632a1bb1b1306cae5bc4b56c6591a63a013edbdf056ac07f8576ac7fd11ccf36
BLAKE2b-256 checksum
How to use checksums
064e44aaf611362e69bf04f00464509f0d4e2c23228b91fb6fc1cb3dc80d8a9f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 25, 2025.

Transparency log

Release files / sharedfile-0.8-cp314-cp314-win_amd64.whl

Download URL sharedfile-0.8-cp314-cp314-win_amd64.whl
Size 12.3 kB
Tags CPython 3.14 Windows x86-64
SHA-256 checksum
How to use checksums
2b90a8c3859105d9b66efbad917c859e09a789a6f1d3347933db8f47f0d66fda
BLAKE2b-256 checksum
How to use checksums
3777804387618d94c6c0f819017a39b35f922b6472905c249a162f66c62018f1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 25, 2025.

Transparency log

Release files / sharedfile-0.8-cp314-cp314-win32.whl

Download URL sharedfile-0.8-cp314-cp314-win32.whl
Size 11.8 kB
Tags CPython 3.14 Windows x86-32
SHA-256 checksum
How to use checksums
388d6dec50cdb233c3bf63eb0151fa955b9b76cf2d71ff5508b0f1242d364747
BLAKE2b-256 checksum
How to use checksums
301ca0accee49e1f9887cab21168e9c4eaa72c52c4525804470b0b6a8d140d15
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 25, 2025.

Transparency log

Release files / sharedfile-0.8-cp313-cp313-win_amd64.whl

Download URL sharedfile-0.8-cp313-cp313-win_amd64.whl
Size 12.2 kB
Tags CPython 3.13 Windows x86-64
SHA-256 checksum
How to use checksums
d0a33fbd6d88118d0e08185a6bad94b12c36bba771d13b4ed548ebb8538092d6
BLAKE2b-256 checksum
How to use checksums
54e596c4f9203ee1cacf3c90971005ddf58464ab57b1714245fff07f67622278
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 25, 2025.

Transparency log

Release files / sharedfile-0.8-cp313-cp313-win32.whl

Download URL sharedfile-0.8-cp313-cp313-win32.whl
Size 11.7 kB
Tags CPython 3.13 Windows x86-32
SHA-256 checksum
How to use checksums
89d800a00ca566005d002932815c6ce58854dfae0ba428ada88f1e5db21fdd30
BLAKE2b-256 checksum
How to use checksums
ccae03a3d601a8f7130cc254821f7000c1df22fbc32f81fc7a4a110583ab1277
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 25, 2025.

Transparency log

Release files / sharedfile-0.8-cp312-cp312-win_amd64.whl

Download URL sharedfile-0.8-cp312-cp312-win_amd64.whl
Size 12.2 kB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
40f216f893352e8e7af5eefc30555c246ac57f9ce01b114ca7b402c70c7a8194
BLAKE2b-256 checksum
How to use checksums
fc7f678f149a757412d59a575222054545dd33b64038822af4d95006d4814442
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 25, 2025.

Transparency log

Release files / sharedfile-0.8-cp312-cp312-win32.whl

Download URL sharedfile-0.8-cp312-cp312-win32.whl
Size 11.7 kB
Tags CPython 3.12 Windows x86-32
SHA-256 checksum
How to use checksums
e8ce51c029c6864e1ecfc6a40b0daa8a0b5694ce686e1ac04e2fd1e0945ec251
BLAKE2b-256 checksum
How to use checksums
abe8a95c03bd752656b61f22f97758c7b7d603bb0fb9f0852a8623df4f498a9f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 25, 2025.

Transparency log

Release files / sharedfile-0.8-cp311-cp311-win_amd64.whl

Download URL sharedfile-0.8-cp311-cp311-win_amd64.whl
Size 12.2 kB
Tags CPython 3.11 Windows x86-64
SHA-256 checksum
How to use checksums
9da8d850755c75096c770f137c6ca1d7a7482286663908339e0752a9b4af65c8
BLAKE2b-256 checksum
How to use checksums
1c9f8d525448675b45311c7e0302fa256568dc2aaecdc183ef9399670099723a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 25, 2025.

Transparency log

Release files / sharedfile-0.8-cp311-cp311-win32.whl

Download URL sharedfile-0.8-cp311-cp311-win32.whl
Size 11.7 kB
Tags CPython 3.11 Windows x86-32
SHA-256 checksum
How to use checksums
9f53f3574861577dab6422ddd485dd92df057b603ac5ce165ebc09a5a7eb87e4
BLAKE2b-256 checksum
How to use checksums
add77d39072397345e4a796ac856794a03e52ed41fc361e7e1b9d296aca4f814
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 25, 2025.

Transparency log

Release files / sharedfile-0.8-cp310-cp310-win_amd64.whl

Download URL sharedfile-0.8-cp310-cp310-win_amd64.whl
Size 12.2 kB
Tags CPython 3.10 Windows x86-64
SHA-256 checksum
How to use checksums
f9961385a77d11ef3f7c1e1a0de39c5bff13aa4e4660775784642072d6d422d9
BLAKE2b-256 checksum
How to use checksums
59ccd3a8315789b01ba7797a7f12df8dee1540148c9aa326845cf508e4ae1d23
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 25, 2025.

Transparency log

Release files / sharedfile-0.8-cp310-cp310-win32.whl

Download URL sharedfile-0.8-cp310-cp310-win32.whl
Size 11.7 kB
Tags CPython 3.10 Windows x86-32
SHA-256 checksum
How to use checksums
da6d4f2936519dd6b846f156ae3ec9d70e2ff94cf3524c7397d60595fbab0e35
BLAKE2b-256 checksum
How to use checksums
12c7bc23258892023901c749754f083e82346479729c15be0651df00120a858a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 25, 2025.

Transparency log

Release files / sharedfile-0.8-cp39-cp39-win_amd64.whl

Download URL sharedfile-0.8-cp39-cp39-win_amd64.whl
Size 12.2 kB
Tags CPython 3.9 Windows x86-64
SHA-256 checksum
How to use checksums
17d15bb0fd7c2cd156add44fe7d80c90c28a2a1626d2711dc1de00a224e4ae62
BLAKE2b-256 checksum
How to use checksums
6a0c5c7cb63f7750e51770e0d6dd4a70f08eeee743337ea51fd06df23fb0183f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 25, 2025.

Transparency log

Release files / sharedfile-0.8-cp39-cp39-win32.whl

Download URL sharedfile-0.8-cp39-cp39-win32.whl
Size 11.7 kB
Tags CPython 3.9 Windows x86-32
SHA-256 checksum
How to use checksums
d4e8ada4e87e8a6ad69edae122230b6cd48b54a3719fcbd5e5bd231b242d909f
BLAKE2b-256 checksum
How to use checksums
ff2b0a72ebfbf5a62ef072577fdf7cf832966234e90442e1f438cc0cccfc1ddd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 25, 2025.

Transparency log

Release files / sharedfile-0.8-cp38-cp38-win_amd64.whl

Download URL sharedfile-0.8-cp38-cp38-win_amd64.whl
Size 12.1 kB
Tags CPython 3.8 Windows x86-64
SHA-256 checksum
How to use checksums
e9b3b85eebd7569a793dbb2c0302ff40feec89529b3b8585d84ab5875e9ba6a4
BLAKE2b-256 checksum
How to use checksums
58256110da454bcff57f90dc0041cf83905c46e40f6010c2c81fa5967a5d4eef
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 25, 2025.

Transparency log

Release files / sharedfile-0.8-cp38-cp38-win32.whl

Download URL sharedfile-0.8-cp38-cp38-win32.whl
Size 11.6 kB
Tags CPython 3.8 Windows x86-32
SHA-256 checksum
How to use checksums
0c4f7229a770d99569568d60a9b1b7447bb4e0842eaa5cc66325796d742a02e7
BLAKE2b-256 checksum
How to use checksums
47463891cac54a6cebefcfff15602e3353248bb1151af090000dd9a8db519ab4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 25, 2025.

Transparency log

Release history Release notifications | RSS feed

This release

0.8 This release

16 release files

0.6

16 release files

0.3

16 release files

0.2

30 release files

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