mirror of
https://github.com/JockeTF/fimfarchive.git
synced 2024-11-27 23:47:59 +01:00
Use poetry for dependency management
This commit is contained in:
parent
129a3440e6
commit
26a14126f7
4 changed files with 36 additions and 118 deletions
31
pyproject.toml
Normal file
31
pyproject.toml
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
[tool.poetry]
|
||||||
|
name = "fimfarchive"
|
||||||
|
version = "0.1.0"
|
||||||
|
description = "Preserves stories from Fimfiction"
|
||||||
|
authors = ["Joakim Soderlund <joakim.soderlund@gmail.com>"]
|
||||||
|
license = "GPL-3.0-or-later"
|
||||||
|
|
||||||
|
[tool.poetry.dependencies]
|
||||||
|
python = "^3.8"
|
||||||
|
arrow = "*"
|
||||||
|
bbcode = "*"
|
||||||
|
blinker = "*"
|
||||||
|
importlib_resources = "*"
|
||||||
|
jinja2 = "*"
|
||||||
|
jmespath = "*"
|
||||||
|
jsonapi-client = "*"
|
||||||
|
requests = "*"
|
||||||
|
tqdm = "*"
|
||||||
|
|
||||||
|
[tool.poetry.dev-dependencies]
|
||||||
|
flake8 = "*"
|
||||||
|
mypy = "*"
|
||||||
|
pytest = "*"
|
||||||
|
requests-mock = "*"
|
||||||
|
types-jmespath = "*"
|
||||||
|
types-requests = "*"
|
||||||
|
types-tqdm = "*"
|
||||||
|
|
||||||
|
[build-system]
|
||||||
|
requires = ["poetry-core>=1.0.0"]
|
||||||
|
build-backend = "poetry.core.masonry.api"
|
|
@ -1,16 +0,0 @@
|
||||||
arrow
|
|
||||||
bbcode
|
|
||||||
blinker
|
|
||||||
flake8
|
|
||||||
importlib_resources
|
|
||||||
jinja2
|
|
||||||
jmespath
|
|
||||||
jsonapi-client
|
|
||||||
mypy
|
|
||||||
pytest
|
|
||||||
requests
|
|
||||||
requests-mock
|
|
||||||
tqdm
|
|
||||||
types-jmespath
|
|
||||||
types-requests
|
|
||||||
types-tqdm
|
|
98
setup.py
98
setup.py
|
@ -1,98 +0,0 @@
|
||||||
#!/usr/bin/env python3
|
|
||||||
"""
|
|
||||||
Setuptools for Fimfarchive.
|
|
||||||
"""
|
|
||||||
|
|
||||||
|
|
||||||
#
|
|
||||||
# Fimfarchive, preserves stories from Fimfiction
|
|
||||||
# Copyright (C) 2015 Joakim Soderlund
|
|
||||||
#
|
|
||||||
# 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
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
#
|
|
||||||
|
|
||||||
|
|
||||||
import os
|
|
||||||
from typing import Iterable, List, Tuple
|
|
||||||
|
|
||||||
from setuptools import setup
|
|
||||||
|
|
||||||
from fimfarchive import __author__, __license__, __version__
|
|
||||||
|
|
||||||
|
|
||||||
PACKAGE = 'fimfarchive'
|
|
||||||
GITHUB = 'https://github.com/JockeTF/fimfarchive'
|
|
||||||
|
|
||||||
|
|
||||||
def to_name(path: str) -> str:
|
|
||||||
"""
|
|
||||||
Converts path to a package name.
|
|
||||||
"""
|
|
||||||
return path.replace(os.path.sep, '.')
|
|
||||||
|
|
||||||
|
|
||||||
def iter_package_paths() -> Iterable[str]:
|
|
||||||
"""
|
|
||||||
Yields all package paths to install.
|
|
||||||
"""
|
|
||||||
for dirpath, dirnames, filenames in os.walk(PACKAGE):
|
|
||||||
if '__init__.py' in filenames:
|
|
||||||
yield dirpath
|
|
||||||
|
|
||||||
|
|
||||||
def iter_package_names() -> Iterable[str]:
|
|
||||||
"""
|
|
||||||
Yields all package names to install.
|
|
||||||
"""
|
|
||||||
for dirpath in iter_package_paths():
|
|
||||||
yield to_name(dirpath)
|
|
||||||
|
|
||||||
|
|
||||||
def iter_package_data() -> Iterable[Tuple[str, List[str]]]:
|
|
||||||
"""
|
|
||||||
Yields all package data to install.
|
|
||||||
"""
|
|
||||||
for dirpath in iter_package_paths():
|
|
||||||
filenames = [
|
|
||||||
filename for filename in os.listdir(dirpath)
|
|
||||||
if os.path.isfile(os.path.join(dirpath, filename))
|
|
||||||
and not filename.endswith('.py')
|
|
||||||
]
|
|
||||||
|
|
||||||
if filenames:
|
|
||||||
yield to_name(dirpath), filenames
|
|
||||||
|
|
||||||
|
|
||||||
setup(
|
|
||||||
name="fimfarchive",
|
|
||||||
version=__version__,
|
|
||||||
license=__license__,
|
|
||||||
author=__author__,
|
|
||||||
author_email='fimfarchive@gmail.com',
|
|
||||||
url='http://www.fimfarchive.net/',
|
|
||||||
download_url=f'{GITHUB}/archive/{__version__}.tar.gz',
|
|
||||||
packages=list(iter_package_names()),
|
|
||||||
package_data=dict(iter_package_data()),
|
|
||||||
install_requires=(
|
|
||||||
'arrow',
|
|
||||||
'bbcode',
|
|
||||||
'blinker',
|
|
||||||
'importlib_resources',
|
|
||||||
'jinja2',
|
|
||||||
'jmespath',
|
|
||||||
'jsonapi-client',
|
|
||||||
'requests',
|
|
||||||
'tqdm',
|
|
||||||
),
|
|
||||||
)
|
|
9
tox.ini
9
tox.ini
|
@ -13,11 +13,12 @@ python =
|
||||||
3.11: py311
|
3.11: py311
|
||||||
|
|
||||||
[testenv]
|
[testenv]
|
||||||
deps = -rrequirements.txt
|
deps = poetry
|
||||||
|
commands_pre = poetry install
|
||||||
commands =
|
commands =
|
||||||
py.test
|
poetry run pytest
|
||||||
flake8 fimfarchive tests
|
poetry run flake8 fimfarchive tests
|
||||||
mypy --ignore-missing-imports fimfarchive tests
|
poetry run mypy --ignore-missing-imports fimfarchive tests
|
||||||
|
|
||||||
[pytest]
|
[pytest]
|
||||||
addopts =
|
addopts =
|
||||||
|
|
Loading…
Reference in a new issue