Skip to content

Commit

Permalink
Drop setuptools
Browse files Browse the repository at this point in the history
  • Loading branch information
sephii committed Nov 30, 2023
1 parent f1a7c03 commit 8cb62b0
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 53 deletions.
1 change: 0 additions & 1 deletion MANIFEST.in

This file was deleted.

28 changes: 28 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
[project]
name = "taxi"
description = "Taxi: timesheeting made easy"
authors = [
{name = "Sylvain Fankhauser", email = "[email protected]"},
]
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"

4 changes: 1 addition & 3 deletions release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
41 changes: 0 additions & 41 deletions setup.py

This file was deleted.

4 changes: 2 additions & 2 deletions taxi/commands/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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()

Expand Down
5 changes: 2 additions & 3 deletions taxi/commands/plugin.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import json
import pkg_resources
import subprocess
import sys

Expand Down Expand Up @@ -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:
Expand Down
6 changes: 3 additions & 3 deletions taxi/plugins.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import pkg_resources
import importlib.metadata
from urllib import parse

from .exceptions import TaxiException
Expand Down Expand Up @@ -35,15 +35,15 @@ 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):
plugins_list = {}

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:
Expand Down

0 comments on commit 8cb62b0

Please sign in to comment.