Closed ghost closed 7 years ago
Instead of a "src" directory, use the python package name -- I guess "multihash" for your case -- as the directory containing code. That way, from the top level directory, you can type import multihash
into python and 'multihash/init.py' will be executed. You don't need an ops directory at all, just move that ops/ops.py
to multihash/ops.py
, that way it's accessible via from multihash.ops import Options
; same for the constants.py
file.
Regarding constants.py, I think you should look at enums as a way to store them, instead of multiple dictionaries. It's standard in modern python versions and can be installed as dependency for older pythons.
good luck
Actually, looks like multihash is taken as a package name on pypi (github repo).
If your project is different, name it something else. If it's the same, ask yourself if it's worth your time to duplicate.
They have a single file package instead of a directory - if you want to learn about structuring projects, learn from this repo.
Thank you @akubera I don't want to dedicate time to a library that has got several implementations hence I'll delete that repository. I see no existing implementations for multicodec multicodec-packed and multistream. pypi search hasn't brought required resources.
Hence, I'll shift my attention towards these starting from multicodec.
I thought of getting multihash module ready as a part of building supporting modules and have been basing it on JS implementation. I have been coming across several doubts regarding my implementation.
Can someone check if this is going correctly or can it be written better?
Address: multihash