Initial skel

This commit is contained in:
2021-10-08 16:42:25 +02:00
commit 7047b753aa
32 changed files with 813 additions and 0 deletions

16
.bumpversion.cfg Normal file
View File

@@ -0,0 +1,16 @@
[bumpversion]
current_version = 0.0.0
commit = True
tag = True
[bumpversion:file:setup.py]
search = version='{current_version}'
replace = version='{new_version}'
[bumpversion:file:docs/conf.py]
search = version = release = '{current_version}'
replace = version = release = '{new_version}'
[bumpversion:file:src/cryptbase/__init__.py]
search = __version__ = '{current_version}'
replace = __version__ = '{new_version}'

71
.cookiecutterrc Normal file
View File

@@ -0,0 +1,71 @@
# This file exists so you can easily regenerate your project.
#
# `cookiepatcher` is a convenient shim around `cookiecutter`
# for regenerating projects (it will generate a .cookiecutterrc
# automatically for any template). To use it:
#
# pip install cookiepatcher
# cookiepatcher gh:ionelmc/cookiecutter-pylibrary python-cryptbase
#
# See:
# https://pypi.org/project/cookiepatcher
#
# Alternatively, you can run:
#
# cookiecutter --overwrite-if-exists --config-file=python-cryptbase/.cookiecutterrc gh:ionelmc/cookiecutter-pylibrary
default_context:
_extensions: ['jinja2_time.TimeExtension']
_template: 'gh:ionelmc/cookiecutter-pylibrary'
allow_tests_inside_package: 'no'
appveyor: 'no'
c_extension_function: 'longest'
c_extension_module: '_cryptbase'
c_extension_optional: 'no'
c_extension_support: 'no'
c_extension_test_pypi: 'no'
c_extension_test_pypi_username: 'eghuro'
codacy: 'no'
codacy_projectid: '[Get ID from https://app.codacy.com/gh/cryptbase/python-cryptbase/settings]'
codeclimate: 'no'
codecov: 'no'
command_line_interface: 'no'
command_line_interface_bin_name: 'cryptbase'
coveralls: 'no'
coveralls_token: '[Required for Appveyor, take it from https://coveralls.io/github/cryptbase/python-cryptbase]'
distribution_name: 'cryptbase'
email: 'alex@eghuro.cz'
full_name: 'Alexandr Mansurov'
legacy_python: 'no'
license: 'MIT license'
linter: 'flake8'
package_name: 'cryptbase'
pre_commit: 'yes'
project_name: 'cryptbase'
project_short_description: 'Protect yourself and your customers with database encryption.'
pypi_badge: 'yes'
pypi_disable_upload: 'no'
release_date: 'today'
repo_hosting: 'other domain not listed'
repo_hosting_domain: 'https://code.eghuro.com'
repo_name: 'python-cryptbase'
repo_username: 'cryptbase'
requiresio: 'no'
scrutinizer: 'no'
setup_py_uses_setuptools_scm: 'no'
setup_py_uses_test_runner: 'no'
sphinx_docs: 'yes'
sphinx_docs_hosting: 'https://python-cryptbase.readthedocs.io/'
sphinx_doctest: 'no'
sphinx_theme: 'sphinx-rtd-theme'
test_matrix_configurator: 'no'
test_matrix_separate_coverage: 'no'
test_runner: 'pytest'
travis: 'no'
travis_osx: 'no'
version: '0.0.0'
version_manager: 'bump2version'
website: 'https://eghuro.cz'
year_from: '2021'
year_to: '2021'

16
.coveragerc Normal file
View File

@@ -0,0 +1,16 @@
[paths]
source =
src
*/site-packages
[run]
branch = true
source =
cryptbase
tests
parallel = true
[report]
show_missing = true
precision = 2
omit = *migrations*

20
.editorconfig Normal file
View File

@@ -0,0 +1,20 @@
# see https://editorconfig.org/
root = true
[*]
# Use Unix-style newlines for most files (except Windows files, see below).
end_of_line = lf
trim_trailing_whitespace = true
indent_style = space
insert_final_newline = true
indent_size = 4
charset = utf-8
[*.{bat,cmd,ps1}]
end_of_line = crlf
[*.{yml,yaml}]
indent_size = 2
[*.tsv]
indent_style = tab

