From a5fd8d0a1fb5a0ae45c7d899c1194413c83fd07c Mon Sep 17 00:00:00 2001 From: Ryan Luu Date: Thu, 9 Jan 2025 18:14:05 +0000 Subject: [PATCH 1/7] Fix conflict Signed-off-by: GitHub --- requirements.txt | Bin 580 -> 582 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/requirements.txt b/requirements.txt index e3d9716053f0dcce2f7122366de8426642673db4..7daf73d6c63489e5536f3eaadb67b4fba4b53b77 100644 GIT binary patch delta 20 bcmX@Ya*Sod7EVJ3BL+PNLk5$LyE_>HK#m2> delta 18 ZcmX@ca)f2V7Iq5;JqBY2gN=JT838zd1)l%_ From 6a7f78eae78b7f2bdd9c48d22a262f42431a0f6c Mon Sep 17 00:00:00 2001 From: Ryan Luu Date: Thu, 9 Jan 2025 18:19:18 +0000 Subject: [PATCH 2/7] Fix version solving Signed-off-by: GitHub --- docs/source/conf.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/docs/source/conf.py b/docs/source/conf.py index 372d38d..051f06f 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -3,25 +3,30 @@ # For the full list of built-in configuration values, see the documentation: # https://www.sphinx-doc.org/en/master/usage/configuration.html +import os +import sys +from importlib.metadata import version + # -- Path setup -------------------------------------------------------------- # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. # -import os -import sys + sys.path.insert(0, os.path.abspath('../..')) # -- Project information ----------------------------------------------------- # https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information +__version__ = version("instawebhooks") + project = 'InstaWebhooks' copyright = '2024-2025, Ryan Luu' author = 'Ryan Luu' -release = '1.0' -version = '1.0.0' +version = ".".join(__version__.split(".")[:2]) +release = __version__ # -- General configuration --------------------------------------------------- # https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration From 30934f538ab6a3f62158227f16a20d6e3b6efb94 Mon Sep 17 00:00:00 2001 From: Ryan Luu Date: Thu, 9 Jan 2025 18:21:17 +0000 Subject: [PATCH 3/7] Automatically get copyright version Signed-off-by: GitHub --- docs/source/conf.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/source/conf.py b/docs/source/conf.py index 051f06f..8eb901f 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -5,6 +5,7 @@ import os import sys +from datetime import datetime, timezone from importlib.metadata import version # -- Path setup -------------------------------------------------------------- @@ -23,7 +24,7 @@ __version__ = version("instawebhooks") project = 'InstaWebhooks' -copyright = '2024-2025, Ryan Luu' +copyright = f'2024-{datetime.now(tz=timezone.utc).year}, Ryan Luu' author = 'Ryan Luu' version = ".".join(__version__.split(".")[:2]) release = __version__ From 81b534da192b46b35ce96ab9fd36f166a614bdfb Mon Sep 17 00:00:00 2001 From: Ryan Luu Date: Thu, 9 Jan 2025 19:49:37 +0000 Subject: [PATCH 4/7] Ignore RST files Signed-off-by: GitHub --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5128a8c..07c5b13 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,6 +7,7 @@ on: branches: [ "main" ] paths-ignore: - '**/*.md' + - '**/*.rst' - '**/*.txt' jobs: From 8fc41dd9e9432bd903a4a9c6e30dc3044d1cf491 Mon Sep 17 00:00:00 2001 From: Ryan Luu Date: Thu, 9 Jan 2025 19:50:09 +0000 Subject: [PATCH 5/7] Use dynamic version Signed-off-by: GitHub --- docs/source/conf.py | 23 +++++++++++++++++++++-- pyproject.toml | 7 +++++-- src/instawebhooks/__init__.py | 3 +++ 3 files changed, 29 insertions(+), 4 deletions(-) diff --git a/docs/source/conf.py b/docs/source/conf.py index 8eb901f..b9a784c 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -4,9 +4,9 @@ # https://www.sphinx-doc.org/en/master/usage/configuration.html import os +import re import sys from datetime import datetime, timezone -from importlib.metadata import version # -- Path setup -------------------------------------------------------------- @@ -15,13 +15,32 @@ # documentation root, use os.path.abspath to make it absolute, like shown here. # +docs_dir = os.path.dirname(os.path.dirname(__file__)) sys.path.insert(0, os.path.abspath('../..')) # -- Project information ----------------------------------------------------- # https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information -__version__ = version("instawebhooks") +# Find the version and release information. +# We have a single source of truth for our version number: the __init__.py file. +# This next bit of code reads from it. +file_with_version = os.path.join(docs_dir, "..", "src", "instawebhooks", "__init__.py") +with open(file_with_version) as f: + for line in f: + m = re.match(r'__version__ = "(.*)"', line) + if m: + __version__ = m.group(1) + # The short X.Y version. + version = ".".join(__version__.split(".")[:2]) + # The full version, including alpha/beta/rc tags. + release = __version__ + break + else: # AKA no-break + version = release = "dev" + +print("version:", version) +print("release:", release) project = 'InstaWebhooks' copyright = f'2024-{datetime.now(tz=timezone.utc).year}, Ryan Luu' diff --git a/pyproject.toml b/pyproject.toml index 244903e..238baa8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,9 +4,8 @@ build-backend = "setuptools.build_meta" [project] name = "instawebhooks" -version = "0.1.3" description = "Discord webhooks for new Instagram posts from any profile" -readme = "README.md" +readme = "README.rst" requires-python = ">=3.8" keywords = ["webhooks", "feed", "embed", "Instagram", "Discord", "CLI"] authors = [ @@ -34,6 +33,7 @@ dependencies = [ "requests", "instaloader", ] +dynamic = ["version"] [project.urls] Homepage = "https://github.com/RyanLua/InstaWebhooks" @@ -46,6 +46,9 @@ Sponsor = "https://github.com/sponsors/RyanLua" [project.scripts] instawebhooks = "instawebhooks.__main__:main" +[tool.setuptools.dynamic] +version = {attr = "instawebhooks.__version__"} + [tool.isort] profile = "black" diff --git a/src/instawebhooks/__init__.py b/src/instawebhooks/__init__.py index 8babeac..32e8bdf 100644 --- a/src/instawebhooks/__init__.py +++ b/src/instawebhooks/__init__.py @@ -2,6 +2,9 @@ import sys +__version__ = "0.1.3" + + if __name__ == "__main__": from instawebhooks.__main__ import main From 2b7bc5c5b269486ac9549fb8c347a638d32f124b Mon Sep 17 00:00:00 2001 From: Ryan Luu Date: Thu, 9 Jan 2025 19:56:54 +0000 Subject: [PATCH 6/7] Use pyproject.toml for dependencies Signed-off-by: GitHub --- .devcontainer/devcontainer.json | 2 +- requirements.txt | Bin 582 -> 0 bytes 2 files changed, 1 insertion(+), 1 deletion(-) delete mode 100644 requirements.txt diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 21b3ded..b6c0e61 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -18,7 +18,7 @@ } }, - "postCreateCommand": "pip3 install --user -r requirements.txt -r docs/requirements.txt && pip install --editable .", + "postCreateCommand": "pip3 install -r docs/requirements.txt && pip install --editable .", "customizations": { "vscode": { diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 7daf73d6c63489e5536f3eaadb67b4fba4b53b77..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 582 zcmaJ;L2kl85c9cGp90DPZPh~`6OsTcK|+&ofX4&2Hw&E5Y9nRG_INzEYl(;sJCr!` zoYDBM`M>8G@W->j982C6KJmdyVvHEcP+hfvg5Tl=F%Y*!YbBw=q!K2K`2C}UG}I?4 zRP@oa9tv5&C;ghL11e){zH0K+MN?+f zhDx0^T4o`}Xp|;NPLxMP?J08?C6V4+Gn8aUKlQ^)oqBpQwk^YwDX8HH=5IUb~tkeAyiQUzfM8S EJId}=#sB~S From efd0373c1978653fc3c298fffb5fce3a99b0ae08 Mon Sep 17 00:00:00 2001 From: Ryan Luu Date: Thu, 9 Jan 2025 11:59:34 -0800 Subject: [PATCH 7/7] Fix CI to use pyproject.toml --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 07c5b13..7a8f4bf 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -31,7 +31,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip pylint black mypy sphinx-lint - pip install -r requirements.txt + pip install . - name: Run Pylint run: |