Skip to content

Commit

Permalink
Updating Setup and fixing GH action issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Panos Garefalakis committed Oct 16, 2020
1 parent cc7b8de commit da11664
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 29 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,4 @@ jobs:
- name: "Install in dev mode"
run: "python -m pip install -e .[dev]"
- name: "Import package"
run: "python -c 'import structlog; print(structlog.__version__)'"
run: "python -c 'import http_request_randomizer; print(http_request_randomizer.__version__)'"
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License

Copyright (c) 2018 Panagiotis Garefalakis http://pgaref.github.io
Copyright (c) 2020 Panagiotis Garefalakis http://pgaref.github.io

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
12 changes: 12 additions & 0 deletions http_request_randomizer/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,13 @@
__author__ = 'pgaref'

__version__ = "1.2.3"

__title__ = "http_request_randomizer"
__description__ = "A package using public proxies to randomise http requests"
__uri__ = "http://pgaref.com/blog/python-proxy"

__author__ = "Panagiotis Garefalakis"
__email__ = "pangaref@gmail.com"

__license__ = "MIT"
__copyright__ = "Copyright (c) 2020 " + __author__
20 changes: 10 additions & 10 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
beautifulsoup4 >= 4.6.0
coverage >= 4.5.1
httmock >= 1.2.6
psutil >= 5.4.3
pytest >= 3.4.0
pytest-cov >= 2.5.1
python-dateutil >= 2.6.1
requests >= 2.18.4
pyOpenSSL >= 17.5.0
fake-useragent >= 0.1.10
beautifulsoup4 >= 4.9.3
coverage >= 5.3
httmock >= 1.3.0
psutil >= 5.7.2
pytest >= 6.1.1
pytest-cov >= 2.10.1
python-dateutil >= 2.8.1
requests >= 2.24.0
pyOpenSSL >= 19.1.0
fake-useragent >= 0.1.11
61 changes: 44 additions & 17 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,43 @@
import codecs
import sys
import os
import re

NAME = 'http_request_randomizer'
HERE = os.path.abspath(os.path.dirname(__file__))

PROJECT_URLS = {
"Blog": "http://pgaref.com/blog/python-proxy",
"Documentation": "https://pythonhosted.org/http-request-randomizer/",
"Source Code": "https://github.com/pgaref/http_request_randomizer",
}

def read(*parts):
"""Return multiple read calls to different readable objects as a single
string."""
# intentionally *not* adding an encoding option to open
return codecs.open(os.path.join(HERE, *parts), 'r').read()

LONG_DESCRIPTION = read('README.rst')
try:
META_PATH = os.path.join(HERE, "http_request_randomizer", "__init__.py")
finally:
print(META_PATH)
META_FILE = read(META_PATH)

def find_meta(meta):
"""
Extract __*meta*__ from META_FILE.
"""
print(META_PATH)
meta_match = re.search(
fr"^__{meta}__ = ['\"]([^'\"]*)['\"]", META_FILE, re.M
)
if meta_match:
return meta_match.group(1)
raise RuntimeError(f"Unable to find __{ meta }__ string.")

LONG_DESCRIPTION = read('README.rst')
#########################################################################
class Tox(TestCommand):
def finalize_options(self):
TestCommand.finalize_options(self)
Expand Down Expand Up @@ -43,16 +68,18 @@ def run_tests(self):
import pytest
errno = pytest.main(self.test_args)
sys.exit(errno)


#########################################################################
setup(
name='http_request_randomizer',
version='1.2.3',
url='http://pgaref.com/blog/python-proxy',
license='MIT',
author='Panagiotis Garefalakis',
author_email='pangaref@gmail.com',
description='A package using public proxies to randomise http requests.',
name=NAME,
version=find_meta("version"),
url=find_meta("uri"),
project_urls=PROJECT_URLS,
license=find_meta("license"),
author=find_meta("author"),
author_email=find_meta("email"),
maintainer=find_meta("author"),
maintainer_email=find_meta("email"),
description=find_meta("description"),
long_description=LONG_DESCRIPTION,
packages=find_packages(exclude=['tests']),
platforms='any',
Expand All @@ -61,13 +88,13 @@ def run_tests(self):
# cmdclass={'test': Tox},
tests_require=['pytest', 'pytest-cov'],
cmdclass={'test': PyTest},
install_requires=['beautifulsoup4 >= 4.6.0',
'httmock >= 1.2.6',
'psutil >= 5.4.3',
'python-dateutil >= 2.6.1',
'requests >= 2.18.4',
'pyOpenSSL >= 17.5.0',
'fake-useragent >= 0.1.10'
install_requires=['beautifulsoup4 >= 4.9.3',
'httmock >= 1.3.0',
'psutil >= 5.7.2',
'python-dateutil >= 2.8.1',
'requests >= 2.24.0',
'pyOpenSSL >= 19.1.0',
'fake-useragent >= 0.1.11'
],
use_scm_version=True,
setup_requires=['setuptools-scm', 'pytest-runner'],
Expand Down

0 comments on commit da11664

Please sign in to comment.