74
.gitignore vendored Normal file
View File

@@ -0,0 +1,74 @@
*.py[cod]
__pycache__
# C extensions
*.so
# Packages
*.egg
*.egg-info
dist
build
eggs
.eggs
parts
bin
var
sdist
wheelhouse
develop-eggs
.installed.cfg
lib
lib64
venv*/
pyvenv*/
pip-wheel-metadata/
# Installer logs
pip-log.txt
# Unit test / coverage reports
.coverage
.tox
.coverage.*
.pytest_cache/
nosetests.xml
coverage.xml
htmlcov
# Translations
*.mo
# Buildout
.mr.developer.cfg
# IDE project files
.project
.pydevproject
.idea
.vscode
*.iml
*.komodoproject
# Complexity
output/*.html
output/*/index.html
# Sphinx
docs/_build
.DS_Store
*~
.*.sw[po]
.build
.ve
.env
.cache
.pytest
.benchmarks
.bootstrap
.appveyor.token
*.bak
# Mypy Cache
.mypy_cache/

20
.pre-commit-config.yaml Normal file
View File

@@ -0,0 +1,20 @@
# To install the git pre-commit hook run:
# pre-commit install
# To update the pre-commit hooks run:
# pre-commit install-hooks
exclude: '^(\.tox|ci/templates|\.bumpversion\.cfg)(/|$)'
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: master
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: debug-statements
- repo: https://github.com/timothycrosley/isort
rev: master
hooks:
- id: isort
- repo: https://gitlab.com/pycqa/flake8
rev: master
hooks:
- id: flake8

10
.readthedocs.yml Normal file
View File

@@ -0,0 +1,10 @@
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
version: 2
sphinx:
configuration: docs/conf.py
formats: all
python:
install:
- requirements: docs/requirements.txt
- method: pip
path: .

5
AUTHORS.rst Normal file
View File

@@ -0,0 +1,5 @@
Authors
=======
* Alexandr Mansurov - https://eghuro.cz

8
CHANGELOG.rst Normal file
View File

@@ -0,0 +1,8 @@
Changelog
=========
0.0.0 (2021-10-08)
------------------
* First release on PyPI.

87
CONTRIBUTING.rst Normal file
View File

@@ -0,0 +1,87 @@
============
Contributing
============
Contributions are welcome, and they are greatly appreciated! Every
little bit helps, and credit will always be given.
Bug reports
===========
When `reporting a bug <https://code.eghuro.com/cryptbase/python-cryptbase/issues>`_ please include:
* Your operating system name and version.
* Any details about your local setup that might be helpful in troubleshooting.
* Detailed steps to reproduce the bug.
Documentation improvements
==========================
cryptbase could always use more documentation, whether as part of the
official cryptbase docs, in docstrings, or even on the web in blog posts,
articles, and such.
Feature requests and feedback
=============================
The best way to send feedback is to file an issue at https://code.eghuro.com/cryptbase/python-cryptbase/issues.
If you are proposing a feature:
* Explain in detail how it would work.
* Keep the scope as narrow as possible, to make it easier to implement.
* Remember that this is a volunteer-driven project, and that code contributions are welcome :)
Development
===========
To set up `python-cryptbase` for local development:
1. Fork `python-cryptbase <https://code.eghuro.com/cryptbase/python-cryptbase>`_
(look for the "Fork" button).
2. Clone your fork locally::
git clone git@code.eghuro.com:YOURGITHUBNAME/python-cryptbase.git
3. Create a branch for local development::
git checkout -b name-of-your-bugfix-or-feature
Now you can make your changes locally.
4. When you're done making changes run all the checks and docs builder with `tox <https://tox.readthedocs.io/en/latest/install.html>`_ one command::
tox
5. Commit your changes and push your branch to GitHub::
git add .
git commit -m "Your detailed description of your changes."
git push origin name-of-your-bugfix-or-feature
6. Submit a pull request through the GitHub website.
Pull Request Guidelines
-----------------------
If you need some code review or feedback while you're developing the code just make the pull request.
For merging, you should:
1. Include passing tests (run ``tox``).
2. Update documentation when there's new API, functionality etc.
3. Add a note to ``CHANGELOG.rst`` about the changes.
4. Add yourself to ``AUTHORS.rst``.
Tips
----
To run a subset of tests::
tox -e envname -- pytest -k test_myfeature
To run all the test environments in *parallel*::
tox -p auto

