Skip to content

Commit

Permalink
template checkin
Browse files Browse the repository at this point in the history
  • Loading branch information
SmithSamuelM committed Oct 24, 2021
1 parent f954f80 commit f85a7cc
Show file tree
Hide file tree
Showing 11 changed files with 222 additions and 0 deletions.
10 changes: 10 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# requirements.txt
# Best practices for setup.py vs requirements.txt
# https://caremad.io/posts/2013/07/setup-vs-requirement/
# https://pip.pypa.io/en/stable/reference/pip_install/#install-index-url

# enables pip install -r requirements.txt to work with setup.py dependencies
# pull the dependencies from setup.py for keri from pip index
--index-url https://pypi.org/simple/ # pypi base pip index or local pip index

--editable . # install as editable
99 changes: 99 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
"""
$ python setup.py register sdist upload
First Time register project on pypi
https://pypi.org/manage/projects/
More secure to use twine to upload
$ pip3 install twine
$ python3 setup.py sdist
$ twine upload dist/xora-0.0.1.tar.gz
Update sphinx /docs
$ cd /docs
$ sphinx-build -b html source build/html
or
$ sphinx-apidoc -f -o source/ ../src/
$ make html
Best practices for setup.py and requirements.txt
https://caremad.io/posts/2013/07/setup-vs-requirement/
"""


from glob import glob
from os.path import basename
from os.path import splitext

from setuptools import find_packages
from setuptools import setup



setup(
name='xora',
version='0.0.1', # also change in src/xora/__init__.py
license='Apache Software License 2.0',
description='XORA: XOR Accumulator',
long_description=("XORA: XORed accumulators or blinded data digests for "
"compact and performant data registries."),
author='Samuel M. Smith',
author_email='[email protected]',
url='https://github.com/WebOfTrust/xora',
packages=find_packages('src'),
package_dir={'': 'src'},
py_modules=[splitext(basename(path))[0] for path in glob('src/*.py')],
include_package_data=True,
zip_safe=False,
classifiers=[
# complete classifier list: http://pypi.python.org/pypi?%3Aaction=list_classifiers
'Development Status :: 3 - Alpha',
'Intended Audience :: Developers',
'License :: OSI Approved :: Apache Software License',
'Operating System :: Unix',
'Operating System :: POSIX',
'Operating System :: Microsoft :: Windows',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: Implementation :: CPython',
# uncomment if you test on these interpreters:
#'Programming Language :: Python :: Implementation :: PyPy',
# 'Programming Language :: Python :: Implementation :: IronPython',
# 'Programming Language :: Python :: Implementation :: Jython',
# 'Programming Language :: Python :: Implementation :: Stackless',
'Topic :: Utilities',
],
project_urls={
'Issue Tracker': 'https://github.com/WebOfTrust/xora/issues',
},
keywords=[ "secure attribution",
"authentic data",
"discovery",
"resolver",
# eg: 'keyword1', 'keyword2', 'keyword3',
],
python_requires='>=3.9.5',
install_requires=[
'pysodium>=0.7.9',
],
extras_require={
# eg:
# 'rst': ['docutils>=0.11'],
# ':python_version=="2.6"': ['argparse'],
},
tests_require=[
'coverage>=5.5',
'pytest>=6.2.4',
],
setup_requires=[
],
entry_points={
'console_scripts': [
'xora = xora.cli:main',
'xorad = xora.daemon:main'
]
},
)
7 changes: 7 additions & 0 deletions src/xora/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# -*- encoding: utf-8 -*-
"""
main package
"""

__version__ = '0.0.1' # also change in setup.py

17 changes: 17 additions & 0 deletions src/xora/__main__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
"""
main entry package
Entrypoint module, in case you use `python -m xora`.
Why does this file exist, and why __main__? For more info, read:
- https://www.python.org/dev/peps/pep-0338/
- https://docs.python.org/3/using/cmdline.html#cmdoption-m
"""

from xora.cli import main

if __name__ == "__main__":
main()

32 changes: 32 additions & 0 deletions src/xora/cli.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

"""
command line
Module that contains the command line app.
Why does this file exist, and why not put this in __main__?
You might be tempted to import things from __main__ later, but that will cause
problems: the code will get executed twice:
- When you run `python -m keri` python will execute
``__main__.py`` as a script. That means there won't be any
``hio.__main__`` in ``sys.modules``.
- When you import __main__ it will get executed again (as a module) because
there's no ``hio.__main__`` in ``sys.modules``.
Also see (1) from http://click.pocoo.org/5/setuptools/#setuptools-integration
"""
import argparse

parser = argparse.ArgumentParser(description='Command description.')
parser.add_argument('names', metavar='NAME', nargs=argparse.ZERO_OR_MORE,
help="A name of something.")


def main(args=None):
args = parser.parse_args(args=args)
print(args.names)

23 changes: 23 additions & 0 deletions src/xora/daemon.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
"""
daemon
Background Server Daemon
"""

import argparse

parser = argparse.ArgumentParser(description='Command description.')
parser.add_argument('names', metavar='NAME', nargs=argparse.ZERO_OR_MORE,
help="A name of something.")


def main(args=None):
args = parser.parse_args(args=args)
print(args.names)


if __name__ == '__main__':
main()

4 changes: 4 additions & 0 deletions src/xora/xoraing.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# -*- encoding: utf-8 -*-
"""
generic
"""
4 changes: 4 additions & 0 deletions tests/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
"""
Root pytest module
"""

10 changes: 10 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
"""
Configure PyTest
Use this module to configure pytest
https://docs.pytest.org/en/latest/pythonpath.html
"""
import os
import pytest

4 changes: 4 additions & 0 deletions tests/core/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
"""
pytest module
"""

12 changes: 12 additions & 0 deletions tests/test_main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# -*- encoding: utf-8 -*-
"""
tests.test_main module
"""

from xora.cli import main


def test_main():
main([])

0 comments on commit f85a7cc

Please sign in to comment.