Skip to content
This repository has been archived by the owner on Nov 19, 2024. It is now read-only.

Draft: Initial buildout of lincbrain CLI/Python Client from dandi-cli #2

Merged
merged 8 commits into from
Jan 29, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@

# -- Project information -----------------------------------------------------

import dandi
import lincbrain

project = "dandi"
project = "lincbrain"
copyright = "2021-2023, DANDI Team"
author = "DANDI Team"

# The full version, including alpha/beta/rc tags
version = dandi.__version__
release = dandi.__version__
version = lincbrain.__version__
release = lincbrain.__version__


# -- General configuration ---------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion docs/source/examples/dandiapi-as_readable.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from dandi.dandiapi import DandiAPIClient
from lincbrain.dandiapi import DandiAPIClient

dandiset_id = "000006" # ephys dataset from the Svoboda Lab
filepath = "sub-anm372795/sub-anm372795_ses-20170718.nwb" # 450 kB file
Expand Down
2 changes: 1 addition & 1 deletion docs/source/examples/dandiapi-example.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import json

from dandi.dandiapi import DandiAPIClient
from lincbrain.dandiapi import DandiAPIClient

with DandiAPIClient.for_dandi_instance("dandi") as client:
for dandiset in client.get_dandisets():
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion dandi/cli/command.py → lincbrain/cli/command.py
Copy link
Member

Choose a reason for hiding this comment

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

Please update line 100 to the following:

logdir = platformdirs.user_log_dir("lincbrain-cli", "lincbrain")

Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ def main(ctx, log_level, pdb=False):

from ..utils import check_dandi_version

check_dandi_version()
# check_dandi_version()


#
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion dandi/dandiapi.py → lincbrain/dandiapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ def __init__(
:param str token: User API Key. Note that different instance APIs have
different keys.
"""
check_dandi_version()
Copy link
Author

Choose a reason for hiding this comment

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

check_dandi_version() (and versioneer by extension) still need to be set up correctly -- thus references are commented out for now.

# check_dandi_version()
if api_url is None:
if dandi_instance is None:
instance_name = os.environ.get("DANDI_INSTANCE", "dandi")
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
8 changes: 4 additions & 4 deletions dandi/utils.py → lincbrain/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -610,10 +610,10 @@ def _get_instance(
f" please contact that server's administrators: {e}"
)
our_version = Version(__version__)
if our_version < minversion:
raise CliVersionTooOldError(our_version, minversion, bad_versions)
if our_version in bad_versions:
raise BadCliVersionError(our_version, minversion, bad_versions)
Comment on lines -613 to -616
Copy link
Author

Choose a reason for hiding this comment

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

Similar to https://github.com/lincbrain/linc-cli/pull/2/files#r1406776675 -- versioneer needs to be refined

# if our_version < minversion:
# raise CliVersionTooOldError(our_version, minversion, bad_versions)
# if our_version in bad_versions:
# raise BadCliVersionError(our_version, minversion, bad_versions)
api_url = server_info.services.api.url
if dandi_id is None:
dandi_id = api_url.host
Expand Down
File renamed without changes.
File renamed without changes.
8 changes: 4 additions & 4 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ packages = find_namespace:
include_package_data = True

[options.packages.find]
include = dandi*
include = lincbrain*

[options.extras_require]
# I bet will come handy
Expand Down Expand Up @@ -101,7 +101,7 @@ all =

[options.entry_points]
console_scripts =
dandi=dandi.cli.command:main
lincbrain=lincbrain.cli.command:main

[flake8]
max-line-length = 100
Expand All @@ -113,8 +113,8 @@ extend-exclude =
[versioneer]
VCS = git
style = pep440
versionfile_source = dandi/_version.py
versionfile_build = dandi/_version.py
versionfile_source = lincbrain/_version.py
versionfile_build = lincbrain/_version.py
tag_prefix =
parentdir_prefix =

Expand Down
24 changes: 12 additions & 12 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,22 +25,22 @@
# therein for more information.
sys.path.insert(0, os.path.dirname(__file__))

try:
import versioneer
version_config = versioneer.get_version()
cmdclass = versioneer.get_cmdclass()
except ImportError:
print("WARNING: failed to import versioneer, falling back to no version for now")
version_config = "0.1.0" # Fallback version
cmdclass = {}
# try:
# import versioneer
# version_config = versioneer.get_version()
# cmdclass = versioneer.get_cmdclass()
# except ImportError:
# print("WARNING: failed to import versioneer, falling back to no version for now")
# version_config = "0.4.0" # Fallback version
# cmdclass = {}
Comment on lines +28 to +35
Copy link
Author

Choose a reason for hiding this comment

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

Similar to https://github.com/lincbrain/linc-cli/pull/2/files#r1406776675 -- versioneer needs to be refined


# Ensure the version is PEP 440 compliant
if '+' in version_config:
version_config = version_config.split('+')[0]
# if '+' in version_config:
# version_config = version_config.split('+')[0]

if __name__ == "__main__":
setup(
name="lincbrain",
version="0.1.0",
cmdclass=cmdclass,
version="0.9.0",
Copy link
Author

Choose a reason for hiding this comment

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

This is the value that is bumped to create a new semantic version in PyPI for now during the build and distribute phases

cmdclass={},
)
Loading