Skip to content

Commit 4e57e9d

Browse files
Push code for 2.12 (#259)
Fixes, code enhancements * remove lowercase call while parsing csv for adding users * set user agent (#219) * Add and clean up logging, always include version in logs (#234, #224) * Encoding filter values to handle spaces and special chars in filters (#225) * replace polling code with library call * readme updates (#235) * Read and warn when user sets thumbnail options. (including 'not yet implemented' message for --thumbnail-group) * freeze tsc dependency (#248) New functionality * added new --filter option to pass in un-encoded value for simpler input * Add --url, --include-all/--embedded-datasources for create/refresh/delete extract commands (#227) * Add new command for listing content on the site (#230) * Implement publishing options overwrite/append/replace arguments (including not-yet-implemented message for --replace) (#236) * implement --proxy, --no-proxy, --use-certificate option (#241) * add --token-file option (#243) --------- Co-authored-by: Bhuvnesh Singh <[email protected]>
1 parent e0e4766 commit 4e57e9d

22 files changed

+561
-263
lines changed

README.md

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ e.g
2020
* `tabcmd help`
2121

2222
###or
23-
## Install on the command line (requires Python 3.7+)
23+
## Install on the command line
24+
25+
(Note: this requires Python 3.7+. Generally we will actively support versions of Python that are still in security support).
2426

2527
```shell
2628
pip install tabcmd
@@ -83,21 +85,12 @@ see the user documentation at https://tableau.github.io/tabcmd/
8385

8486

8587
## Release Notes
86-
Version 2.0 is the first version of tabcmd built in python.
88+
Version 2 is the first version of tabcmd built in python.
8789
It is specifically targeted to support users of Tableau Online, who are required to have MFA enabled.
88-
(MFA support is not available in tabcmd 2022.2). It does not yet fully replace the existing tabcmd client.\
89-
**Known gaps**
90-
- handling custom views in get/export commands
91-
- several commands that can only be run by a Server Admin:
92-
- editdomain / listdomains
93-
- initialuser
94-
- reset_openid_sub
95-
- runschedule
96-
- set
97-
- syncgroup
98-
- upgradethumbnails
99-
- validateidpmetadata
90+
(MFA support is not available in the tabcmd program that ships with Tableau Server).
10091

92+
Version 2 does not yet fully replace the existing tabcmd client, in particular it **does not support most server admin actions**.
93+
For known gaps in supported functionality, see the latest [release notes](https://github.com/tableau/tabcmd/releases)
10194

10295
## About
10396

contributing.md

Lines changed: 55 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,35 @@
11

22
# For developers
33
* [Install tabcmd](#install-tabcmd)
4-
* [Run tabcmd](#run-tabcmd)
5-
* [Development commands](#development-commands)
64
* [Contributing](#contributing)
7-
* [To add a new command](#to-add-a-new-command)
8-
* [Why Python\?](#why-python)
9-
* [Project Structure](#project-structure)
10-
5+
* [Development](#development)
6+
* [Dev scripts](#dev-scripts)
7+
* [Why Python\?](#why-python)
8+
* [Project structure](#project-structure)
9+
* [To add a new command](#to-add-a-new-command)
10+
* [Localization](#localization)
11+
* [Releases](#releases)
12+
* [Versioning](#versioning)
13+
* [Packaging](#packaging)
14+
15+
16+
These instructions are for people who want to download the code and edit it directly. If you are interested in tabcmd but not the code, see [here](Readme.md).
17+
####To work with tabcmd, you need to have **Python 3.7+** installed.
1118

1219

13-
## Install tabcmd
14-
These instructions are only necessary if you want to download the code and run it directly. If you are interested in tabcmd but not the code, see [here](Readme.md).
15-
####To work with tabcmd, you need to have **Python 3.7+** installed.
20+
## Contributing
1621

17-
###
22+
Code contributions and improvements by the community are welcomed!
1823

24+
See the LICENSE file for current open-source licensing and use information.
1925

26+
Before we can accept pull requests from contributors, we require a signed [Contributor License Agreement (CLA)](http://tableau.github.io/contributing.html).
27+
2028

2129
## Development
2230

23-
To work on the tabcmd code, use these scripts. On Windows,
31+
### Dev scripts
32+
To work on the tabcmd code, use these scripts.
2433
_(note that running mypy and black is required for code being submitted to the repo)_
2534

2635
- build
@@ -38,42 +47,14 @@ _(note that running mypy and black is required for code being submitted to the r
3847
- do test coverage calculation (https://coverage.readthedocs.io/en/6.3.2)
3948
> bin/coverage.sh
4049
41-
- To trigger publishing to pypi tag a commit on main with 'pypi'. Versioning is done with
42-
- setuptools_scm so it will be a x.y.dev0 pre-release version unless you first tag the
43-
- commit with a new version tag. e.g
44-
> git tag -d pypi && git push --delete origin pypi
45-
> git tag v2.0.4 && git tag pypi && git push --tags
46-
47-
# Missing step: a job that is triggered by pypi tag and creates a release
48-
# Missing trigger: when pypi-release is done, begin the app smoke test
4950

50-
- packaging to an exe is done with pyinstaller. You can only build an executable for
51-
- the platform you build on.
52-
- On github this job is triggered by creating a release (or manually)
53-
> doit version <-- produce a current version and metadata file to package
54-
> pyinstaller tabcmd-windows.spec .... # see package.yml for OS-specific arguments
55-
56-
Packaging produces dist/tabcmd.exe (or equivalent).
57-
- Run the package
58-
> dist/tabcmd/tabcmd.exe --help
59-
60-
61-
## Why Python?
51+
### Why Python?
6252

6353
* Cross-platform
6454
* Build on our existing Python [Tableau Server Client](https://github.com/tableau/server-client-python/)
6555

6656

67-
## Contributing
68-
69-
Code contributions and improvements by the community are welcomed!
70-
71-
See the LICENSE file for current open-source licensing and use information.
72-
73-
Before we can accept pull requests from contributors, we require a signed [Contributor License Agreement (CLA)](http://tableau.github.io/contributing.html).
74-
75-
76-
## Project structure
57+
### Project structure
7758
The core design principles for this app are
7859
- it must provide the functionality of the instance of tabcmd, with drop-in replacement CLI options
7960
- it should be able to call [tsc](https://github.com/tableau/server-client-python/) for all server actions
@@ -84,12 +65,43 @@ The core design principles for this app are
8465
3. the 'commands' module contains the logic required to translate the tabcmd CLI interface into calls to tsc. This is completely dissociated from the parsers, and could theoretically be called from a completely different interface.
8566
4. The 'execution' module is the core logic. TabcmdController gets an argparse parser, then attaches all the defined parsers to it and associates one command with each parser.
8667

87-
## To add a new command
68+
### To add a new command
8869
0. choose the single word that will be used as your command. Let's call this one `dream`
8970
1. add parsers/dream_parser.py, and use methods from parent_parser to define the arguments
9071
2. add commands/dreams/dream_command.py. It must have a method run_command.py(args) and the args object must contain all information needed from the user.
9172
3. in map_of_parsers.py, add an entry for your new parser, like "dreams": DreamParser.dream_parser
9273
4. in map_of_commands.py, add an entry for your new command, like "dream": ("dream", DreamCommand, "Think about picnics"),"
93-
5. add tests!
74+
5. add tests!
75+
76+
### Localization
77+
78+
Strings are stored in /tabcmd/locales/[language]/*.properties by id and referred to in code as
79+
> string = _("string.id")
80+
81+
For runtime execution these files must be converted to .mo via .po
82+
> doit mo
9483
9584

85+
## Releases
86+
To trigger publishing to pypi tag a commit on main with 'pypi'.
87+
When pypi-release is done, begin the app smoke test action.
88+
89+
### Versioning
90+
Versioning is done with setuptools_scm and based on git tags.
91+
It will be a x.y.dev0 pre-release version except for commits with a new version tag. e.g
92+
> git tag v2.0.4 && git push --tags
93+
94+
A new tag is created with the name of each release on github.
95+
96+
### Packaging
97+
Before packaging, we produce a current metadata file to include in the bundle
98+
> doit version
99+
100+
Packaging is done with pyinstaller, which will build an executable for the platform it runs on.
101+
A github action runs on Mac, Windows and Linux to generate each executable.
102+
103+
> pyinstaller tabcmd-windows.spec ....
104+
105+
Packaging produces executables in the dist folder. To run:
106+
> dist/tabcmd/tabcmd.exe --help
107+

pyproject.toml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ packages = ["tabcmd"]
99
tabcmd = ["tabcmd.locales/**/*.mo"]
1010
[tool.black]
1111
line-length = 120
12-
target-version = ['py37', 'py38', 'py39', 'py310']
12+
target-version = ['py37', 'py38', 'py39', 'py310', 'py311']
1313
extend-exclude = '^/bin/*'
1414
[tool.mypy]
1515
disable_error_code = [
@@ -30,14 +30,16 @@ description="A command line client for working with Tableau Server."
3030
authors = [{name="Tableau", email="[email protected]"}]
3131
license = {file = "LICENSE"}
3232
readme = "README.md"
33-
requires-python = ">=3.7"
33+
requires-python = ">=3.7" # https://devguide.python.org/versions/
3434
classifiers = [
3535
"Programming Language :: Python",
3636
"Programming Language :: Python :: 3",
3737
"Programming Language :: Python :: 3.7",
3838
"Programming Language :: Python :: 3.8",
3939
"Programming Language :: Python :: 3.9",
40-
"Programming Language :: Python :: 3.10"
40+
"Programming Language :: Python :: 3.10",
41+
"Programming Language :: Python :: 3.11",
42+
"Programming Language :: Python :: 3.12"
4143
]
4244
dependencies = [
4345
'argparse',
@@ -56,7 +58,7 @@ dependencies = [
5658
]
5759
[project.optional-dependencies]
5860
test = [
59-
"black",
61+
"black>=22,<23",
6062
"mock",
6163
"mypy",
6264
"pytest>=7.0",

tabcmd/__main__.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,8 @@
33
try:
44
from tabcmd.tabcmd import main
55
except ImportError as e:
6-
print(sys.stderr, e)
7-
print(sys.stderr, "Tabcmd needs to be run as a module, it cannot be run as a script")
8-
print(sys.stderr, "Try running python -m tabcmd")
6+
print("Exception thrown running program: `{}`, `{}`".format(e, e.__context__), file=sys.stderr)
7+
print("[Possible cause: Tabcmd needs to be run as a module, try running `python -m tabcmd`]", file=sys.stderr)
98
sys.exit(1)
109

1110
if __name__ == "__main__":

0 commit comments

Comments
 (0)