Skip to main content

openedx-django-pyfs

PyPI Github CI Codecov Supported Python versions License

A Django module which extends pyfilesystem2 with several methods to make it convenient for web use. Specifically, it extends pyfilesystem2 with two methods:

fs.get_url(filename, timeout=0)

This will return a externally-usable URL to the resource. If timeout>0, the URL may stop working after that period (in seconds). Details are implementation-dependent. On Amazon S3, this is a secure URL, which is only available for that period. For a static filesystem, the URLs are unsecure and permanent.

fs.expire(filename, seconds, days, expires=True)

This allows us to create temporary objects. Our use-case was that we wanted to generate visualizations to users which were .png images. The lifetime of those images was a single web request, so we set them to expire after a few minutes. Another use case was memoization.

Note that expired files are not automatically removed. To remove them, call expire_objects(). In our system, we had a cron job do this for a while. Celery, manual removals, etc. are all options.

To configure a openedx-django-pyfs to use static files, set a parameter in Django settings:

DJFS = {'type' : 'osfs',
        'directory_root' : 'djpyfs/static/djpyfs',
        'url_root' : '/static/djpyfs'}

Here, directory_root is where the files go. url_root is the URL base of where your web server is configured to serve them from.

To use files on S3, you need boto installed. Then,

DJFS = {'type' : 's3fs',
        'bucket' : 'my-bucket',
        'prefix' : '/pyfs/' }

bucket is your S3 bucket. prefix is optional, and gives a base within that bucket.

To get your filesystem, call:

def get_filesystem(namespace)

Each module should pass a unique namespace. These will typically correspond to subdirectories within the filesystem.

The openedx-django-pyfs interface is designed as a generic (non-Django specific) extension to pyfilesystem2. However, the specific implementation is very Django-specific.

Good next steps would be to:

  • Allow Django storages to act as a back-end for pyfilesystem

  • Allow openedx-django-pyfs to act as a back-end for Django storages

  • Support more types of pyfilesystems (esp. in-memory would be nice)

State: This code is tested and has worked well in a range of settings, and is currently deployed on edx.org.

Metadata

Release files for openedx-django-pyfs 4.1.0

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

Source distribution (sdist)

Source distribution for openedx-django-pyfs 4.1.0
File Size Uploaded Provenance Actions
openedx_django_pyfs-4.1.0.tar.gz 23.0 kB With provenance Details for openedx_django_pyfs-4.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for openedx-django-pyfs 4.1.0
File Interpreter ABI Platform Actions
openedx_django_pyfs-4.1.0-py3-none-any.whl Python 3 none any Details for openedx_django_pyfs-4.1.0-py3-none-any.whl

Total release size: 36.8 kB

Release files / openedx_django_pyfs-4.1.0.tar.gz

Download URL openedx_django_pyfs-4.1.0.tar.gz
Size 23.0 kB
Tags Source
SHA-256 checksum
How to use checksums
f8cc3eb3070ee0dcf9d56f66b68f82b152c4a99c6d7b299c35197d2296882e5a
BLAKE2b-256 checksum
How to use checksums
a0e9cddd137d2efb6c9308ecbc5267970ec177ce2b16bc3a1f89e5217fe3fea6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Oct 29, 2026.

Transparency log

Release files / openedx_django_pyfs-4.1.0-py3-none-any.whl

Download URL openedx_django_pyfs-4.1.0-py3-none-any.whl
Size 13.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
34e843a860443822ebc5f81b0eedcb084334c5a637b5682da829405589b46548
BLAKE2b-256 checksum
How to use checksums
0094c3251adf2f6f6e3d4bec9f51b67b39207a84046e4eecf482806fcc8f5797
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Oct 29, 2026.

Transparency log

Security for openedx-django-pyfs 4.1.0

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for openedx_django_pyfs-4.1.0.tar.gz

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 Oct 29, 2026.

Transparency log

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