Odooly 3.0.1__tar.gz → 3.0.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. {odooly-3.0.1 → odooly-3.0.2}/CHANGES.rst +11 -3
  2. {odooly-3.0.1 → odooly-3.0.2/Odooly.egg-info}/PKG-INFO +5 -4
  3. {odooly-3.0.1/Odooly.egg-info → odooly-3.0.2}/PKG-INFO +5 -4
  4. {odooly-3.0.1 → odooly-3.0.2}/README.rst +4 -3
  5. {odooly-3.0.1 → odooly-3.0.2}/docs/intro.rst +2 -2
  6. {odooly-3.0.1 → odooly-3.0.2}/odooly/__init__.py +1 -1
  7. {odooly-3.0.1 → odooly-3.0.2}/odooly/_demo.py +3 -4
  8. {odooly-3.0.1 → odooly-3.0.2}/odooly/run.py +32 -20
  9. {odooly-3.0.1 → odooly-3.0.2}/tests/_common.py +11 -2
  10. {odooly-3.0.1 → odooly-3.0.2}/tests/test_client.py +2 -2
  11. {odooly-3.0.1 → odooly-3.0.2}/tests/test_interact.py +4 -2
  12. {odooly-3.0.1 → odooly-3.0.2}/tests/test_util.py +6 -3
  13. {odooly-3.0.1 → odooly-3.0.2}/LICENSE +0 -0
  14. {odooly-3.0.1 → odooly-3.0.2}/Odooly.egg-info/SOURCES.txt +0 -0
  15. {odooly-3.0.1 → odooly-3.0.2}/Odooly.egg-info/dependency_links.txt +0 -0
  16. {odooly-3.0.1 → odooly-3.0.2}/Odooly.egg-info/entry_points.txt +0 -0
  17. {odooly-3.0.1 → odooly-3.0.2}/Odooly.egg-info/requires.txt +0 -0
  18. {odooly-3.0.1 → odooly-3.0.2}/Odooly.egg-info/top_level.txt +0 -0
  19. {odooly-3.0.1 → odooly-3.0.2}/docs/Makefile +0 -0
  20. {odooly-3.0.1 → odooly-3.0.2}/docs/api.rst +0 -0
  21. {odooly-3.0.1 → odooly-3.0.2}/docs/conf.py +0 -0
  22. {odooly-3.0.1 → odooly-3.0.2}/docs/developer.rst +0 -0
  23. {odooly-3.0.1 → odooly-3.0.2}/docs/index.rst +0 -0
  24. {odooly-3.0.1 → odooly-3.0.2}/docs/tutorial.rst +0 -0
  25. {odooly-3.0.1 → odooly-3.0.2}/odooly/__main__.py +0 -0
  26. {odooly-3.0.1 → odooly-3.0.2}/odooly/client.py +0 -0
  27. {odooly-3.0.1 → odooly-3.0.2}/odooly/colorize.py +0 -0
  28. {odooly-3.0.1 → odooly-3.0.2}/odooly/environment.py +0 -0
  29. {odooly-3.0.1 → odooly-3.0.2}/odooly/exceptions.py +0 -0
  30. {odooly-3.0.1 → odooly-3.0.2}/odooly/helpers.py +0 -0
  31. {odooly-3.0.1 → odooly-3.0.2}/odooly/http.py +0 -0
  32. {odooly-3.0.1 → odooly-3.0.2}/odooly/models.py +0 -0
  33. {odooly-3.0.1 → odooly-3.0.2}/odooly/printer.py +0 -0
  34. {odooly-3.0.1 → odooly-3.0.2}/odooly/service.py +0 -0
  35. {odooly-3.0.1 → odooly-3.0.2}/odooly.ini +0 -0
  36. {odooly-3.0.1 → odooly-3.0.2}/pyproject.toml +0 -0
  37. {odooly-3.0.1 → odooly-3.0.2}/setup.cfg +0 -0
  38. {odooly-3.0.1 → odooly-3.0.2}/tests/__init__.py +0 -0
  39. {odooly-3.0.1 → odooly-3.0.2}/tests/test_model.py +0 -0
