This repository has been archived by the owner on Sep 9, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 95dc9ac
Showing
16 changed files
with
1,015 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
[report] | ||
# Regexes for lines to exclude from consideration | ||
exclude_lines = | ||
# Have to re-enable the standard pragma | ||
pragma: no cover | ||
|
||
# Don't complain about missing debug-only code: | ||
def __repr__ | ||
if self\.debug | ||
|
||
# Don't complain if tests don't hit defensive assertion code: | ||
raise NotImplementedError | ||
|
||
# Don't complain if non-runnable code isn't run: | ||
if 0: | ||
if __name__ == .__main__.: | ||
omit = | ||
setup.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
# Created by .ignore support plugin (hsz.mobi) | ||
### Python template | ||
# Byte-compiled / optimized / DLL files | ||
__pycache__/ | ||
*.py[cod] | ||
*$py.class | ||
|
||
# C extensions | ||
*.so | ||
|
||
# Distribution / packaging | ||
.Python | ||
build/ | ||
develop-eggs/ | ||
dist/ | ||
downloads/ | ||
eggs/ | ||
.eggs/ | ||
lib/ | ||
lib64/ | ||
parts/ | ||
sdist/ | ||
var/ | ||
wheels/ | ||
*.egg-info/ | ||
.installed.cfg | ||
*.egg | ||
MANIFEST | ||
|
||
# PyInstaller | ||
# Usually these files are written by a python script from a template | ||
# before PyInstaller builds the exe, so as to inject date/other infos into it. | ||
*.manifest | ||
*.spec | ||
|
||
# Installer logs | ||
pip-log.txt | ||
pip-delete-this-directory.txt | ||
|
||
# Unit test / coverage reports | ||
htmlcov/ | ||
.tox/ | ||
.coverage | ||
.coverage.* | ||
.cache | ||
nosetests.xml | ||
coverage.xml | ||
*.cover | ||
.hypothesis/ | ||
.pytest_cache/ | ||
|
||
# Translations | ||
*.mo | ||
*.pot | ||
|
||
# Django stuff: | ||
*.log | ||
local_settings.py | ||
db.sqlite3 | ||
|
||
# Flask stuff: | ||
instance/ | ||
.webassets-cache | ||
|
||
# Scrapy stuff: | ||
.scrapy | ||
|
||
# Sphinx documentation | ||
docs/_build/ | ||
|
||
# PyBuilder | ||
target/ | ||
|
||
# Jupyter Notebook | ||
.ipynb_checkpoints | ||
|
||
# pyenv | ||
.python-version | ||
|
||
# celery beat schedule file | ||
celerybeat-schedule | ||
|
||
# SageMath parsed files | ||
*.sage.py | ||
|
||
# Environments | ||
.env | ||
.venv | ||
env/ | ||
venv/ | ||
ENV/ | ||
env.bak/ | ||
venv.bak/ | ||
|
||
# Spyder project settings | ||
.spyderproject | ||
.spyproject | ||
|
||
# Rope project settings | ||
.ropeproject | ||
|
||
# mkdocs documentation | ||
/site | ||
|
||
# mypy | ||
.mypy_cache/ | ||
|
||
# pycharm | ||
.idea/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
dist: xenial | ||
language: python | ||
python: | ||
- "3.7-dev" | ||
- "3.8-dev" | ||
- "3.7" | ||
- "nightly" | ||
|
||
# Disable sudo to speed up the build | ||
sudo: false | ||
# command to install dependencies | ||
install: | ||
- pip install pytest codecov pytest-cov | ||
# command to run tests | ||
script: | ||
- py.test --cov-config=.coveragerc --cov=./ --cov-report xml tests/ | ||
# report coverage | ||
after_success: | ||
- codecov |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
Copyright 2018 Sean Stewart | ||
|
||
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 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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
include README.md LICENSE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Coming Soon.... | ||
|
||
:snake: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
python-dateutil==2.8.0 | ||
six==1.12.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
[bdist_wheel] | ||
universal = 1 | ||
|
||
[metadata] | ||
license_file = LICENSE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
#!/usr/bin/env python | ||
# -*- coding: UTF-8 -*- | ||
import dataclasses | ||
import inspect | ||
import os | ||
import pathlib | ||
import sys | ||
import typing | ||
from shutil import rmtree | ||
|
||
from setuptools import setup, Command | ||
|
||
|
||
@dataclasses.dataclass | ||
class About: | ||
title: str = None | ||
description: str = None | ||
url: str = None | ||
version: str = None | ||
author: str = None | ||
author_email: str = None | ||
license: str = None | ||
copyright: str = None | ||
|
||
@classmethod | ||
def from_dict(cls, dikt: typing.Mapping) -> 'About': | ||
dikt = dict(zip((x.strip('__') for x in dikt.keys()), dikt.values())) | ||
sig = inspect.signature(cls) | ||
return cls(**sig.bind(**{x: y for x, y in dikt.items() if x in sig.parameters}).arguments) | ||
|
||
@classmethod | ||
def from_path(cls, path: pathlib.Path) -> 'About': | ||
about = {} | ||
exec(path.resolve().read_text(), about) | ||
return cls.from_dict(about) | ||
|
||
|
||
HOME = pathlib.Path(__file__).resolve().parent | ||
LIB = HOME / 'typic' | ||
ABOUT = About.from_path(LIB / '__about__.py') | ||
README = (HOME / 'README.md').read_text() | ||
INSTALL_REQUIRES = ('python-dateutil',) | ||
TESTS_REQUIRE = ('pytest',) | ||
|
||
|
||
class UploadCommand(Command): | ||
"""Support setup.py upload. | ||
Adapted from https://github.com/kennethreitz/setup.py/blob/master/setup.py | ||
""" | ||
|
||
description = 'Build and publish the package.' | ||
user_options = [] | ||
|
||
@staticmethod | ||
def status(s): | ||
"""Prints things in bold.""" | ||
print('\033[1m{0}\033[0m'.format(s)) | ||
|
||
def initialize_options(self): | ||
pass | ||
|
||
def finalize_options(self): | ||
pass | ||
|
||
def run(self): | ||
try: | ||
self.status('Removing previous builds…') | ||
rmtree(os.path.join(HOME, 'dist')) | ||
except OSError: | ||
pass | ||
|
||
self.status('Building Source and Wheel (universal) distribution…') | ||
os.system(f'{sys.executable} setup.py sdist bdist_wheel --universal') | ||
|
||
self.status('Uploading the package to PyPI via Twine…') | ||
os.system('twine upload dist/*') | ||
|
||
self.status('Pushing git tags…') | ||
os.system(f'git tag v{ABOUT.version}') | ||
os.system('git push --tags') | ||
|
||
sys.exit() | ||
|
||
|
||
setup( | ||
name=ABOUT.title, | ||
version=ABOUT.version, | ||
packages=[ABOUT.title], | ||
url=ABOUT.url, | ||
license=ABOUT.license, | ||
author=ABOUT.author, | ||
author_email=ABOUT.author_email, | ||
description=ABOUT.description, | ||
long_description=README, | ||
long_description_content_type='text/markdown', | ||
classifiers=[ | ||
'Development Status :: 4 - Beta', | ||
'Intended Audience :: Developers', | ||
'Natural Language :: English', | ||
'License :: OSI Approved :: Apache Software License', | ||
'Operating System :: OS Independent', | ||
'Programming Language :: Python', | ||
'Programming Language :: Python :: 3.7', | ||
'Programming Language :: Python :: 3 :: Only', | ||
'Programming Language :: Python :: Implementation :: CPython', | ||
'Topic :: Utilities', | ||
'Topic :: Typing' | ||
], | ||
python_requires='>=3.7', | ||
cmdclass={ | ||
'upload': UploadCommand, | ||
}, | ||
install_requires=INSTALL_REQUIRES, | ||
tests_require=TESTS_REQUIRE | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#!/usr/bin/env python | ||
# -*- coding: UTF-8 -*- |
Oops, something went wrong.