9
LICENSE Normal file
View File

@@ -0,0 +1,9 @@
MIT License
Copyright (c) 2021, Alexandr Mansurov
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice (including the next paragraph) shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

21
MANIFEST.in Normal file
View File

@@ -0,0 +1,21 @@
graft docs
graft src
graft ci
graft tests
include .bumpversion.cfg
include .cookiecutterrc
include .coveragerc
include .editorconfig
include tox.ini
include .appveyor.yml
include .readthedocs.yml
include .pre-commit-config.yaml
include AUTHORS.rst
include CHANGELOG.rst
include CONTRIBUTING.rst
include LICENSE
include README.rst
global-exclude *.py[cod] __pycache__/* *.so *.dylib

49
README.rst Normal file
View File

@@ -0,0 +1,49 @@
========
Overview
========
Protect yourself and your customers with database encryption.
* Free software: MIT license
Installation
============
::
pip install cryptbase
You can also install the in-development version with::
pip install git+ssh://git@https://code.eghuro.com/cryptbase/python-cryptbase.git@master
Documentation
=============
https://python-cryptbase.readthedocs.io/
Development
===========
To run all the tests run::
tox
Note, to combine the coverage data from all the tox environments run:
.. list-table::
:widths: 10 90
:stub-columns: 1
- - Windows
- ::
set PYTEST_ADDOPTS=--cov-append
tox
- - Other
- ::
PYTEST_ADDOPTS=--cov-append tox

89
ci/bootstrap.py Executable file
View File

@@ -0,0 +1,89 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals
import os
import subprocess
import sys
from os.path import abspath
from os.path import dirname
from os.path import exists
from os.path import join
base_path = dirname(dirname(abspath(__file__)))
def check_call(args):
print("+", *args)
subprocess.check_call(args)
def exec_in_env():
env_path = join(base_path, ".tox", "bootstrap")
if sys.platform == "win32":
bin_path = join(env_path, "Scripts")
else:
bin_path = join(env_path, "bin")
if not exists(env_path):
import subprocess
print("Making bootstrap env in: {0} ...".format(env_path))
try:
check_call([sys.executable, "-m", "venv", env_path])
except subprocess.CalledProcessError:
try:
check_call([sys.executable, "-m", "virtualenv", env_path])
except subprocess.CalledProcessError:
check_call(["virtualenv", env_path])
print("Installing `jinja2` into bootstrap environment...")
check_call([join(bin_path, "pip"), "install", "jinja2", "tox"])
python_executable = join(bin_path, "python")
if not os.path.exists(python_executable):
python_executable += '.exe'
print("Re-executing with: {0}".format(python_executable))
print("+ exec", python_executable, __file__, "--no-env")
os.execv(python_executable, [python_executable, __file__, "--no-env"])
def main():
import jinja2
print("Project path: {0}".format(base_path))
jinja = jinja2.Environment(
loader=jinja2.FileSystemLoader(join(base_path, "ci", "templates")),
trim_blocks=True,
lstrip_blocks=True,
keep_trailing_newline=True
)
tox_environments = [
line.strip()
# 'tox' need not be installed globally, but must be importable
# by the Python that is running this script.
# This uses sys.executable the same way that the call in
# cookiecutter-pylibrary/hooks/post_gen_project.py
# invokes this bootstrap.py itself.
for line in subprocess.check_output([sys.executable, '-m', 'tox', '--listenvs'], universal_newlines=True).splitlines()
]
tox_environments = [line for line in tox_environments if line.startswith('py')]
for name in os.listdir(join("ci", "templates")):
with open(join(base_path, name), "w") as fh:
fh.write(jinja.get_template(name).render(tox_environments=tox_environments))
print("Wrote {}".format(name))
print("DONE.")
if __name__ == "__main__":
args = sys.argv[1:]
if args == ["--no-env"]:
main()
elif not args:
exec_in_env()
else:
print("Unexpected arguments {0}".format(args), file=sys.stderr)
sys.exit(1)

4
ci/requirements.txt Normal file
View File

@@ -0,0 +1,4 @@
virtualenv>=16.6.0
pip>=19.1.1
setuptools>=18.0.1
six>=1.14.0

1
docs/authors.rst Normal file
View File

@@ -0,0 +1 @@
.. include:: ../AUTHORS.rst

1
docs/changelog.rst Normal file
View File

@@ -0,0 +1 @@
.. include:: ../CHANGELOG.rst

47
docs/conf.py Normal file
View File

@@ -0,0 +1,47 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import os
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.autosummary',
'sphinx.ext.coverage',
'sphinx.ext.doctest',
'sphinx.ext.extlinks',
'sphinx.ext.ifconfig',
'sphinx.ext.napoleon',
'sphinx.ext.todo',
'sphinx.ext.viewcode',
]
source_suffix = '.rst'
master_doc = 'index'
project = 'cryptbase'
year = '2021'
author = 'Alexandr Mansurov'
copyright = '{0}, {1}'.format(year, author)
version = release = '0.0.0'
pygments_style = 'trac'
templates_path = ['.']
extlinks = {
'issue': ('https://https://code.eghuro.com/cryptbase/python-cryptbase/issues/%s', '#'),
'pr': ('https://https://code.eghuro.com/cryptbase/python-cryptbase/pull/%s', 'PR #'),
}
# on_rtd is whether we are on readthedocs.org
on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
if not on_rtd: # only set the theme if we're building docs locally
html_theme = 'sphinx_rtd_theme'
html_use_smartypants = True
html_last_updated_fmt = '%b %d, %Y'
html_split_index = False
html_sidebars = {
'**': ['searchbox.html', 'globaltoc.html', 'sourcelink.html'],
}
html_short_title = '%s-%s' % (project, version)
napoleon_use_ivar = True
napoleon_use_rtype = False
napoleon_use_param = False

1
docs/contributing.rst Normal file
View File

@@ -0,0 +1 @@
.. include:: ../CONTRIBUTING.rst

21
docs/index.rst Normal file
View File

@@ -0,0 +1,21 @@
========
Contents
========
.. toctree::
:maxdepth: 2
readme
installation
usage
reference/index
contributing
authors
changelog
Indices and tables
==================
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`

7
docs/installation.rst Normal file
View File

@@ -0,0 +1,7 @@
============
Installation
============
At the command line::
pip install cryptbase

1
docs/readme.rst Normal file
View File

@@ -0,0 +1 @@
.. include:: ../README.rst

View File

@@ -0,0 +1,9 @@
cryptbase
=========
.. testsetup::
from cryptbase import *
.. automodule:: cryptbase
:members:

7
docs/reference/index.rst Normal file
View File

@@ -0,0 +1,7 @@
Reference
=========
.. toctree::
:glob:
cryptbase*

2
docs/requirements.txt Normal file
View File

@@ -0,0 +1,2 @@
sphinx>=1.3
sphinx-rtd-theme

View File

@@ -0,0 +1,11 @@
builtin
builtins
classmethod
staticmethod
classmethods
staticmethods
args
kwargs
callstack
Changelog
Indices

7
docs/usage.rst Normal file
View File

@@ -0,0 +1,7 @@
=====
Usage
=====
To use cryptbase in a project::
import cryptbase

35
setup.cfg Normal file
View File

@@ -0,0 +1,35 @@
[bdist_wheel]
universal = 1
[flake8]
max-line-length = 140
exclude = .tox,.eggs,ci/templates,build,dist
[tool:pytest]
# If a pytest section is found in one of the possible config files
# (pytest.ini, tox.ini or setup.cfg), then pytest will not look for any others,
# so if you add a pytest config section elsewhere,
# you will need to delete this section from setup.cfg.
norecursedirs =
migrations
python_files =
test_*.py
*_test.py
tests.py
addopts =
-ra
--strict-markers
--doctest-modules
--doctest-glob=\*.rst
--tb=short
testpaths =
tests
[tool:isort]
force_single_line = True
line_length = 120
known_first_party = cryptbase
default_section = THIRDPARTY
forced_separate = test_cryptbase
skip = .tox,.eggs,ci/templates,build,dist

81
setup.py Executable file
View File

@@ -0,0 +1,81 @@
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
import io
import re
from glob import glob
from os.path import basename
from os.path import dirname
from os.path import join
from os.path import splitext
from setuptools import find_packages
from setuptools import setup
def read(*names, **kwargs):
with io.open(
join(dirname(__file__), *names),
encoding=kwargs.get('encoding', 'utf8')
) as fh:
return fh.read()
setup(
name='cryptbase',
version='0.0.0',
license='MIT',
description='Protect yourself and your customers with database encryption.',
long_description='%s\n%s' % (
re.compile('^.. start-badges.*^.. end-badges', re.M | re.S).sub('', read('README.rst')),
re.sub(':[a-z]+:`~?(.*?)`', r'``\1``', read('CHANGELOG.rst'))
),
author='Alexandr Mansurov',
author_email='alex@eghuro.cz',
url='https://code.eghuro.com/cryptbase/python-cryptbase',
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 :: 5 - Production/Stable',
'Intended Audience :: Developers',
'License :: OSI Approved :: MIT License',
'Operating System :: Unix',
'Operating System :: POSIX',
'Operating System :: Microsoft :: Windows',
'Programming Language :: Python',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3 :: Only',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: Implementation :: CPython',
'Programming Language :: Python :: Implementation :: PyPy',
# uncomment if you test on these interpreters:
# 'Programming Language :: Python :: Implementation :: IronPython',
# 'Programming Language :: Python :: Implementation :: Jython',
# 'Programming Language :: Python :: Implementation :: Stackless',
'Topic :: Utilities',
],
project_urls={
'Documentation': 'https://python-cryptbase.readthedocs.io/',
'Changelog': 'https://python-cryptbase.readthedocs.io/en/latest/changelog.html',
'Issue Tracker': 'https://code.eghuro.com/cryptbase/python-cryptbase/issues',
},
keywords=[
# eg: 'keyword1', 'keyword2', 'keyword3',
],
python_requires='>=3.6',
install_requires=[
# eg: 'aspectlib==1.1.1', 'six>=1.7',
],
extras_require={
# eg:
# 'rst': ['docutils>=0.11'],
# ':python_version=="2.6"': ['argparse'],
},
)

View File

@@ -0,0 +1 @@
__version__ = '0.0.0'

6
tests/test_cryptbase.py Normal file
View File

@@ -0,0 +1,6 @@
from cryptbase import main
def test_main():
pass

76
tox.ini Normal file
View File

@@ -0,0 +1,76 @@
[testenv:bootstrap]
deps =
jinja2
tox
skip_install = true
commands =
python ci/bootstrap.py --no-env
passenv =
*
; a generative tox configuration, see: https://tox.readthedocs.io/en/latest/config.html#generative-envlist
[tox]
envlist =
clean,
check,
docs,
{py36,py37,py38,py39,pypy3},
report
ignore_basepython_conflict = true
[testenv]
basepython =
pypy3: {env:TOXPYTHON:pypy3}
py36: {env:TOXPYTHON:python3.6}
py37: {env:TOXPYTHON:python3.7}
py38: {env:TOXPYTHON:python3.8}
py39: {env:TOXPYTHON:python3.9}
{bootstrap,clean,check,report,docs}: {env:TOXPYTHON:python3}
setenv =
PYTHONPATH={toxinidir}/tests
PYTHONUNBUFFERED=yes
passenv =
*
usedevelop = false
deps =
pytest
pytest-cov
commands =
{posargs:pytest --cov --cov-report=term-missing -vv tests}
[testenv:check]
deps =
docutils
check-manifest
flake8
readme-renderer
pygments
isort
skip_install = true
commands =
python setup.py check --strict --metadata --restructuredtext
check-manifest {toxinidir}
flake8
isort --verbose --check-only --diff --filter-files .
[testenv:docs]
usedevelop = true
deps =
-r{toxinidir}/docs/requirements.txt
commands =
sphinx-build {posargs:-E} -b html docs dist/docs
sphinx-build -b linkcheck docs dist/docs
[testenv:report]
deps =
coverage
skip_install = true
commands =
coverage report
coverage html
[testenv:clean]
commands = coverage erase
skip_install = true
deps =
coverage