Closed doulikecookiedough closed 1 month ago
Also, review and add additional tests to ensure that the client behaves as expected when format_id
is missing, along with any other relevant test.
It appears that I can achieve a more modern convention when calling hashstore via the setuptools
module with a new setup.py
file in the src
directory:
command_line.py
"""Test command line tools"""
def main():
"""Method to run if setup is set up properly"""
print("This worked!")
if __name__ == "__main__":
main()
from setuptools import setup, find_packages
# command_line.py is a simple module to check that executing `hashstore` works as expected
# before swapping it with the `hashstoreclient`
setup(
name="hashstore",
version="1.1",
packages=find_packages(where="src"),
entry_points={
"console_scripts": [
"hashstore=hashstore.command_line:main",
],
},
)
However, I am running into a zsh: command not found: hashstore
issue, despite hashstore
already being installed:
(hstore) doumok@Dou-NCEAS-MBP14 hashstore % pip show hashstore
Name: hashstore
Version: 1.1.0
Summary: HashStore, a hash-based object store for data packages.
Home-page:
Author: Dou Mok
Author-email: douming.mok@gmail.com
License:
Location: /Users/doumok/.virtualenvs/hstore/lib/python3.9/site-packages
Requires: pathlib, pyyaml
Required-by:
(hstore) doumok@Dou-NCEAS-MBP14 hashstore % hashstore
zsh: command not found: hashstore
Next Steps:
@doulikecookiedough Rather than introduce the setup.py (which is already handled by poetry and the pyproject.toml file), you can define command line scripts directly in pyproject.toml, which get installed by poetry with poetry build/install. See documentation: https://python-poetry.org/docs/pyproject/#scripts and a reddit thread on the process.
Thank you for the direction and links @mbjones!
This issue has been resolved via Feature-92: HashStore Client Syntax.
It is now much more pleasant to use the hashstore client:
# Before
python './src/hashstore/hashstoreclient.py' /path/to/store/ -chs -dp=3 -wp=2 -ap=SHA-256 -nsp="http://www.ns.test/v1"
# After
hashstore /path/to/store/ -chs -dp=3 -wp=2 -ap=SHA-256 -nsp="http://www.ns.test/v1"
Further improvements can be made with how we handle accepting args, but I feel that this is good enough for now.
The HashStore client (command line app) doesn't follow modern conventions (ex.
git log --oneline
).Investigate how to bring it up to speed and implement changes (ex.
hashstore action [options...]
)