Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use importlib.resources to load default logging config file #164

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Commits on Dec 13, 2023

  1. Use importlib.resources default config file

    This allows packaging Singer taps and targets as [_zipapps_](https://docs.python.org/3/library/zipapp.html), which can be executed directly by a Python interpreter without needing to install any dependencies:
    
    ```console
    $ python3 tap-surveymonkey.pyz --config config.json --discover > catalog.json
    ```
    
    Otherwise errors like this are raised:
    
    ```console
    $ python3 target-jsonl.pyz --help
    Traceback (most recent call last):
      File "<frozen runpy>", line 198, in _run_module_as_main
      File "<frozen runpy>", line 88, in _run_code
      File "/projects/target-jsonl/target-jsonl.pyz/__main__.py", line 2, in <module>
      File "/projects/target-jsonl/target-jsonl.pyz/target_jsonl.py", line 12, in <module>
      File "/projects/target-jsonl/target-jsonl.pyz/singer/__init__.py", line 1, in <module>
      File "/projects/target-jsonl/target-jsonl.pyz/singer/utils.py", line 13, in <module>
      File "/projects/target-jsonl/target-jsonl.pyz/singer/catalog.py", line 10, in <module>
      File "/projects/target-jsonl/target-jsonl.pyz/singer/logger.py", line 16, in get_logger
      File "/Users/personal/.pyenv/versions/3.11.7/lib/python3.11/logging/config.py", line 65, in fileConfig
        raise FileNotFoundError(f"{fname} doesn't exist")
    FileNotFoundError: /projects/target-jsonl/target-jsonl.pyz/singer/logging.conf doesn't exist
    ```
    
    With this change:
    
    ```console
    $ python3 target-jsonl.pyz --help
    usage: target-jsonl.pyz [-h] [-c CONFIG]
    
    options:
      -h, --help            show this help message and exit
      -c CONFIG, --config CONFIG
                            Config file
    ```
    edgarrmondragon committed Dec 13, 2023
    Configuration menu
    Copy the full SHA
    21424a3 View commit details
    Browse the repository at this point in the history