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")

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.

Download files

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

Source Distribution

pyportal-1.0.2.tar.gz (7.8 kB view details)

Uploaded Source

Built Distribution

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

pyportal-1.0.2-py3-none-any.whl (6.3 kB view details)

Uploaded Python 3

File details

Details for the file pyportal-1.0.2.tar.gz.

File metadata

  • Download URL: pyportal-1.0.2.tar.gz
  • Upload date:
  • Size: 7.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.11

File hashes

Hashes for pyportal-1.0.2.tar.gz
Algorithm Hash digest
SHA256 f0f694398ae4b7bb495e065cc1f844429a2587bcbc1ce00d25536cefd5c8b02c
MD5 f755fbf98f3af01c48e9a20a2b4ba0b9
BLAKE2b-256 046f7fce493f142582eed9a3845be8a1ec73eb73ac714a7b293dfdaf5194d8dd

See more details on using hashes here.

File details

Details for the file pyportal-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: pyportal-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 6.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.11

File hashes

Hashes for pyportal-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 7a1160c407f14056e6dae31785e9b8765730862d9a6f98d89c30394803174f56
MD5 6a6fa568b58f5dae63524ceed22b58dd
BLAKE2b-256 4e6a897f600da8823be2052996f683ccc218d81ee0f595ef006e8d32ff849016

See more details on using hashes here.

Release history Release notifications | RSS feed

1.0.3

2 files

This release

1.0.2 This release

2 files

1.0.1

2 files

1.0.0

2 files

Supported by

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