diff options
| -rw-r--r-- | MANIFEST.in | 5 | ||||
| -rw-r--r-- | README.md | 13 | ||||
| -rw-r--r-- | pyproject.toml | 68 | ||||
| -rw-r--r-- | setup.cfg | 11 | ||||
| -rw-r--r-- | setup.py | 79 | ||||
| -rw-r--r-- | wikiget/__init__.py | 2 | ||||
| -rw-r--r-- | wikiget/dl.py | 4 | ||||
| -rw-r--r-- | wikiget/validations.py | 2 | ||||
| -rw-r--r-- | wikiget/wikiget.py | 4 |
9 files changed, 90 insertions, 98 deletions
diff --git a/MANIFEST.in b/MANIFEST.in index 04f196a..7592f0e 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,2 +1,3 @@ -include README.md -include LICENSE +graft wikiget +graft test +global-exclude *.py[cod] @@ -1,13 +1,12 @@ # wikiget -[](https://travis-ci.org/clpo13/wikiget) [](https://badge.fury.io/py/wikiget) Something like wget for downloading a file from MediaWiki sites (like Wikipedia or Wikimedia Commons) using only the file name or the URL of its description page. -Requires Python 3.6+. Get it with `pip install --user wikiget`. +Requires Python 3.7+. Get it with `pip install --user wikiget` or `pipx install wikiget`. ## Usage @@ -75,7 +74,10 @@ to clutter your system Python environment: # and clone that instead git clone https://github.com/clpo13/wikiget cd wikiget + python3 -m venv venv +# or +virtualenv venv ``` To activate the virtual environment, use one of the following commands: @@ -90,12 +92,13 @@ source venv/bin/activate Then run `pip install -e .` to invoke an ["editable" install](https://pip.pypa.io/en/stable/reference/pip_install/#editable-installs), -meaning any changes made to the source will be reflected immediately in the -executable script. Unit tests can be run with `python setup.py test`. +meaning any changes made to the source will be reflected immediately in the executable +script. Unit tests can be run with `pytest` (make sure to run `pip install pytest-cov` +in the virtual environment first.) ## License -Copyright (C) 2018-2021 Cody Logan and contributors +Copyright (C) 2018-2023 Cody Logan and contributors This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..eed7728 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,68 @@ +[build-system] +requires = ["setuptools"] +build-backend = "setuptools.build_meta" +#requires = ["hatchling"] +#build-backend = "hatchling.build" +#requires = ["pdm-backend"] +#build-backend = "pdm.backend" + +[project] +name = "wikiget" +dynamic = ["version"] +description = "CLI tool for downloading files from MediaWiki sites" +readme = "README.md" +authors = [ + {name = "Cody Logan", email = "clpo13@gmail.com"} +] +requires-python = ">=3.7" +license = {text = "GPL-3.0-or-later"} +keywords = ["commons", "mediawiki", "wikimedia", "wikipedia"] +classifiers = [ + "Development Status :: 4 - Beta", + "Environment :: Console", + "Intended Audience :: End Users/Desktop", + "Operating System :: OS Independent", + "Topic :: Internet", + "Topic :: Internet :: WWW/HTTP", + "Topic :: Multimedia", + "Topic :: Multimedia :: Graphics", + "Topic :: Multimedia :: Sound/Audio", + "Topic :: Multimedia :: Video", + "Topic :: Utilities", + "Programming Language :: Python", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3 :: Only", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", +] +dependencies = [ + "mwclient>=0.10.0", + "requests", + "tqdm", +] + +[project.urls] +Repository = "https://github.com/clpo13/wikiget" +"Bug Reports" = "https://github.com/clpo13/wikiget/issues" + +[project.scripts] +wikiget = "wikiget.wikiget:main" + +[tool.setuptools.dynamic] +version = {attr = "wikiget.version.__version__"} + +#[tool.hatch.version] +#path = "src/wikiget/version.py" + +#[tool.pdm] +#version = { source = "file", path = "src/wikiget/version.py" } + +[tool.pytest.ini_options] +addopts = [ + "--import-mode=importlib", + "--cov=wikiget", +] +testpaths = ["test"] @@ -1,9 +1,4 @@ -[aliases] -test = pytest - -[tool:pytest] -addopts = --cov=wikiget --verbose -testpaths = test - [flake8] -exclude = .eggs,.git,__pycache__,build,dist,venv +exclude = .eggs,.git,__pycache__,build,dist,venv,.venv +max-line-length = 88 +extend-ignore = E203 @@ -1,78 +1,3 @@ -# wikiget - CLI tool for downloading files from Wikimedia sites -# Copyright (C) 2018-2021 Cody Logan -# SPDX-License-Identifier: GPL-3.0-or-later -# -# Wikiget is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Wikiget is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Wikiget. If not, see <https://www.gnu.org/licenses/>. +from setuptools import setup -"""Python setuptools metadata and dependencies.""" - -from io import open -from os import path - -from setuptools import setup, find_packages - -here = path.abspath(path.dirname(__file__)) -with open(path.join(here, 'README.md'), 'r') as fr: - long_description = fr.read() - -version_file = {} -with open(path.join(here, 'wikiget', 'version.py'), 'r') as fv: - exec(fv.read(), version_file) - -setup( - name='wikiget', - version=version_file['__version__'], - author='Cody Logan', - author_email='clpo13@gmail.com', - description='CLI tool for downloading files from MediaWiki sites', - long_description=long_description, - long_description_content_type='text/markdown', - url='https://github.com/clpo13/wikiget', - keywords='commons download mediawiki wikimedia wikipedia', - packages=find_packages(), - classifiers=[ - 'Development Status :: 4 - Beta', - 'Environment :: Console', - 'Intended Audience :: End Users/Desktop', - 'License :: OSI Approved :: GNU General Public License v3 or later ' - '(GPLv3+)', - 'Operating System :: OS Independent', - 'Programming Language :: Python', - 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3 :: Only', - 'Programming Language :: Python :: 3.6', - 'Programming Language :: Python :: 3.7', - 'Programming Language :: Python :: 3.8', - 'Programming Language :: Python :: 3.9', - 'Topic :: Internet', - 'Topic :: Internet :: WWW/HTTP', - 'Topic :: Multimedia', - 'Topic :: Multimedia :: Graphics', - 'Topic :: Multimedia :: Sound/Audio', - 'Topic :: Multimedia :: Video', - 'Topic :: Utilities', - ], - python_requires='>=3.6', - install_requires=['mwclient>=0.10.0', 'requests', 'tqdm'], - setup_requires=['pytest-runner'], - tests_require=['pytest', 'pytest-cov'], - project_urls={ - 'Bug Reports': 'https://github.com/clpo13/wikiget/issues', - }, - entry_points={ - 'console_scripts': [ - 'wikiget=wikiget.wikiget:main', - ], - }, -) +setup() diff --git a/wikiget/__init__.py b/wikiget/__init__.py index 8437ebf..126f04d 100644 --- a/wikiget/__init__.py +++ b/wikiget/__init__.py @@ -17,7 +17,7 @@ from mwclient import __version__ as mwclient_version -from .version import __version__ as wikiget_version +from wikiget.version import __version__ as wikiget_version # set some global constants BLOCKSIZE = 65536 diff --git a/wikiget/dl.py b/wikiget/dl.py index 0ac8fec..f05061e 100644 --- a/wikiget/dl.py +++ b/wikiget/dl.py @@ -23,8 +23,8 @@ from mwclient import APIError, InvalidResponse, LoginError, Site from requests import ConnectionError, HTTPError from tqdm import tqdm -from . import CHUNKSIZE, DEFAULT_SITE, USER_AGENT -from .validations import valid_file, verify_hash +from wikiget import CHUNKSIZE, DEFAULT_SITE, USER_AGENT +from wikiget.validations import valid_file, verify_hash def download(dl, args): diff --git a/wikiget/validations.py b/wikiget/validations.py index 20ef74f..5e7213f 100644 --- a/wikiget/validations.py +++ b/wikiget/validations.py @@ -18,7 +18,7 @@ import hashlib import re -from . import BLOCKSIZE +from wikiget import BLOCKSIZE def valid_file(search_string): diff --git a/wikiget/wikiget.py b/wikiget/wikiget.py index 1e2e9ed..da60037 100644 --- a/wikiget/wikiget.py +++ b/wikiget/wikiget.py @@ -19,8 +19,8 @@ import argparse import logging import sys -from . import DEFAULT_SITE, DEFAULT_PATH, wikiget_version -from .dl import download +from wikiget import DEFAULT_SITE, DEFAULT_PATH, wikiget_version +from wikiget.dl import download def main(): |
