Skip to content

Put caller cwd on sys.path for generate metadata - #820

Open
Hashim1999164 wants to merge 1 commit into
uber:masterfrom
Hashim1999164:fix/generate-metadata-cwd-sys-path
Open

Put caller cwd on sys.path for generate metadata#820
Hashim1999164 wants to merge 1 commit into
uber:masterfrom
Hashim1999164:fix/generate-metadata-cwd-sys-path

Conversation

@Hashim1999164

@Hashim1999164 Hashim1999164 commented Aug 22, 2026

Copy link
Copy Markdown

Fixes #203

The petastorm-generate-metadata.py console script could not locate a project unischema class because installed scripts do not keep the caller's working directory on sys.path. pydoc.locate then fails for modules that live in the project tree.

_main now puts os.getcwd() at the front of sys.path before resolving --unischema_class. A unit test covers that cwd wins over an install bin path.

Test plan

  1. Run test_ensure_cwd_on_sys_path_puts_cwd_first
  2. From a project directory, run petastorm-generate-metadata.py with --unischema_class pointing at a local module and confirm it loads

@CLAassistant

CLAassistant commented Aug 22, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

petastorm-generate-metadata.py cannot locate unischema class due to unexpected working directory

2 participants