Skip to main content

pyportal

When you have scripts like below

# /myscripts/utils.py
def my_func():
    print("hello!")

# /myscripts/data_analysis.py
def show_df(df):
    print(df)
import pyportal
pyportal.path = ['/myscripts'] # OR, configure global path in environemnt variable (see below)
import pyportal.utils.file as U
U.my_func()

from pyportal.data_analysis.file import show_df
show_df()

Installation

pip install pyportal

Import from a commit

# Commit 1
# /myscripts/utils.py
def my_func():
    print("version 1")

# Commit 2, timestamp 20251231235959
# /myscripts/utils.py
def my_func():
    print("version 2")

# ...

# Commit 10, timestamp 20261231235959
# /myscripts/utils.py
def my_func():
    print("version 10")

import pyportal
import pyportal.utils.v20251231235959 as U
U.my_func()
# prints "version 2"

import pyportal.utils.v20261231235959 as U2
U2.my_func()
# prints "version 10"

pyportal path

Set it up globally on your computer or locally in a script.

Configure globally in environment variable PYPORTAL_PATH, separated by a semicolon:

PYPORTAL_PATH = "/myscript1;/home/var/mylibrary"

Temporarily set/update portal path in code:

import pyportal
pyportal.path.insert(0, "/search/this/folder/first")

Automatically reload imports

Reload matching modules imported by scripts loaded through PyPortal:

import pyportal

pyportal.auto_reloads(pattern=["autoreview.*"], verbose=True)

import pyportal.autoreview.reactors.fleet.A.file as A

When A is imported again, a cached matching import such as autoreview.reactors.base is removed from Python's module cache before A imports it. With verbose=True, PyPortal prints the importing script and reloaded module.

Doc

import pyportal.[path_to_file].[version] 

[path_to_file]: can be the script name or path.import pyportal.utils.file : import the FIRST script or package found under the path. Modules are folders that contain __init__.py. utils can be a path pointing to a script or package, like pyportal.utils.network.file, if relative path utils/network exists under one of the paths.

[version]: file or vyyyymmddHHMMSS. The latter is v + the timestamp of the commit.

Import from commit only works if the folder is a git repo. The timestamp of the commit will be shown when you use .file to import a file form a repo, you just need to copy and paste the version, replacing the .file with vYOURVERSION to lock it.

Metadata

Release files for pyportal 1.0.3

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

Source distribution (sdist)

Source distribution for pyportal 1.0.3
File Size Uploaded Provenance Actions
pyportal-1.0.3.tar.gz 8.5 kB Without provenance Details for pyportal-1.0.3.tar.gz

Built distribution (wheel)

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

Total release size: 15.3 kB

Release files / pyportal-1.0.3.tar.gz

Download URL pyportal-1.0.3.tar.gz
Size 8.5 kB
Tags Source
SHA-256 checksum
How to use checksums
61d719f1aa606009378b16b447bbdc93b0fcbd0ce74944c8d5f7ef2f30a147d1
BLAKE2b-256 checksum
How to use checksums
b736320f6d60abd47306e9899058843db7b60d3b08832912949f6d5e15063be9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.20

Release files / pyportal-1.0.3-py3-none-any.whl

Download URL pyportal-1.0.3-py3-none-any.whl
Size 6.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fb6c56e83cbede1f196042be0a2e60efd277ce58c465e29a748dcad32bbe54a8
BLAKE2b-256 checksum
How to use checksums
1c56ad60e99a5d9fa10881db445ee0cb34f1de8f507eaede124f795a62a49e8f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.20

Security for pyportal 1.0.3

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