hoverinc / tableau-utilities

A module and CLI Utility for managing Tableau objects, locally, and in Tableau Online.
MIT License
4 stars 1 forks source link

Move imports to IF statement to avoid error when installing on Apple … #83

Closed jaybythebay closed 4 months ago

jaybythebay commented 4 months ago

Background

The published package was still having trouble installing on an M1 due to the tableauhyperapi dependency. While the installation had worked when I installed using ./ installing from pip didn't seem to work.

Changes

Testing

I pushed this package to PyPi Test to make sure I really had it fixed this time.

Installs from Pypi Test

➜  ~ pip install -i https://test.pypi.org/simple/ tableau-utilities
Looking in indexes: https://test.pypi.org/simple/
Collecting tableau-utilities
  Downloading https://test-files.pythonhosted.org/packages/8d/ed/d13473417a2e2f06ff049a6d789bebdfd66432fda3568b5cff783a8cc29b/tableau_utilities-2.2.11-py3-none-any.whl.metadata (9.1 kB)
Requirement already satisfied: xmltodict<1.0.0,>=0.12.0 in /opt/homebrew/lib/python3.12/site-packages (from tableau-utilities) (0.13.0)
Requirement already satisfied: pyyaml<7.0.0,>=6.0 in /opt/homebrew/lib/python3.12/site-packages (from tableau-utilities) (6.0.1)
Requirement already satisfied: requests<3.0.0,>=2.27.1 in /opt/homebrew/lib/python3.12/site-packages (from tableau-utilities) (2.31.0)
Requirement already satisfied: pandas<2.0.0,>=1.4.1 in /opt/homebrew/lib/python3.12/site-packages (from tableau-utilities) (1.5.3)
Requirement already satisfied: tabulate<1.0.0,>=0.8.9 in /opt/homebrew/lib/python3.12/site-packages (from tableau-utilities) (0.9.0)
Requirement already satisfied: python-dateutil>=2.8.1 in /opt/homebrew/lib/python3.12/site-packages (from pandas<2.0.0,>=1.4.1->tableau-utilities) (2.9.0.post0)
Requirement already satisfied: pytz>=2020.1 in /opt/homebrew/lib/python3.12/site-packages (from pandas<2.0.0,>=1.4.1->tableau-utilities) (2024.1)
Requirement already satisfied: numpy>=1.21.0 in /opt/homebrew/lib/python3.12/site-packages (from pandas<2.0.0,>=1.4.1->tableau-utilities) (1.26.4)
Requirement already satisfied: charset-normalizer<4,>=2 in /opt/homebrew/lib/python3.12/site-packages (from requests<3.0.0,>=2.27.1->tableau-utilities) (3.3.2)
Requirement already satisfied: idna<4,>=2.5 in /opt/homebrew/lib/python3.12/site-packages (from requests<3.0.0,>=2.27.1->tableau-utilities) (3.7)
Requirement already satisfied: urllib3<3,>=1.21.1 in /opt/homebrew/lib/python3.12/site-packages (from requests<3.0.0,>=2.27.1->tableau-utilities) (2.2.1)
Requirement already satisfied: certifi>=2017.4.17 in /opt/homebrew/lib/python3.12/site-packages (from requests<3.0.0,>=2.27.1->tableau-utilities) (2024.2.2)
Requirement already satisfied: six>=1.5 in /opt/homebrew/lib/python3.12/site-packages (from python-dateutil>=2.8.1->pandas<2.0.0,>=1.4.1->tableau-utilities) (1.16.0)
Downloading https://test-files.pythonhosted.org/packages/8d/ed/d13473417a2e2f06ff049a6d789bebdfd66432fda3568b5cff783a8cc29b/tableau_utilities-2.2.11-py3-none-any.whl (57 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 57.1/57.1 kB 2.1 MB/s eta 0:00:00
Installing collected packages: tableau-utilities
Successfully installed tableau-utilities-2.2.11

Fails on Hyper subpackage as expected

➜  ~ pip install -i https://test.pypi.org/simple/ "tableau-utilities[hyper]"
Looking in indexes: https://test.pypi.org/simple/
Requirement already satisfied: tableau-utilities[hyper] in /opt/homebrew/lib/python3.12/site-packages (2.2.11)
Requirement already satisfied: xmltodict<1.0.0,>=0.12.0 in /opt/homebrew/lib/python3.12/site-packages (from tableau-utilities[hyper]) (0.13.0)
Requirement already satisfied: pyyaml<7.0.0,>=6.0 in /opt/homebrew/lib/python3.12/site-packages (from tableau-utilities[hyper]) (6.0.1)
Requirement already satisfied: requests<3.0.0,>=2.27.1 in /opt/homebrew/lib/python3.12/site-packages (from tableau-utilities[hyper]) (2.31.0)
Requirement already satisfied: pandas<2.0.0,>=1.4.1 in /opt/homebrew/lib/python3.12/site-packages (from tableau-utilities[hyper]) (1.5.3)
Requirement already satisfied: tabulate<1.0.0,>=0.8.9 in /opt/homebrew/lib/python3.12/site-packages (from tableau-utilities[hyper]) (0.9.0)
INFO: pip is looking at multiple versions of tableau-utilities[hyper] to determine which version is compatible with other requirements. This could take a while.
ERROR: Could not find a version that satisfies the requirement tableauhyperapi==0.0.18825; extra == "hyper" (from tableau-utilities[hyper]) (from versions: none)
ERROR: No matching distribution found for tableauhyperapi==0.0.18825; extra == "hyper"

cli succeeds with --help

➜  ~ tableau_utilities --help
usage: tableau_utilities [-h] [--version] [-d] [-s SERVER] [-sn SITE_NAME] [--api_version API_VERSION] [-u USER] [-p PASSWORD] [-ts TOKEN_SECRET]
                         [-tn TOKEN_NAME] [--settings_path SETTINGS_PATH] [-o OUTPUT_DIR] [-c] [-l {local,online}] [-i ID] [-n NAME]
                         [-pn PROJECT_NAME] [-f FILE_PATH] [--definitions_csv DEFINITIONS_CSV] [--include_extract] [-tds] [--conn_user CONN_USER]
                         [--conn_pw CONN_PW] [--conn_type CONN_TYPE] [--conn_db CONN_DB] [--conn_schema CONN_SCHEMA] [--conn_host CONN_HOST]
                         [--conn_role CONN_ROLE] [--conn_warehouse CONN_WAREHOUSE]
                         {server_info,server_operate,datasource,generate_config,csv_config,merge_config} ...

Tableau Utilities CLI:
-Manage Tableau Server/Online
-Manage configurations to edit datasource metadata

options:
  -h, --help            show this help message and exit
  --version             Print the current version of the CLI
  -d, --debugging_logs  Print detailed logging to the console to debug CLI

commands:
  {server_info,server_operate,datasource,generate_config,csv_config,merge_config}
                        You must choose a command.
    server_info         Retrieve and view information from Tableau Cloud/Server
    server_operate      Download, publish, and
...
jaybythebay commented 4 months ago

@JustinGrilli this is ready for review. If you want me to make the version 2.0.01 and you can see if that pushes I'm happy to. I think the version error was probably test pypi not letting me use a lower number than the first thing I had tried. But I could be wrong on that too!

jaybythebay commented 4 months ago

@JustinGrilli Thanks for reviewing! Merge this in whenever you're ready!