diff --git a/MANIFEST.in b/MANIFEST.in deleted file mode 100644 index f1cb7376..00000000 --- a/MANIFEST.in +++ /dev/null @@ -1 +0,0 @@ -include setup.py diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 00000000..44eb2767 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,28 @@ +[project] +name = "taxi" +description = "Taxi: timesheeting made easy" +authors = [ + {name = "Sylvain Fankhauser", email = "sephi@fhtagn.top"}, +] +readme = "README.rst" +requires-python = ">=3.8" +dynamic = ["version"] +dependencies = [ + "click>=3.3", + "appdirs>=1.4.0", +] + +[project.urls] +Source = "https://github.com/sephii/taxi" +Documentation = "https://taxi-timesheets.readthedocs.io/" + +[project.scripts] +taxi = "taxi.commands.base:cli" + +[project.entry-points."taxi.backends"] +dummy = "taxi.backends.dummy:DummyBackend" + +[build-system] +requires = ["flit_core >=3.2,<4"] +build-backend = "flit_core.buildapi" + diff --git a/release.sh b/release.sh index cf8301a7..e92a51d9 100755 --- a/release.sh +++ b/release.sh @@ -7,9 +7,7 @@ release () { git commit -m "Bump version number to $1" taxi/__init__.py git tag -m "Release $1" -s $1 git push origin $1 - rm dist/* - ./setup.py sdist - twine upload dist/* + flit publish } if [ "$#" -ne 1 ]; then diff --git a/setup.py b/setup.py deleted file mode 100755 index 5f8ab1a2..00000000 --- a/setup.py +++ /dev/null @@ -1,41 +0,0 @@ -#!/usr/bin/env python -from setuptools import find_packages, setup - -from taxi import __version__ - -install_requires = [ - 'click>=3.3', - 'appdirs>=1.4.0', -] - - -setup( - name='taxi', - version=__version__, - packages=find_packages(exclude=('tests', 'tests.*')), - description='Taxi: timesheeting made easy', - long_description=open("README.rst").read(), - long_description_content_type="text/x-rst", - author='Sylvain Fankhauser', - author_email='sylvain.fankhauser@liip.ch', - url='https://github.com/liip/taxi', - install_requires=install_requires, - license='wtfpl', - include_package_data=False, - package_data={ - 'taxi': ['etc/*'] - }, - python_requires='>=3.8', - entry_points={ - 'taxi.backends': 'dummy = taxi.backends.dummy:DummyBackend', - 'console_scripts': 'taxi = taxi.commands.base:cli' - }, - classifiers=[ - 'Environment :: Console', - 'Development Status :: 5 - Production/Stable', - 'Programming Language :: Python :: 3.8', - 'Programming Language :: Python :: 3.9', - 'Programming Language :: Python :: 3.10', - 'Programming Language :: Python :: 3.11', - ], -) diff --git a/taxi/commands/base.py b/taxi/commands/base.py index bc00f49e..3d040f6a 100644 --- a/taxi/commands/base.py +++ b/taxi/commands/base.py @@ -2,10 +2,10 @@ import functools import logging import os +import pkgutil import sys import click -import pkg_resources from appdirs import AppDirs from click._termui_impl import Editor @@ -104,7 +104,7 @@ def create_config_file(filename, run_conversions=True): ) ) + '\n') - config = pkg_resources.resource_string('taxi', 'etc/taxirc.sample').decode('utf-8') + config = pkgutil.get_data("taxi", "etc/taxirc.sample").decode() context = {} available_backends = plugins_registry.get_available_backends() diff --git a/taxi/commands/plugin.py b/taxi/commands/plugin.py index 7c63aee9..df1a844b 100644 --- a/taxi/commands/plugin.py +++ b/taxi/commands/plugin.py @@ -1,5 +1,4 @@ import json -import pkg_resources import subprocess import sys @@ -124,8 +123,8 @@ def install(ctx, plugin): sys.exit(1) try: - installed_version = pkg_resources.get_distribution(plugin_name).version - except pkg_resources.DistributionNotFound: + installed_version = importlib.metadata.version(plugin_name) + except importlib.metadata.PackageNotFoundError: installed_version = None if installed_version is not None and info['version'] == installed_version: diff --git a/taxi/plugins.py b/taxi/plugins.py index d3c5f159..e6a9d12e 100644 --- a/taxi/plugins.py +++ b/taxi/plugins.py @@ -1,4 +1,4 @@ -import pkg_resources +import importlib.metadata from urllib import parse from .exceptions import TaxiException @@ -35,7 +35,7 @@ def __init__(self): for entry_point_type in self.ENTRY_POINTS: self._entry_points[entry_point_type] = {} - for entry_point in pkg_resources.iter_entry_points(entry_point_type): + for entry_point in importlib.metadata.entry_points(group=entry_point_type): self._entry_points[entry_point_type][entry_point.name] = entry_point def get_plugins(self): @@ -43,7 +43,7 @@ def get_plugins(self): for entry_point_type, entry_points in self._entry_points.items(): for entry_point in entry_points.values(): - plugin_name = entry_point.dist.project_name[5:] + plugin_name = entry_point.dist.name plugin_version = entry_point.dist.version if plugin_name: