Skip to main content

pylookwhat

Sometimes when we need to reference other project’s settings to do something, we can use execfile to parse file get variable inside. But a few things can make it difficult:

  1. Dependency package(s) are not installed

  2. Relative module(s) not in sys.path

  3. Local module name confused due to scoping.

Use pylookwhat to solve these

import pylookwhat

what = {}
lookwhat = [ 'A', 'B'  ]
filename = 'what.py'
pylookwhat.lookwhat( filename, what, lookwhat  )

print what

what.py

A = { "Hello": "World" }
B = [ 1, 2, 3 ]

Patch

Modify variables in script. Backup file will be named with datetime.

python -m pylookwhat patch target.py source.py false

target.py

A="Hello"
B=123

source.py

A = "Hello World"

Patched target.py

A = "Hello World"
B=123
1.0.3

Fix missing text when patch with dict variables

Release files for pylookwhat 0.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 pylookwhat 0.0.3
File Size Uploaded
pylookwhat-0.0.3.zip 6.1 kB Details

Release files / pylookwhat-0.0.3.zip

Download URL pylookwhat-0.0.3.zip
Size 6.1 kB
Tags Source
SHA-256 checksum
How to use checksums
c7a36cd6d11f13471a2737db266e52dd42cc2072b1f08a296d93f203a02f284f
BLAKE2b-256 checksum
How to use checksums
39eaf8560ac2df64c92e46d8cc1651bb5b755b9482435c9d6646fb218f7a023e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.0.3 This release

1 release file

0.0.2

1 release file

0.0.1

1 release file

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