diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index 6407c60..78f94f4 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -9,7 +9,7 @@ jobs: strategy: max-parallel: 2 matrix: - python-version: ["3.10"] + python-version: ["3.11", "3.12"] steps: - uses: actions/checkout@v3 diff --git a/.github/workflows/pythonpublish.yml b/.github/workflows/pythonpublish.yml index c409a1e..7e5696d 100644 --- a/.github/workflows/pythonpublish.yml +++ b/.github/workflows/pythonpublish.yml @@ -8,19 +8,18 @@ jobs: deploy: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v4 - name: Set up Python - uses: actions/setup-python@v1 + uses: actions/setup-python@v4 with: python-version: '3.x' - name: Install dependencies run: | - python -m pip install --upgrade pip - pip install setuptools wheel twine + python3 -m pip install --upgrade build twine - name: Build and publish env: TWINE_USERNAME: __token__ TWINE_PASSWORD: ${{ secrets.PYPITOKEN }} run: | - python setup.py sdist bdist_wheel + python -m build twine upload dist/* diff --git a/pyproject.toml b/pyproject.toml index 4da7bab..92282d5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,47 @@ +[build-system] +requires = ["setuptools>=61.0"] +build-backend = "setuptools.build_meta" + +[project.scripts] # Change this if you want to modify the name of the executable! +pybliotecario = "pybliotecario.pybliotecario:main" + +[project.urls] +repository = "https://github.com/scarlehoff/pybliotecario" + +[project] +name = "pybliotecario" +dynamic = ["version"] +authors = [ + { name = "juacrumar", email = "juacrumar@lairen.eu" } +] +description = "Personal telegram bot to interact between your Telegram account and your computer" +readme = "README" +classifiers = [ + "Programming Language :: Python :: 3", + "License :: GNU GPLv3", + "Operating System :: OS Independent", +] +requires-python = ">=3.8" +dependencies = [ + "requests", + "psutil" +] + +[project.optional-dependencies] +facebook = ["flask", "requests_toolbelt"] +stonks = ["yahoo-fin", "pandas"] +arxiv = ["arxiv"] +weather = ["pyowm"] +wiki = ["wikipedia"] +github = ["pygithub"] +image = ["pillow"] +tests = ["numpy"] +full = ["pybliotecario[facebook, stonks, arxiv, weather, wiki, github, image, tests]"] + + +[tool.setuptools.dynamic] +version = {attr = "pybliotecario.__version__"} + [tool.black] line-length = 100 skip_magic_trailing_comma = true diff --git a/readme.md b/readme.md index 83781dd..b566527 100644 --- a/readme.md +++ b/readme.md @@ -20,7 +20,7 @@ and the base program can be installed with: pip install pybliotecario ``` -If you want to install all dependencies for [all components](https://github.com/scarlehoff/pybliotecario/blob/master/setup.py#L17) do +If you want to install all dependencies for [all components](https://github.com/scarlehoff/pybliotecario/blob/master/pyproject.toml#L30) do ```bash pip install pybliotecario[full] @@ -31,20 +31,10 @@ You can also install it using the development version: ```bash git clone https://github.com/scarlehoff/pybliotecario.git cd pybliotecario -python3 setup.py install +python3 -m pip install . ``` -You can use the command line argument `with_name` to install the pybliotecario -with your hostname (capitalized) as executable name. - -```bash -python3 setup.py install --with_name -``` - -That way, for instance, if your computer is called `glados` you can invoke the program with `~$ Glados`. -If you want to use a different name just modify the variable `pybliotecario_name` inside `setup.py`. - -A small `systemd_install.sh` script is included in the repository in order to daemonize it easily. +A small `systemd_install.sh` script is included in the repository in order to easily daemonize it. ## How to connect the pybliotecario to Telegram The main backend for the pybliotecario is Telegram, although facebook can also be used (see [here](https://github.com/scarlehoff/pybliotecario/tree/master/src/pybliotecario/backend)) diff --git a/setup.py b/setup.py deleted file mode 100644 index 0b14f70..0000000 --- a/setup.py +++ /dev/null @@ -1,68 +0,0 @@ -import pathlib -from setuptools import setup, find_packages -import sys - -pybliotecario_name = "pybliotecario" -if "--with_name" in sys.argv: - import socket - - # Use the hostname as the name of the pybliotecario - # executable - hostname = socket.gethostname().capitalize() - pybliotecario_name = hostname - - # Remove it from the list of argument, nobody should know - sys.argv.remove("--with_name") - -target_dependencies = { - "facebook": ["flask", "requests_toolbelt"], - "stonks": ["yahoo-fin", "pandas"], - "arxiv": ["arxiv"], - "weather": ["pyowm"], - "wiki": ["wikipedia"], - "github": ["pygithub"], - "twitter": ["tweepy"], - "image": ["pillow"], - "tests": ["numpy"] -} - -# Create a special target for full -target_dependencies["full"] = set().union(*target_dependencies.values()) - -# Readup the readme -README = (pathlib.Path(__file__).parent / "readme.md").read_text() -setup( - name=pybliotecario_name, - version="2.4", - author="Scarlehoff", - author_email="juacrumar@lairen.eu", - url="https://github.com/scarlehoff/pybliotecario", - description="Personal telegram bot to interact between your Telegram account and your computer", - long_description=README, - long_description_content_type="text/markdown", - license="GNU GPLv3", - package_dir={"": "src"}, - packages=find_packages("src"), - install_requires=[ - "requests", - "psutil", - ], - extras_require=target_dependencies, - entry_points={ - "console_scripts": [ - "{0} = pybliotecario.pybliotecario:main".format(pybliotecario_name), - ] - }, -) - -print( - """ -############## -Installed pybliotecario as {0} - -IMPORTANT: Don't forget to run - ~$ {0} --init -for proper configuration of the pybliotecario""".format( - pybliotecario_name - ) -)