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

datajoint python CLI #1095

Closed
wants to merge 10 commits into from
Closed

datajoint python CLI #1095

wants to merge 10 commits into from

Conversation

A-Baji
Copy link
Collaborator

@A-Baji A-Baji commented Jun 22, 2023

Examples:

vscode ➜ /workspaces/datajoint-python (dj-cli) $ dj
dj repl

>>> dj.config
{   'connection.charset': '',
    'connection.init_function': None,
    'database.host': 'fakeservices.datajoint.io',
    'database.password': 'simple',
    'database.port': 3306,
    'database.reconnect': True,
    'database.use_tls': None,
    'database.user': 'root',
    'display.limit': 12,
    'display.show_tuple_count': True,
    'display.width': 14,
    'enable_python_native_blobs': True,
    'fetch_format': 'array',
    'filepath_checksum_size_limit': None,
    'loglevel': 'INFO',
    'safemode': True}
>>> 
vscode ➜ /workspaces/datajoint-python (dj-cli) $ datajoint -u test_user -p test_password -h test_host
dj repl

>>> print(dj.config['database.user'],dj.config['database.password'],dj.config['database.host'])
test_user test_password test_host
>>> 
vscode ➜ /workspaces/datajoint-python (dj-cli) $ dj -s djtest_test1:test1 djtest_relational:relational
[2023-06-22 17:35:08,925][INFO]: Connecting [email protected]:3306
[2023-06-22 17:35:08,930][INFO]: Connected [email protected]:3306
dj repl

schema modules:

  - test1
  - relational

>>> test1.TTest()
*key    value    
+-----+ +-------+
0       0        
1       2        
2       4        
3       6        
4       8        
5       10       
6       12       
7       14       
8       16       
9       18       
 (Total: 10)

>>> 

@A-Baji A-Baji linked an issue Jun 22, 2023 that may be closed by this pull request
@A-Baji A-Baji requested a review from dimitri-yatsenko June 22, 2023 18:16
Copy link
Member

@dimitri-yatsenko dimitri-yatsenko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's merge it, although the documentation is still pending.

@ethho
Copy link
Contributor

ethho commented Sep 12, 2024

@dimitri-yatsenko This needs to merge in master branch.

import subprocess
import pytest
import datajoint as dj
from . import CONN_INFO_ROOT, PREFIX
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pytests not working in Dev Container with new pytest framework. Will need to migrate dependencies like CONN_INFO_ROOT to the respective pytest.fixtures.

vscode ➜ /workspaces/datajoint-python (hidden-1091-continued) $ pytest tests/test_cli.py
========================================================= test session starts ==========================================================
platform linux -- Python 3.11.4, pytest-8.2.2, pluggy-1.5.0
rootdir: /workspaces/datajoint-python
plugins: Faker-28.4.1, cov-5.0.0
collected 0 items / 1 error                                                                                                            

================================================================ ERRORS ================================================================
__________________________________________________ ERROR collecting tests/test_cli.py __________________________________________________
ImportError while importing test module '/workspaces/datajoint-python/tests/test_cli.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/local/lib/python3.11/importlib/__init__.py:126: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
tests/test_cli.py:9: in <module>
    from . import CONN_INFO_ROOT, PREFIX
E   ImportError: cannot import name 'CONN_INFO_ROOT' from 'tests' (/workspaces/datajoint-python/tests/__init__.py)
======================================================= short test summary info ========================================================
ERROR tests/test_cli.py
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
=========================================================== 1 error in 0.20s ===========================================================

@ethho
Copy link
Contributor

ethho commented Sep 12, 2024

Continued development on #1181.

@ethho ethho closed this Sep 12, 2024
dimitri-yatsenko added a commit that referenced this pull request Sep 12, 2024
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.

DataJoint CLI / launcher script
3 participants