@@ -2,6 +2,14 @@ Changelog
2
2
  ---------
3
3
 
4
4
 
5
+ 3.0.2 (2026-11-13)
6
+ ~~~~~~~~~~~~~~~~~~
7
+
8
+ * Remove implicit connection to localhost when argument is missing.
9
+
10
+ * Honor ``--list`` even when standard input is not a terminal.
11
+
12
+
5
13
  3.0.1 (2026-11-13)
6
14
  ~~~~~~~~~~~~~~~~~~
7
15
 
@@ -27,9 +35,9 @@ package structure. As a consequence, some import paths have to be adapted in yo
27
35
  variable ``ODOOLY_HISTFILE``.
28
36
  * Support running wheel file without installing:
29
37
  ``python odooly-3.0.0-py3-none-any.whl/odooly --version``
30
- * Switch the project to a package structure
31
- * Build: migrate to pyproject.toml
32
- * Build: change Web theme for documentation
38
+ * Switch the project to a package structure.
39
+ * Build: migrate to pyproject.toml.
40
+ * Build: change Web theme for documentation.
33
41
 
34
42
 
35
43
  2.6.9 (2026-11-06)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: Odooly
3
- Version: 3.0.1
3
+ Version: 3.0.2
4
4
  Summary: Versatile tool for Odoo
5
5
  Author-email: Florent Xicluna <florent.xicluna@gmail.com>
6
6
  License-Expression: BSD-3-Clause
@@ -38,11 +38,11 @@ Odooly, a versatile tool for Odoo
38
38
 
39
39
  Install with `uv <https://docs.astral.sh/uv/#installation>`_::
40
40
 
41
- uv tool install -U odooly
41
+ uv tool install -U odooly[requests]
42
42
 
43
43
  Or with Pip::
44
44
 
45
- pip install -U odooly
45
+ pip install -U odooly[requests]
46
46
 
47
47
  As an alternative, ``uv`` can invoke Odooly without installing::
48
48
 
@@ -74,8 +74,9 @@ Key features:
74
74
  - simplified syntax for search ``domain``
75
75
  - entire API accessible on the ``Client.env`` environment
76
76
  - can be imported and used as a library: ``from odooly import Client``
77
+ - no external dependency: ``requests`` is optional
78
+ - can use without installing: ``python path/to/odooly.whl/odooly --help``
77
79
  - supports Python 3.8 and more recent
78
- - no external dependency, can use without installing
79
80
 
80
81
 
81
82
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: Odooly
3
- Version: 3.0.1
3
+ Version: 3.0.2
4
4
  Summary: Versatile tool for Odoo
5
5
  Author-email: Florent Xicluna <florent.xicluna@gmail.com>
6
6
  License-Expression: BSD-3-Clause
@@ -38,11 +38,11 @@ Odooly, a versatile tool for Odoo
38
38
 
39
39
  Install with `uv <https://docs.astral.sh/uv/#installation>`_::
40
40
 
41
- uv tool install -U odooly
41
+ uv tool install -U odooly[requests]
42
42
 
43
43
  Or with Pip::
44
44
 
45
- pip install -U odooly
45
+ pip install -U odooly[requests]
46
46
 
47
47
  As an alternative, ``uv`` can invoke Odooly without installing::
48
48
 
@@ -74,8 +74,9 @@ Key features:
74
74
  - simplified syntax for search ``domain``
75
75
  - entire API accessible on the ``Client.env`` environment
76
76
  - can be imported and used as a library: ``from odooly import Client``
77
+ - no external dependency: ``requests`` is optional
78
+ - can use without installing: ``python path/to/odooly.whl/odooly --help``
77
79
  - supports Python 3.8 and more recent
78
- - no external dependency, can use without installing
79
80
 
