-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add poetry support for dependency management
black, isort, flake8, mypy and bandit are added as dev dependencies.
- Loading branch information
1 parent
b4b718c
commit a0663dd
Showing
15 changed files
with
515 additions
and
307 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,11 @@ | ||
[flake8] | ||
count = True | ||
show-source = True | ||
statistics = True | ||
extend-exclude=.venv, .github | ||
select=E9,F63,F7,F82 | ||
max-line-length = 100 | ||
max-complexity = 10 | ||
|
||
#see https://flake8.pycqa.org/en/latest/user/options.html | ||
~ |
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,43 @@ | ||
name: build | ||
|
||
on: | ||
push: | ||
branches-ignore: | ||
- "dependabot/**" | ||
pull_request: | ||
release: | ||
types: [created] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out repository | ||
uses: actions/checkout@v2 | ||
- name: Set up Python 3.9 | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.9 | ||
- name: Install poetry | ||
uses: snok/[email protected] | ||
with: | ||
virtualenvs-create: true | ||
virtualenvs-in-project: true | ||
- name: Setup | ||
run: bash setup.sh | ||
- name: Check format with black | ||
run: poetry run invoke check-format-with-black | ||
- name: Check sorted import module | ||
run: poetry run invoke sort-imports-with-isort | ||
- name: Lint with pylint | ||
run: poetry run invoke lint-with-pylint | ||
- name: Lint with flake8 | ||
run: poetry run invoke lint-with-flake8 | ||
- name: Type checking with mypy | ||
run: poetry run invoke lint-with-mypy | ||
- name: Build | ||
run: poetry build | ||
- name: Publish Dry Run | ||
if: github.event_name == 'push' | ||
run: poetry publish --username="${{ secrets.PYPI_USERNAME }}" --password="${{ secrets.PYPI_PASSWORD }}" --dry-run | ||
|
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -10,27 +10,23 @@ jobs: | |
name: Build and publish Python 🐍 distributions 📦 to PyPI and TestPyPI | ||
runs-on: ubuntu-18.04 | ||
steps: | ||
- uses: actions/checkout@master | ||
- name: Set up Python 3.7 | ||
uses: actions/[email protected] | ||
- name: Check out repository | ||
uses: actions/checkout@v2 | ||
- name: Set up Python 3.9 | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.7 | ||
- name: Install pypa/build | ||
run: >- | ||
python -m | ||
pip install | ||
build | ||
--user | ||
- name: Build a binary wheel and a source tarball | ||
run: >- | ||
python -m | ||
build | ||
--sdist | ||
--wheel | ||
--outdir dist/ | ||
. | ||
python-version: 3.9 | ||
- name: Install poetry | ||
uses: snok/[email protected] | ||
with: | ||
virtualenvs-create: true | ||
virtualenvs-in-project: true | ||
- name: Setup | ||
run: bash setup.sh | ||
- name: Build | ||
run: poetry build | ||
- name: Publish distribution 📦 to PyPI | ||
if: startsWith(github.ref, 'refs/tags') | ||
uses: pypa/gh-action-pypi-publish@master | ||
run: poetry publish | ||
with: | ||
password: ${{ secrets.PYPI_API_TOKEN }} |
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 |
---|---|---|
|
@@ -140,4 +140,4 @@ cython_debug/ | |
db/ | ||
.idea/ | ||
*.csv | ||
|
||
.invoke-completion.sh |
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
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 |
---|---|---|
@@ -1,6 +1,63 @@ | ||
[tool.poetry] | ||
name = "opensignals" | ||
version = "0.0.2" | ||
description = "" | ||
authors = ["Jordi Villar <[email protected]>"] | ||
|
||
[tool.poetry.urls] | ||
Issues = "https://github.com/councilofelders/opensignals/issues" | ||
|
||
[tool.poetry.dependencies] | ||
python = ">=3.8,<3.11" | ||
docopt = "^0.6.2" | ||
pandas = "^1.3.4" | ||
numpy = "^1.21.3" | ||
pyarrow = "^6.0.0" | ||
requests = "^2.26.0" | ||
tqdm = "^4.62.3" | ||
|
||
[tool.poetry.dev-dependencies] | ||
pylint = "^2.11.1" | ||
black = "^21.10b0" | ||
isort = "^5.10.0" | ||
invoke = "^1.6.0" | ||
bandit = "^1.7.0" | ||
flake8 = "^4.0.1" | ||
mypy = "^0.910" | ||
types-python-dateutil = "^2.8.2" | ||
|
||
[build-system] | ||
requires = [ | ||
'setuptools>=42', | ||
'wheel' | ||
requires = ["poetry-core>=1.0.0"] | ||
build-backend = "poetry.core.masonry.api" | ||
|
||
[tool.black] | ||
line-length = 100 | ||
|
||
[tool.isort] | ||
profile = "black" | ||
|
||
[tool.mypy] | ||
files = "src/**/*.py" | ||
exclude = ".venv/" | ||
allow_untyped_decorators = false | ||
warn_unused_configs = true | ||
allow_subclassing_any = false | ||
#allow_untyped_calls = false | ||
#allow_untyped_defs = false | ||
allow_incomplete_defs = false | ||
check_untyped_defs = true | ||
no_implicit_optional = true | ||
warn_redundant_casts = true | ||
warn_unused_ignores = true | ||
warn_return_any = true | ||
ignore_missing_imports = false | ||
pretty = true | ||
|
||
[[tool.mypy.overrides]] | ||
module = [ | ||
"pandas", | ||
"requests", | ||
"tqdm", | ||
"docopt" | ||
] | ||
build-backend = 'setuptools.build_meta' | ||
ignore_missing_imports = true |
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 |
---|---|---|
@@ -1,65 +1,66 @@ | ||
from pathlib import Path | ||
from setuptools import setup, find_packages | ||
|
||
metadata_path = Path(__file__).parent / 'src' / 'opensignals' / '__about__.py' | ||
from setuptools import find_packages, setup | ||
|
||
metadata_path = Path(__file__).parent / "src" / "opensignals" / "__about__.py" | ||
metadata = {} | ||
with metadata_path.open() as file: | ||
raw_code = file.read() | ||
exec(raw_code, metadata) | ||
metadata = {key.strip('_'): value for key, value in metadata.items()} | ||
metadata['name'] = metadata.pop('package_name') | ||
metadata = {key.strip("_"): value for key, value in metadata.items()} | ||
metadata["name"] = metadata.pop("package_name") | ||
|
||
setup( | ||
long_description=open('README.md').read(), | ||
long_description_content_type='text/markdown', | ||
url='https://github.com/councilofelders/opensignals', | ||
long_description=open("README.md").read(), | ||
long_description_content_type="text/markdown", | ||
url="https://github.com/councilofelders/opensignals", | ||
project_urls={ | ||
'Bug Tracker': 'https://github.com/councilofelders/opensignals/issues', | ||
"Bug Tracker": "https://github.com/councilofelders/opensignals/issues", | ||
}, | ||
packages=find_packages('src'), | ||
package_dir={'': 'src'}, | ||
py_modules=[path.stem for path in Path('src').glob('*.py')], | ||
python_requires='>=3.7', | ||
packages=find_packages("src"), | ||
package_dir={"": "src"}, | ||
py_modules=[path.stem for path in Path("src").glob("*.py")], | ||
python_requires=">=3.7", | ||
zip_safe=True, | ||
include_package_data=True, | ||
install_requires=[ | ||
'docopt>=0.6.2', | ||
'pandas>=1.2.2', | ||
'numpy>=1.20.1', | ||
'pyarrow>=3.0.0', | ||
'requests', | ||
'tqdm', | ||
"docopt>=0.6.2", | ||
"pandas>=1.2.2", | ||
"numpy>=1.20.1", | ||
"pyarrow>=3.0.0", | ||
"requests", | ||
"tqdm", | ||
], | ||
extras_require=dict( | ||
test=[ | ||
'pytest==5.1.2', | ||
'pytest-cov==2.7.1', | ||
'pytest-flake8==1.0.6', | ||
'pytest-mypy==0.4.0', | ||
'pydocstyle==4.0.1', | ||
'pep8-naming==0.8.1', | ||
'pytest-docstyle==2.0.0', | ||
'flake8 == 3.8.1', | ||
"pytest==5.1.2", | ||
"pytest-cov==2.7.1", | ||
"pytest-flake8==1.0.6", | ||
"pytest-mypy==0.4.0", | ||
"pydocstyle==4.0.1", | ||
"pep8-naming==0.8.1", | ||
"pytest-docstyle==2.0.0", | ||
"flake8 == 3.8.1", | ||
], | ||
), | ||
entry_points={ | ||
'console_scripts': [ | ||
'opensignals = opensignals.__main__:main', | ||
"console_scripts": [ | ||
"opensignals = opensignals.__main__:main", | ||
] | ||
}, | ||
**metadata, | ||
classifiers=[ | ||
'License :: OSI Approved :: Apache Software License', | ||
'Development Status :: 3 - Alpha', | ||
"License :: OSI Approved :: Apache Software License", | ||
"Development Status :: 3 - Alpha", | ||
# 'Development Status :: 4 - Beta', | ||
# 'Development Status :: 5 - Production/Stable', | ||
'Operating System :: OS Independent', | ||
'Intended Audience :: Developers', | ||
'Topic :: Office/Business :: Financial', | ||
'Topic :: Office/Business :: Financial :: Investment', | ||
'Topic :: Scientific/Engineering :: Interface Engine/Protocol Translator', | ||
'Topic :: Software Development :: Libraries', | ||
'Topic :: Software Development :: Libraries :: Python Modules', | ||
'Programming Language :: Python :: 3', | ||
"Operating System :: OS Independent", | ||
"Intended Audience :: Developers", | ||
"Topic :: Office/Business :: Financial", | ||
"Topic :: Office/Business :: Financial :: Investment", | ||
"Topic :: Scientific/Engineering :: Interface Engine/Protocol Translator", | ||
"Topic :: Software Development :: Libraries", | ||
"Topic :: Software Development :: Libraries :: Python Modules", | ||
"Programming Language :: Python :: 3", | ||
], | ||
) |
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,37 @@ | ||
#! /usr/bin/bash | ||
echo "install poetry if not in path" | ||
if ! command -v poetry &> /dev/null | ||
then | ||
echo "poetry is missing. Installing ..." | ||
curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python - | ||
source "$HOME/.poetry/env" | ||
fi | ||
|
||
echo "setting up poetry config" | ||
poetry config virtualenvs.path .venv | ||
poetry config virtualenvs.create true | ||
poetry config virtualenvs.in-project true | ||
|
||
echo "installing dependencies" | ||
poetry install --no-interaction --no-root | ||
|
||
echo "installing libraries" | ||
poetry install --no-interaction | ||
|
||
if [ -n "`$SHELL -c 'echo $ZSH_VERSION'`" ]; then | ||
shell="zsh" | ||
elif [ -n "`$SHELL -c 'echo $BASH_VERSION'`" ]; then | ||
shell="bash" | ||
else | ||
# assume something else | ||
exit | ||
fi | ||
|
||
echo "setup tab completion for invoke for $shell" | ||
# see http://docs.pyinvoke.org/en/stable/invoke.html#shell-tab-completion | ||
poetry run invoke --print-completion-script $shell > .invoke-completion.sh | ||
|
||
echo "To activate the tab completion, run the following command:" | ||
echo "" | ||
echo " $ source .invoke-completion.sh" | ||
echo "" |
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 |
---|---|---|
@@ -1,10 +1,10 @@ | ||
"""Contain information about the project.""" | ||
__package_name__ = 'opensignals' | ||
__version__ = '0.0.2' | ||
__package_name__ = "opensignals" | ||
__version__ = "0.0.2" | ||
|
||
__description__ = 'Open Signals' | ||
__description__ = "Open Signals" | ||
|
||
__author__ = 'Jordi Villar' | ||
__author_email__ = '[email protected]' | ||
__author__ = "Jordi Villar" | ||
__author_email__ = "[email protected]" | ||
|
||
__license__ = 'Apache License' | ||
__license__ = "Apache License" |
Oops, something went wrong.