diff --git a/.gitignore b/.gitignore index 7dbdb7b..efe2784 100644 --- a/.gitignore +++ b/.gitignore @@ -37,7 +37,6 @@ pip-delete-this-directory.txt # Unit test / coverage reports htmlcov/ -.tox/ .coverage .coverage.* .cache diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index bf26239..0000000 --- a/.travis.yml +++ /dev/null @@ -1,14 +0,0 @@ -# Config file for automatic testing at travis-ci.org - -language: python -python: - - 3.8 - - 3.7 - -# Command to install dependencies, e.g. pip install -r requirements_dev.txt --use-mirrors -install: pip install -U tox-travis - -# Command to run tests, e.g. python setup.py test -script: tox - - diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index 6deeacf..436841d 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -70,14 +70,14 @@ Ready to contribute? Here's how to set up `erepublik` for local development. Now you can make your changes locally. -5. When you're done making changes, check that your changes pass flake8 and the - tests, including testing other Python versions with tox:: +5. When you're done making changes, check that your changes pass flake8, isort and the + tests:: $ flake8 erepublik tests - $ python setup.py test or py.test - $ tox + $ isort erepublik + $ python setup.py test - To get flake8 and tox, just pip install them into your virtualenv. + To get flake8 and isort, just pip install them into your virtualenv. 6. Commit your changes and push your branch to GitHub:: diff --git a/Makefile b/Makefile index be369f5..6bd5634 100644 --- a/Makefile +++ b/Makefile @@ -47,7 +47,6 @@ clean-pyc: ## remove Python file artifacts rm -rf log/ clean-test: ## remove test and coverage artifacts - rm -fr .tox/ rm -f .coverage rm -fr htmlcov/ rm -fr .pytest_cache @@ -58,9 +57,6 @@ lint: ## check style with flake8 test: ## run tests quickly with the default Python python setup.py test -test-all: ## run tests on every Python version with tox - tox - coverage: ## check code coverage quickly with the default Python coverage run --source erepublik setup.py test coverage report -m @@ -80,6 +76,7 @@ servedocs: docs ## compile the docs watching for changes release: dist ## package and upload a release twine upload dist/* + clean dist: clean ## builds source and wheel package python setup.py sdist diff --git a/erepublik/__init__.py b/erepublik/__init__.py index 5bc73de..d9ba8ca 100644 --- a/erepublik/__init__.py +++ b/erepublik/__init__.py @@ -6,7 +6,7 @@ __author__ = """Eriks Karls""" __email__ = 'eriks@72.lv' __version__ = '0.23.3.2' -from erepublik import classes, utils, constants +from erepublik import classes, constants, utils from erepublik.citizen import Citizen __all__ = ["classes", "utils", "Citizen", 'constants'] diff --git a/erepublik/citizen.py b/erepublik/citizen.py index 0206094..8c83f9e 100644 --- a/erepublik/citizen.py +++ b/erepublik/citizen.py @@ -11,7 +11,7 @@ from typing import Any, Dict, List, NoReturn, Optional, Set, Tuple, Union from requests import HTTPError, RequestException, Response -from . import utils, classes, access_points, constants +from . import access_points, classes, constants, utils from .classes import OfferItem diff --git a/erepublik/classes.py b/erepublik/classes.py index e953474..7073601 100644 --- a/erepublik/classes.py +++ b/erepublik/classes.py @@ -3,11 +3,11 @@ import hashlib import threading import weakref from decimal import Decimal -from typing import Any, Dict, List, NamedTuple, Tuple, Union, NoReturn, Generator, Iterable +from typing import Any, Dict, Generator, Iterable, List, NamedTuple, NoReturn, Tuple, Union from requests import Response, Session, post -from . import utils, constants +from . import constants, utils __all__ = ['Battle', 'BattleDivision', 'BattleSide', 'Company', 'Config', 'Details', 'Energy', 'ErepublikException', 'ErepublikNetworkException', 'EnergyToFight', diff --git a/erepublik/utils.py b/erepublik/utils.py index 1f20212..9c4e862 100644 --- a/erepublik/utils.py +++ b/erepublik/utils.py @@ -10,7 +10,7 @@ import unicodedata import warnings from decimal import Decimal from pathlib import Path -from typing import Any, List, Optional, Union, Dict +from typing import Any, Dict, List, Optional, Union import requests @@ -158,6 +158,7 @@ def write_file(filename: str, content: str) -> int: def write_request(response: requests.Response, is_error: bool = False): from erepublik import Citizen + # Remove GET args from url name url = response.url last_index = url.index("?") if "?" in url else len(response.url) diff --git a/examples/eat_work_train.py b/examples/eat_work_train.py index a7d824f..63f1e11 100644 --- a/examples/eat_work_train.py +++ b/examples/eat_work_train.py @@ -1,6 +1,6 @@ from datetime import timedelta -from erepublik import Citizen, utils, constants +from erepublik import Citizen, constants, utils CONFIG = { 'email': 'player@email.com', diff --git a/requirements_dev.txt b/requirements_dev.txt index 32b3d19..9a72af0 100644 --- a/requirements_dev.txt +++ b/requirements_dev.txt @@ -4,16 +4,15 @@ edx-sphinx-theme==1.5.0 flake8==3.8.4 ipython>=7.19.0 isort==5.6.4 -pip==20.3.1 +pip==20.3.3 PyInstaller==4.1 pytz==2020.4 -pytest==6.1.2 +pytest==6.2.1 responses==0.12.1 setuptools==51.0.0 Sphinx==3.3.1 -requests==2.25.0 +requests>=2.24.0,<2.26.0 PySocks==1.7.1 -tox==3.20.1 twine==3.2.0 -watchdog==1.0.0 -wheel==0.36.1 +wheel==0.36.2 +pur==5.3.0 diff --git a/setup.cfg b/setup.cfg index d678d61..5f45fac 100644 --- a/setup.cfg +++ b/setup.cfg @@ -18,13 +18,13 @@ replace = __version__ = '{new_version}' universal = 1 [flake8] -exclude = docs,.tox,.git,log,debug,venv +exclude = docs,.git,log,debug,venv max-line-length = 120 ignore = D100,D101,D102,D103 [pycodestyle] max-line-length = 120 -exclude = .tox,.git,log,debug,venv, build +exclude = .git,log,debug,venv, build [mypy] python_version = 3.7 diff --git a/setup.py b/setup.py index cc834bb..629df41 100644 --- a/setup.py +++ b/setup.py @@ -13,7 +13,7 @@ with open('HISTORY.rst') as history_file: requirements = [ 'pytz==2020.4', - 'requests==2.25.0', + 'requests>=2.24.0,<2.26.0', 'PySocks==1.7.1' ] diff --git a/tox.ini b/tox.ini deleted file mode 100644 index 820fb35..0000000 --- a/tox.ini +++ /dev/null @@ -1,18 +0,0 @@ -[tox] -envlist = py37, py38, flake8 - -[travis] -python = - 3.7: py37 - 3.8: py38 - -[testenv:flake8] -basepython = python -deps = flake8 -commands = flake8 erepublik_script - -[testenv] -setenv = - PYTHONPATH = {toxinidir} - -commands = python setup.py test