80
81
 
81
82
 
@@ -4,11 +4,11 @@ Odooly, a versatile tool for Odoo
4
4
 
5
5
  Install with `uv <https://docs.astral.sh/uv/#installation>`_::
6
6
 
7
- uv tool install -U odooly
7
+ uv tool install -U odooly[requests]
8
8
 
9
9
  Or with Pip::
10
10
 
11
- pip install -U odooly
11
+ pip install -U odooly[requests]
12
12
 
13
13
  As an alternative, ``uv`` can invoke Odooly without installing::
14
14
 
@@ -40,8 +40,9 @@ Key features:
40
40
  - simplified syntax for search ``domain``
41
41
  - entire API accessible on the ``Client.env`` environment
42
42
  - can be imported and used as a library: ``from odooly import Client``
43
+ - no external dependency: ``requests`` is optional
44
+ - can use without installing: ``python path/to/odooly.whl/odooly --help``
43
45
  - supports Python 3.8 and more recent
44
- - no external dependency, can use without installing
45
46
 
46
47
 
47
48
 
@@ -12,11 +12,11 @@ Installation
12
12
  Download and install the `latest release
13
13
  <https://pypi.org/project/Odooly>`__ from PyPI::
14
14
 
15
- uv tool install -U odooly
15
+ uv tool install -U odooly[requests]
16
16
 
17
17
  Or::
18
18
 
19
- pip install -U odooly
19
+ pip install -U odooly[requests]
20
20
 
21
21
  As an alternative, ``uv`` can invoke Odooly without installing::
22
22
 
@@ -1,5 +1,5 @@
1
1
  """Odoo client library and command line tool"""
2
- __version__ = '3.0.1'
2
+ __version__ = '3.0.2'
3
3
 
4
4
  from .client import Client
5
5
  from .environment import Env
