Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rework Project Structure #32

Merged
merged 6 commits into from
Oct 26, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
move srouce files, update appropriately
  • Loading branch information
jessedp committed Oct 26, 2020
commit c105762675465098413391e216aad9965b9cf6ea
11 changes: 8 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ build: clean-build lint


lint:
black --target-version py36 .
pylint *.py
black --target-version py36 ph5lt
pylint ph5lt

test: clean-pyc lint
python3 -m pytest

run:
python3 ph5lt.py
python3 ph5lt/app.py

update:
python3 -m pip install --user --upgrade setuptools wheel
Expand All @@ -32,6 +32,11 @@ package: build
publishTest: package
python3 -m twine upload --repository testpypi dist/*

installTest:
pip3 install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple pihole5-list-tool --upgrade

uninstall:
pip3 uninstall pihole5-list-tool

publish: package
python3 -m twine upload dist/*
Expand Down
Empty file added ph5lt/__init__.py
Empty file.
6 changes: 3 additions & 3 deletions allowlists.py → ph5lt/allowlists.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
import requests
from PyInquirer import Separator

import prompts
import constants
import utils
from ph5lt import prompts
from ph5lt import constants
from ph5lt import utils

ANUDEEP_ALLOWLIST = (
"https://raw.githubusercontent.com/anudeepND/whitelist/master/domains/whitelist.txt"
Expand Down
14 changes: 7 additions & 7 deletions ph5lt.py → ph5lt/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@
import sys
import sqlite3

import constants
import prompts
import allowlists
import blocklists
import utils
import banner
import stats
from ph5lt import constants
from ph5lt import prompts
from ph5lt import allowlists
from ph5lt import blocklists
from ph5lt import utils
from ph5lt import banner
from ph5lt import stats


def main():
Expand Down
5 changes: 3 additions & 2 deletions banner.py → ph5lt/banner.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
""" silly ansi banner"""

from colors import color
import utils

__version__ = "0.6.0"
from ph5lt import utils

__version__ = "0.6.3"


def display():
Expand Down
6 changes: 3 additions & 3 deletions blocklists.py → ph5lt/blocklists.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
import requests
from PyInquirer import Separator

import prompts
import constants
import utils
from ph5lt import prompts
from ph5lt import constants
from ph5lt import utils

# PiHole 5.1 installation defaults
DEFAULT_LISTS = [
Expand Down
File renamed without changes.
5 changes: 3 additions & 2 deletions prompts.py → ph5lt/prompts.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
import os
import sqlite3
from PyInquirer import prompt, Validator, ValidationError, Separator
import constants
import utils

from ph5lt import constants
from ph5lt import utils


def check_db(path):
Expand Down
3 changes: 2 additions & 1 deletion stats.py → ph5lt/stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

from terminaltables import AsciiTable, SingleTable
from colors import color
import utils

from ph5lt import utils

stats = {
"total_adlist": "SELECT COUNT(*) FROM adlist",
Expand Down
3 changes: 2 additions & 1 deletion utils.py → ph5lt/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
from urllib.parse import urlparse
from json.decoder import JSONDecodeError
from colors import color
import constants

from ph5lt import constants


def valid_url(url):
Expand Down
14 changes: 10 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

def version():
"""Return version string."""
with io.open("banner.py") as input_file:
with io.open("ph5lt/banner.py") as input_file:
for line in input_file:
if line.startswith("__version__"):
return ast.parse(line).body[0].value.s
Expand All @@ -21,7 +21,8 @@ def version():
long_description=readme.read(),
long_description_content_type="text/markdown",
package_dir="",
packages=find_packages(exclude=("tests", "tests.*")),
packages1=find_packages(exclude=("tests", "tests.*")),
packages=["ph5lt"],
url="https://github.com/jessedp/pihole5-list-tool",
classifiers=[
"Programming Language :: Python :: 3",
Expand All @@ -30,10 +31,15 @@ def version():
"Topic :: Utilities",
"Topic :: Internet :: Name Service (DNS)",
],
project_urls={
"Bug Tracker": "https://github.com/jessedp/pihole5-list-tool/issues",
"Source Code": "https://github.com/jessedp/pihole5-list-tool",
},
keywords="pihole, pi-hole, blacklist, blocklist, whitelist, allowlist, adlist",
python_requires=">=3.6",
install_requires=["PyInquirer", "ansicolors", "requests", "terminaltables"],
py_modules=[
packages2=["ph5lt"],
py_modules2=[
"ph5lt",
"prompts",
"constants",
Expand All @@ -43,5 +49,5 @@ def version():
"blocklists",
"stats",
],
entry_points={"console_scripts": ["pihole5-list-tool = ph5lt:main"]},
entry_points={"console_scripts": ["pihole5-list-tool = ph5lt.app:main"]},
)