@@ -42,10 +42,9 @@ def _retrieve_servers(url=RUNBOT_URL, regex=RUNBOT_REGEX, user=None, headers=RUN
42
42
  test_servers = collections.defaultdict(set)
43
43
  overview = HTTPSession().request(url, method='GET', headers=headers)
44
44
  builds = re.findall(regex, overview, re.DOTALL)
45
- if not builds:
46
- if os.getenv("ODOOLY_DEBUG"):
47
- fdump = Path.cwd() / "runbot_odoo_com.html"
48
- fdump.write_text(overview)
45
+ if not builds and os.getenv("ODOOLY_DEBUG"):
46
+ fdump = Path.cwd() / "runbot_odoo_com.html"
47
+ fdump.write_text(overview)
49
48
  raise SystemExit(f"Could not parse content of {RUNBOT_HOST}:\n check here \"{fdump}\"")
50
49
  for edition, domain, build, ver in builds:
51
50
  suffix = "+e" if edition == "Enterprise" else ""
@@ -17,7 +17,6 @@ from .printer import Printer, convert_to_width, pp, set_output_width
17
17
 
18
18
  CONF_FILE = 'odooly.ini'
19
19
  HIST_FILE = '~/.odooly_history'
20
- DEFAULT_URL = 'http://localhost:8069/'
21
20
 
22
21
  USAGE = """\
23
22
  Usage (some commands):
@@ -279,11 +278,11 @@ def get_parser():
279
278
  '--env',
280
279
  help='read connection settings from the given section')
281
280
  parser.add_argument(
282
- '-c', '--config', default=None,
281
+ '-c', '--config', default=None, type=Path,
283
282
  help=f'specify alternate config file (default: {CONF_FILE})')
284
283
  parser.add_argument(
285
284
  '--server', default=None,
286
- help=f'full URL of the server (default: {DEFAULT_URL})')
285
+ help=f'full URL of the server')
287
286
  parser.add_argument('-d', '--db', default=None, help='database')
288
287
  parser.add_argument('-u', '--user', default=None, help='username')
289
288
  parser.add_argument(
@@ -308,17 +307,27 @@ def get_parser():
308
307
 
309
308
  def connect_client(args):
310
309
  if (env_name := args.demo or args.env):
311
- client = InteractiveClient.from_config(env_name, user=args.user, database=args.db,
312
- verbose=args.verbose)
310
+ kwargs = {
311
+ "user": args.user,
312
+ "database": args.db,
313
+ "verbose": args.verbose,
314
+ }
315
+ client = InteractiveClient.from_config(env_name, **kwargs)
313
316
  else:
314
- if not args.server:
315
- args.server = ['-c', args.config] if args.config else DEFAULT_URL
316
- if args.args:
317
- args.server = args.server + args.args if args.config else ' '.join(args.args)
318
- if not args.user:
319
- args.user = ADMIN_USER
320
- client = InteractiveClient(args.server, args.db, args.user, password=args.password,
321
- api_key=args.api_key, verbose=args.verbose)
317
+ if args.server:
318
+ server = args.server
319
+ elif not args.config:
320
+ server = ' '.join(args.args)
321
+ elif args.args:
322
+ server = ['-c', args.config] + args.args
323
+ else:
324
+ server = ['-c', args.config]
325
+ kwargs = {
326
+ "password": args.password,
327
+ "api_key": args.api_key,
328
+ "verbose": args.verbose,
329
+ }
330
+ client = InteractiveClient(server, args.db, args.user or ADMIN_USER, **kwargs)
322
331
  return client
323
332
 
324
333
 
@@ -342,8 +351,8 @@ def main(interact=_interact):
342
351
 
343
352
  If it is not interactive, execute script received on standard input.
344
353
  """
345
- args = get_parser().parse_args()
346
- is_interactive_shell = sys.stdin.isatty()
354
+ aparser = get_parser()
355
+ args = aparser.parse_args()
347
356
 
348
357
  client_class = InteractiveClient
349
358
  client_class._config_file = Path.cwd() / (args.config or CONF_FILE)
@@ -352,16 +361,19 @@ def main(interact=_interact):
352
361
  from ._demo import _retrieve_servers
353
362
 
354
363
  client_class._saved_config_demo = _retrieve_servers(user=args.user or "demo")
355
-
356
- if not is_interactive_shell: # Read and execute commands from standard input
357
- client = connect_client(args)
358
- exec(compile(sys.stdin.read(), '<stdin>', 'exec'), {'client': client, 'env': client.env})
359
- return
360
364
  if args.list_env:
361
365
  print('Available settings: ' + ' '.join(client_class.read_config()))
362
366
  if args.demo:
363
367
  print(' ' + ' '.join(client_class._saved_config_demo))
364
368
  return
369
+ if not (args.args or args.server or args.config or args.env or args.demo):
370
+ aparser.error("missing argument")
371
+
372
+ is_interactive_shell = sys.stdin.isatty()
373
+ if not is_interactive_shell: # Read and execute commands from standard input
374
+ client = connect_client(args)
375
+ exec(compile(sys.stdin.read(), '<stdin>', 'exec'), {'client': client, 'env': client.env})
376
+ return
365
377
 
366
378
  # Interactive mode
367
379
  client_class._globals = {
@@ -73,9 +73,18 @@ class OdooTestCase(TestCase):
73
73
  'Content-Type': 'application/json',
74
74
  'X-Odoo-Database': self.database,
75
75
  }
76
- expected_calls[idx] = call(f"{server}{expected[0]}", json=expected[1], headers=headers)
76
+ expected_calls[idx] = call(
77
+ f"{server}{expected[0]}",
78
+ json=expected[1],
79
+ headers=headers,
80
+ )
77
81
  elif expected[0].startswith('/web/'):
78
- jsonrpc_params = {'jsonrpc': '2.0', 'method': 'call', 'params': expected[1], 'id': ANY}
82
+ jsonrpc_params = {
83
+ 'jsonrpc': '2.0',
84
+ 'method': 'call',
85
+ 'params': expected[1],
86
+ 'id': ANY,
87
+ }
79
88
  expected_calls[idx] = call(f"{server}{expected[0]}", json=jsonrpc_params)
80
89
  self.assertMockCalls(self.http_request, expected_calls)
81
90
 
@@ -156,8 +156,8 @@ class TestCreateClient(JsonRpcTestCase):
156
156
  self.service.common.login.return_value = 1
157
157
 
158
158
  s_context = '{"lang": "en_US", "tz": "Europe/Zurich"}'
159
- key_1 = b"\0\0\0\1" + bytes.fromhex(f'{hash("{}")%2**32:08x}')
160
- key_2 = b"\0\0\0\1" + bytes.fromhex(f'{hash(s_context)%2**32:08x}')
159
+ key_1 = b"\0\0\0\1" + bytes.fromhex(f'{hash("{}") % 2**32:08x}')
160
+ key_2 = b"\0\0\0\1" + bytes.fromhex(f'{hash(s_context) % 2**32:08x}')
161
161
  client = odooly.Client(self.server, 'newdb', 'usr', 'pss')
162
162
  expected_calls = self.startup_calls + (
163
163
  call.common.login('newdb', 'usr', 'pss'),
@@ -233,10 +233,12 @@ class TestInteract19(_TestInteract):
233
233
  self.assertEqual(sys.ps1, 'demo >>> ')
234
234
  self.assertEqual(sys.ps2, ' ... ')
235
235
  expected_calls = self.startup_calls + (
236
- ('/web/session/authenticate', {'db': 'database', 'login': 'gaspard', 'password': 'password'}),
236
+ ('/web/session/authenticate',
237
+ {'db': 'database', 'login': 'gaspard', 'password': 'password'}),
237
238
  ('/json/2/res.users/context_get', {}),
238
239
  call(f'{self.server}doc/res.device.json', method='GET'),
239
- ('/web/session/authenticate', {'db': 'database', 'login': 'gaspard', 'password': 'password'}),
240
+ ('/web/session/authenticate',
241
+ {'db': 'database', 'login': 'gaspard', 'password': 'password'}),
240
242
  )
241
243
  self.assertRequests(*expected_calls)
242
244
  self.assertEqual(getpass.call_count, 2)
@@ -152,8 +152,10 @@ class TestUtils(TestCase):
152
152
  "'duration': datetime.timedelta(days=3, seconds=42, microseconds=200000)}]}"
153
153
  )
154
154
  expected = {
155
- 'create_date': dt_.datetime(2001, 12, 31, 23, 59, 0, tzinfo=dt_.timezone(dt_.timedelta(seconds=19800))),
156
- 'write_date': dt_.datetime(2024, 2, 29, 1, 1, 1, tzinfo=dt_.timezone.utc),
155
+ 'create_date': dt_.datetime(2001, 12, 31, 23, 59, 0,
156
+ tzinfo=dt_.timezone(dt_.timedelta(seconds=19800))),
157
+ 'write_date': dt_.datetime(2024, 2, 29, 1, 1, 1,
158
+ tzinfo=dt_.timezone.utc),
157
159
  'duration': dt_.timedelta(days=3, seconds=42, microseconds=200000)
158
160
  }
159
161
  self.assertEqual(literal_eval(result), {'result': [expected]})
@@ -163,7 +165,8 @@ class TestUtils(TestCase):
163
165
  readfmt = partial(dummy._parse_format, browse=False)
164
166
 
165
167
  # Helper for 'read' methods
166
- (fields, fmt) = readfmt('a {color} elephant enters {location[1]}.\n\n{firstname!r} has left')
168
+ (fields, fmt) = readfmt('a {color} elephant enters {location[1]}.\n\n'
169
+ '{firstname!r} has left')
167
170
  self.assertEqual(fields, ['color', 'location', 'firstname'])
168
171
 
169
172
  def test_printer(self):
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes