From cdea5067c058fd14c085fb770c713355200e34ea Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Tue, 16 May 2023 14:28:31 -0500 Subject: [PATCH 01/19] Replace `setup.py` contents with `setup.cfg` --- setup.cfg | 42 +++++++++++++++++++++++++++ setup.py | 87 ++----------------------------------------------------- 2 files changed, 45 insertions(+), 84 deletions(-) create mode 100644 setup.cfg diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000..1cf87cd --- /dev/null +++ b/setup.cfg @@ -0,0 +1,42 @@ +# -*- coding: utf-8; -*- + +[metadata] +name = rattail-mailchimp +version = attr: rattail_mailchimp.__version__ +author = Lance Edgar +author_email = lance@edbob.org +url = https://rattailproject.org/ +license = GNU GPL v3 +description = Rattail Software Interfaces for MailChimp +long_description = file: README.rst +classifiers = + Development Status :: 4 - Beta + Environment :: Console + Environment :: Web Environment + Intended Audience :: Developers + License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+) + Natural Language :: English + Operating System :: OS Independent + Programming Language :: Python + Programming Language :: Python :: 3 + Topic :: Office/Business + Topic :: Software Development :: Libraries :: Python Modules + + +[options] +install_requires = + mailchimp3 + rattail + +packages = find: +include_package_data = True +zip_safe = False + + +[options.entry_points] + +rattail.commands = + import-mailchimp = rattail_mailchimp.commands:ImportMailChimp + +rattail.emails = + rattail_mailchimp = rattail_mailchimp.emails diff --git a/setup.py b/setup.py index 7235ac6..615bc06 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ ################################################################################ # # Rattail -- Retail Software Framework -# Copyright © 2010-2022 Lance Edgar +# Copyright © 2010-2023 Lance Edgar # # This file is part of Rattail. # @@ -21,87 +21,6 @@ # ################################################################################ -import os -from setuptools import setup, find_packages +from setuptools import setup - -here = os.path.abspath(os.path.dirname(__file__)) -exec(open(os.path.join(here, 'rattail_mailchimp', '_version.py')).read()) -README = open(os.path.join(here, 'README.rst')).read() - - -requires = [ - # - # Version numbers within comments below have specific meanings. - # Basically the 'low' value is a "soft low," and 'high' a "soft high." - # In other words: - # - # If either a 'low' or 'high' value exists, the primary point to be - # made about the value is that it represents the most current (stable) - # version available for the package (assuming typical public access - # methods) whenever this project was started and/or documented. - # Therefore: - # - # If a 'low' version is present, you should know that attempts to use - # versions of the package significantly older than the 'low' version - # may not yield happy results. (A "hard" high limit may or may not be - # indicated by a true version requirement.) - # - # Similarly, if a 'high' version is present, and especially if this - # project has laid dormant for a while, you may need to refactor a bit - # when attempting to support a more recent version of the package. (A - # "hard" low limit should be indicated by a true version requirement - # when a 'high' version is present.) - # - # In any case, developers and other users are encouraged to play - # outside the lines with regard to these soft limits. If bugs are - # encountered then they should be filed as such. - # - # package # low high - - 'mailchimp3', # 3.0.14 - 'rattail', # 0.9.214 -] - - -setup( - name = "rattail-mailchimp", - version = __version__, - author = "Lance Edgar", - author_email = "lance@edbob.org", - url = "https://rattailproject.org/", - license = "GNU GPL v3", - description = "Rattail Software Interfaces for MailChimp", - long_description = README, - - classifiers = [ - 'Development Status :: 4 - Beta', - 'Environment :: Console', - 'Environment :: Web Environment', - 'Intended Audience :: Developers', - 'License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)', - 'Natural Language :: English', - 'Operating System :: OS Independent', - 'Programming Language :: Python', - 'Programming Language :: Python :: 3', - 'Topic :: Office/Business', - 'Topic :: Software Development :: Libraries :: Python Modules', - ], - - install_requires = requires, - packages = find_packages(), - include_package_data = True, - zip_safe = False, - - entry_points = { - - 'rattail.commands': [ - 'import-mailchimp = rattail_mailchimp.commands:ImportMailChimp', - ], - - - 'rattail.emails': [ - 'rattail_mailchimp = rattail_mailchimp.emails', - ], - }, -) +setup() From 8447b63641341b0f25adb13404c66cba3cbaebce Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Thu, 1 Jun 2023 14:25:13 -0500 Subject: [PATCH 02/19] Update changelog --- CHANGELOG.md | 4 ++++ rattail_mailchimp/_version.py | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7fc0322..53702c8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,10 @@ All notable changes to rattail-mailchimp will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). +## [0.1.4] - 2023-06-01 +### Changed +- Replace `setup.py` contents with `setup.cfg`. + ## [0.1.3] - 2023-05-13 ### Changed - Avoid deprecated import for `OrderedDict`. diff --git a/rattail_mailchimp/_version.py b/rattail_mailchimp/_version.py index d60824a..483f94f 100644 --- a/rattail_mailchimp/_version.py +++ b/rattail_mailchimp/_version.py @@ -1,3 +1,3 @@ # -*- coding: utf-8; -*- -__version__ = '0.1.3' +__version__ = '0.1.4' From fad83c465fa26a39dd400d282ec6751618bd7f41 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Thu, 30 Nov 2023 22:22:33 -0600 Subject: [PATCH 03/19] Update subcommand entry point group names, per wuttjamaican --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index 1cf87cd..f27fc05 100644 --- a/setup.cfg +++ b/setup.cfg @@ -35,7 +35,7 @@ zip_safe = False [options.entry_points] -rattail.commands = +rattail.subcommands = import-mailchimp = rattail_mailchimp.commands:ImportMailChimp rattail.emails = From a80edf160b6874665632914ea8a36b9cea305382 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Thu, 30 Nov 2023 22:22:58 -0600 Subject: [PATCH 04/19] Update changelog --- CHANGELOG.md | 4 ++++ rattail_mailchimp/_version.py | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 53702c8..43622a7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,10 @@ All notable changes to rattail-mailchimp will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). +## [0.1.5] - 2023-11-30 +### Changed +- Update subcommand entry point group names, per wuttjamaican. + ## [0.1.4] - 2023-06-01 ### Changed - Replace `setup.py` contents with `setup.cfg`. diff --git a/rattail_mailchimp/_version.py b/rattail_mailchimp/_version.py index 483f94f..67ed0c1 100644 --- a/rattail_mailchimp/_version.py +++ b/rattail_mailchimp/_version.py @@ -1,3 +1,3 @@ # -*- coding: utf-8; -*- -__version__ = '0.1.4' +__version__ = '0.1.5' From 6ee6d5fea829d51fe02ae56c776fda195b30f6fe Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Thu, 16 May 2024 20:04:52 -0500 Subject: [PATCH 05/19] Add typer equivalents for `rattail` commands --- rattail_mailchimp/commands.py | 30 +++++++++++++++++++++++++----- setup.cfg | 3 +++ 2 files changed, 28 insertions(+), 5 deletions(-) diff --git a/rattail_mailchimp/commands.py b/rattail_mailchimp/commands.py index 8808fbb..629307d 100644 --- a/rattail_mailchimp/commands.py +++ b/rattail_mailchimp/commands.py @@ -2,7 +2,7 @@ ################################################################################ # # Rattail -- Retail Software Framework -# Copyright © 2010-2021 Lance Edgar +# Copyright © 2010-2024 Lance Edgar # # This file is part of Rattail. # @@ -24,11 +24,31 @@ Rattail Commands for MailChimp integration """ -from rattail import commands -from rattail.util import load_object +import typer + +from rattail.commands import rattail_typer, ImportSubcommand +from rattail.commands.typer import importer_command, typer_get_runas_user +from rattail.commands.importing import ImportCommandHandler -class ImportMailChimp(commands.ImportSubcommand): +@rattail_typer.command() +@importer_command +def import_mailchimp( + ctx: typer.Context, + **kwargs +): + """ + Import data to Rattail, from MailChimp API + """ + config = ctx.parent.rattail_config + progress = ctx.parent.rattail_progress + handler = ImportCommandHandler( + config, import_handler_key='to_rattail.from_mailchimp.import') + kwargs['user'] = typer_get_runas_user(ctx) + handler.run(kwargs, progress=progress) + + +class ImportMailChimp(ImportSubcommand): """ Import data to Rattail, from MailChimp API """ @@ -43,4 +63,4 @@ class ImportMailChimp(commands.ImportSubcommand): else: # just use default, for sake of cmd line help spec = self.default_handler_spec - return load_object(spec) + return self.app.load_object(spec) diff --git a/setup.cfg b/setup.cfg index f27fc05..9439cdf 100644 --- a/setup.cfg +++ b/setup.cfg @@ -38,5 +38,8 @@ zip_safe = False rattail.subcommands = import-mailchimp = rattail_mailchimp.commands:ImportMailChimp +rattail.typer_imports = + rattail_mailchimp = rattail_mailchimp.commands + rattail.emails = rattail_mailchimp = rattail_mailchimp.emails From 1a4991d9c450da9c2706ac7b00c77c9dafefaac6 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Mon, 3 Jun 2024 11:21:46 -0500 Subject: [PATCH 06/19] Update changelog --- CHANGELOG.md | 4 ++++ rattail_mailchimp/_version.py | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 43622a7..a5c01c1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,10 @@ All notable changes to rattail-mailchimp will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). +## [0.2.0] - 2024-06-03 +### Changed +- Migrate all commands to use `typer`. + ## [0.1.5] - 2023-11-30 ### Changed - Update subcommand entry point group names, per wuttjamaican. diff --git a/rattail_mailchimp/_version.py b/rattail_mailchimp/_version.py index 67ed0c1..08b390b 100644 --- a/rattail_mailchimp/_version.py +++ b/rattail_mailchimp/_version.py @@ -1,3 +1,3 @@ # -*- coding: utf-8; -*- -__version__ = '0.1.5' +__version__ = '0.2.0' From 48c8ea43dfcfb22cc5993508d44e03742bc58572 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Mon, 3 Jun 2024 11:22:47 -0500 Subject: [PATCH 07/19] Fix default dist filename for release task not sure why this fix was needed, did setuptools behavior change? --- tasks.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tasks.py b/tasks.py index ac9fab3..577dd82 100644 --- a/tasks.py +++ b/tasks.py @@ -2,7 +2,7 @@ ################################################################################ # # Rattail -- Retail Software Framework -# Copyright © 2010-2022 Lance Edgar +# Copyright © 2010-2024 Lance Edgar # # This file is part of Rattail. # @@ -35,12 +35,12 @@ exec(open(os.path.join(here, 'rattail_mailchimp', '_version.py')).read()) @task -def release(ctx): +def release(c): """ Release a new version of 'rattail-mailchimp'. """ shutil.rmtree('rattail_mailchimp.egg-info') - ctx.run('python -m build --sdist') + c.run('python -m build --sdist') - filename = 'rattail-mailchimp-{}.tar.gz'.format(__version__) - ctx.run('twine upload dist/{}'.format(filename)) + filename = f'rattail_mailchimp-{__version__}.tar.gz' + c.run('twine upload dist/{}'.format(filename)) From 6757a48c34255f07d889600936fa8a3b8fd57da4 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Tue, 4 Jun 2024 17:21:30 -0500 Subject: [PATCH 08/19] Setup default handler for Mailchimp -> Rattail import --- rattail_mailchimp/config.py | 42 +++++++++++++++++++++++++++++++++++++ setup.cfg | 3 +++ 2 files changed, 45 insertions(+) create mode 100644 rattail_mailchimp/config.py diff --git a/rattail_mailchimp/config.py b/rattail_mailchimp/config.py new file mode 100644 index 0000000..9005b78 --- /dev/null +++ b/rattail_mailchimp/config.py @@ -0,0 +1,42 @@ +# -*- coding: utf-8; -*- +################################################################################ +# +# Rattail -- Retail Software Framework +# Copyright © 2010-2024 Lance Edgar +# +# This file is part of Rattail. +# +# Rattail 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. +# +# Rattail 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 +# Rattail. If not, see . +# +################################################################################ +""" +Config extensions for rattail-mailchimp +""" + +from rattail.config import ConfigExtension + + +class MailchimpConfigExtension(ConfigExtension): + """ + Config extension for rattail-mailchimp + """ + key = 'rattail_mailchimp' + + def configure(self, config): + + # rattail import-mailchimp + config.setdefault('rattail.importing', 'to_rattail.from_mailchimp.import.default_handler', + 'rattail_mailchimp.importing.mailchimp:FromMailChimpToRattail') + config.setdefault('rattail.importing', 'to_rattail.from_mailchimp.import.default_cmd', + 'rattail import-mailchimp') diff --git a/setup.cfg b/setup.cfg index 9439cdf..8425cd6 100644 --- a/setup.cfg +++ b/setup.cfg @@ -35,6 +35,9 @@ zip_safe = False [options.entry_points] +rattail.config.extensions = + rattail_mailchimp = rattail_mailchimp.config:MailchimpConfigExtension + rattail.subcommands = import-mailchimp = rattail_mailchimp.commands:ImportMailChimp From 2ab7cf04c65288f23abae2b7764dcff3fa65f4e4 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Tue, 4 Jun 2024 17:22:10 -0500 Subject: [PATCH 09/19] Update changelog --- CHANGELOG.md | 4 ++++ rattail_mailchimp/_version.py | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a5c01c1..a5174d8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,10 @@ All notable changes to rattail-mailchimp will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). +## [0.2.1] - 2024-06-04 +### Changed +- Setup default handler for Mailchimp -> Rattail import. + ## [0.2.0] - 2024-06-03 ### Changed - Migrate all commands to use `typer`. diff --git a/rattail_mailchimp/_version.py b/rattail_mailchimp/_version.py index 08b390b..53d3efe 100644 --- a/rattail_mailchimp/_version.py +++ b/rattail_mailchimp/_version.py @@ -1,3 +1,3 @@ # -*- coding: utf-8; -*- -__version__ = '0.2.0' +__version__ = '0.2.1' From 7089ced72b3abe280fee34b56a461b2a824447a6 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Mon, 10 Jun 2024 22:04:05 -0500 Subject: [PATCH 10/19] feat: switch from setup.cfg to pyproject.toml + hatchling --- .gitignore | 3 ++ pyproject.toml | 58 +++++++++++++++++++++++++++++++++++ rattail_mailchimp/_version.py | 5 ++- setup.cfg | 48 ----------------------------- setup.py | 26 ---------------- tasks.py | 12 +++----- 6 files changed, 70 insertions(+), 82 deletions(-) create mode 100644 pyproject.toml delete mode 100644 setup.cfg delete mode 100644 setup.py diff --git a/.gitignore b/.gitignore index d6b84d0..f69dfd5 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,4 @@ +*~ +*.pyc +dist/ rattail_mailchimp.egg-info/ diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..31913de --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,58 @@ + +[build-system] +requires = ["hatchling"] +build-backend = "hatchling.build" + + +[project] +name = "rattail-mailchimp" +version = "0.2.1" +description = "Rattail Software Interfaces for MailChimp" +readme = "README.rst" +authors = [{name = "Lance Edgar", email = "lance@edbob.org"}] +license = {text = "GNU GPL v3+"} +classifiers = [ + "Development Status :: 4 - Beta", + "Environment :: Console", + "Environment :: Web Environment", + "Intended Audience :: Developers", + "License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)", + "Natural Language :: English", + "Operating System :: OS Independent", + "Programming Language :: Python", + "Programming Language :: Python :: 3", + "Topic :: Office/Business", + "Topic :: Software Development :: Libraries :: Python Modules", +] +dependencies = [ + "mailchimp3", + "rattail", +] + + +[project.entry-points."rattail.config.extensions"] +rattail_mailchimp = "rattail_mailchimp.config:MailchimpConfigExtension" + + +[project.entry-points."rattail.subcommands"] +import-mailchimp = "rattail_mailchimp.commands:ImportMailChimp" + + +[project.entry-points."rattail.typer_imports"] +rattail_mailchimp = "rattail_mailchimp.commands" + + +[project.entry-points."rattail.emails"] +rattail_mailchimp = "rattail_mailchimp.emails" + + +[project.urls] +Homepage = "https://rattailproject.org" +Repository = "https://kallithea.rattailproject.org/rattail-project/rattail-mailchimp" +Changelog = "https://kallithea.rattailproject.org/rattail-project/rattail-mailchimp/files/master/CHANGELOG.md" + + +[tool.commitizen] +version_provider = "pep621" +tag_format = "v$version" +update_changelog_on_bump = true diff --git a/rattail_mailchimp/_version.py b/rattail_mailchimp/_version.py index 53d3efe..1c3638a 100644 --- a/rattail_mailchimp/_version.py +++ b/rattail_mailchimp/_version.py @@ -1,3 +1,6 @@ # -*- coding: utf-8; -*- -__version__ = '0.2.1' +from importlib.metadata import version + + +__version__ = version('rattail-mailchimp') diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 8425cd6..0000000 --- a/setup.cfg +++ /dev/null @@ -1,48 +0,0 @@ -# -*- coding: utf-8; -*- - -[metadata] -name = rattail-mailchimp -version = attr: rattail_mailchimp.__version__ -author = Lance Edgar -author_email = lance@edbob.org -url = https://rattailproject.org/ -license = GNU GPL v3 -description = Rattail Software Interfaces for MailChimp -long_description = file: README.rst -classifiers = - Development Status :: 4 - Beta - Environment :: Console - Environment :: Web Environment - Intended Audience :: Developers - License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+) - Natural Language :: English - Operating System :: OS Independent - Programming Language :: Python - Programming Language :: Python :: 3 - Topic :: Office/Business - Topic :: Software Development :: Libraries :: Python Modules - - -[options] -install_requires = - mailchimp3 - rattail - -packages = find: -include_package_data = True -zip_safe = False - - -[options.entry_points] - -rattail.config.extensions = - rattail_mailchimp = rattail_mailchimp.config:MailchimpConfigExtension - -rattail.subcommands = - import-mailchimp = rattail_mailchimp.commands:ImportMailChimp - -rattail.typer_imports = - rattail_mailchimp = rattail_mailchimp.commands - -rattail.emails = - rattail_mailchimp = rattail_mailchimp.emails diff --git a/setup.py b/setup.py deleted file mode 100644 index 615bc06..0000000 --- a/setup.py +++ /dev/null @@ -1,26 +0,0 @@ -# -*- coding: utf-8; -*- -################################################################################ -# -# Rattail -- Retail Software Framework -# Copyright © 2010-2023 Lance Edgar -# -# This file is part of Rattail. -# -# Rattail 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. -# -# Rattail 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 -# Rattail. If not, see . -# -################################################################################ - -from setuptools import setup - -setup() diff --git a/tasks.py b/tasks.py index 577dd82..912f111 100644 --- a/tasks.py +++ b/tasks.py @@ -30,17 +30,15 @@ import shutil from invoke import task -here = os.path.abspath(os.path.dirname(__file__)) -exec(open(os.path.join(here, 'rattail_mailchimp', '_version.py')).read()) - - @task def release(c): """ Release a new version of 'rattail-mailchimp'. """ - shutil.rmtree('rattail_mailchimp.egg-info') + if os.path.exists('dist'): + shutil.rmtree('dist') + if os.path.exists('rattail_mailchimp.egg-info'): + shutil.rmtree('rattail_mailchimp.egg-info') c.run('python -m build --sdist') - filename = f'rattail_mailchimp-{__version__}.tar.gz' - c.run('twine upload dist/{}'.format(filename)) + c.run('twine upload dist/*') From f5b24562b4720c85e84462566686d5d7aedd95b5 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Mon, 10 Jun 2024 22:04:19 -0500 Subject: [PATCH 11/19] =?UTF-8?q?bump:=20version=200.2.1=20=E2=86=92=200.3?= =?UTF-8?q?.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 6 ++++++ pyproject.toml | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a5174d8..02a9c20 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to rattail-mailchimp will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). +## v0.3.0 (2024-06-10) + +### Feat + +- switch from setup.cfg to pyproject.toml + hatchling + ## [0.2.1] - 2024-06-04 ### Changed - Setup default handler for Mailchimp -> Rattail import. diff --git a/pyproject.toml b/pyproject.toml index 31913de..baf7baa 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,7 +6,7 @@ build-backend = "hatchling.build" [project] name = "rattail-mailchimp" -version = "0.2.1" +version = "0.3.0" description = "Rattail Software Interfaces for MailChimp" readme = "README.rst" authors = [{name = "Lance Edgar", email = "lance@edbob.org"}] From 39193bb27b51f09c2cfbd9cfe1bc24cff53acdd7 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Fri, 14 Jun 2024 17:30:53 -0500 Subject: [PATCH 12/19] fix: fallback to `importlib_metadata` on older python --- rattail_mailchimp/_version.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/rattail_mailchimp/_version.py b/rattail_mailchimp/_version.py index 1c3638a..1c2e56d 100644 --- a/rattail_mailchimp/_version.py +++ b/rattail_mailchimp/_version.py @@ -1,6 +1,9 @@ # -*- coding: utf-8; -*- -from importlib.metadata import version +try: + from importlib.metadata import version +except ImportError: + from importlib_metadata import version __version__ = version('rattail-mailchimp') From ac6efbb589cec3a6b5cdbe9a2d8491cc30661193 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Fri, 14 Jun 2024 17:31:52 -0500 Subject: [PATCH 13/19] =?UTF-8?q?bump:=20version=200.3.0=20=E2=86=92=200.3?= =?UTF-8?q?.1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 6 ++++++ pyproject.toml | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 02a9c20..80ca0d3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to rattail-mailchimp will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). +## v0.3.1 (2024-06-14) + +### Fix + +- fallback to `importlib_metadata` on older python + ## v0.3.0 (2024-06-10) ### Feat diff --git a/pyproject.toml b/pyproject.toml index baf7baa..302659e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,7 +6,7 @@ build-backend = "hatchling.build" [project] name = "rattail-mailchimp" -version = "0.3.0" +version = "0.3.1" description = "Rattail Software Interfaces for MailChimp" readme = "README.rst" authors = [{name = "Lance Edgar", email = "lance@edbob.org"}] From 42cddaf6c0738624584a3b4dae468be7aa046e09 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Mon, 1 Jul 2024 12:27:07 -0500 Subject: [PATCH 14/19] fix: remove legacy command definitions --- pyproject.toml | 4 ---- rattail_mailchimp/commands.py | 20 +------------------- 2 files changed, 1 insertion(+), 23 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 302659e..d5fc3b0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -34,10 +34,6 @@ dependencies = [ rattail_mailchimp = "rattail_mailchimp.config:MailchimpConfigExtension" -[project.entry-points."rattail.subcommands"] -import-mailchimp = "rattail_mailchimp.commands:ImportMailChimp" - - [project.entry-points."rattail.typer_imports"] rattail_mailchimp = "rattail_mailchimp.commands" diff --git a/rattail_mailchimp/commands.py b/rattail_mailchimp/commands.py index 629307d..bc3bdef 100644 --- a/rattail_mailchimp/commands.py +++ b/rattail_mailchimp/commands.py @@ -26,7 +26,7 @@ Rattail Commands for MailChimp integration import typer -from rattail.commands import rattail_typer, ImportSubcommand +from rattail.commands import rattail_typer from rattail.commands.typer import importer_command, typer_get_runas_user from rattail.commands.importing import ImportCommandHandler @@ -46,21 +46,3 @@ def import_mailchimp( config, import_handler_key='to_rattail.from_mailchimp.import') kwargs['user'] = typer_get_runas_user(ctx) handler.run(kwargs, progress=progress) - - -class ImportMailChimp(ImportSubcommand): - """ - Import data to Rattail, from MailChimp API - """ - name = 'import-mailchimp' - description = __doc__.strip() - default_handler_spec = 'rattail_mailchimp.importing.mailchimp:FromMailChimpToRattail' - - def get_handler_factory(self, **kwargs): - if self.config: - spec = self.config.get('rattail.importing', 'mailchimp.handler', - default=self.default_handler_spec) - else: - # just use default, for sake of cmd line help - spec = self.default_handler_spec - return self.app.load_object(spec) From 4f618e80ca46ab6ca3b141fcc96e50814597883c Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Mon, 1 Jul 2024 15:11:51 -0500 Subject: [PATCH 15/19] =?UTF-8?q?bump:=20version=200.3.1=20=E2=86=92=200.3?= =?UTF-8?q?.2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 6 ++++++ pyproject.toml | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 80ca0d3..dafe9f3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to rattail-mailchimp will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). +## v0.3.2 (2024-07-01) + +### Fix + +- remove legacy command definitions + ## v0.3.1 (2024-06-14) ### Fix diff --git a/pyproject.toml b/pyproject.toml index d5fc3b0..1c88935 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,7 +6,7 @@ build-backend = "hatchling.build" [project] name = "rattail-mailchimp" -version = "0.3.1" +version = "0.3.2" description = "Rattail Software Interfaces for MailChimp" readme = "README.rst" authors = [{name = "Lance Edgar", email = "lance@edbob.org"}] From ec3fd0b2fb9f24c05a762bc206b27efb0b5c1f9d Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Fri, 5 Jul 2024 10:08:00 -0500 Subject: [PATCH 16/19] fix: define `host_key` for MailChimp -> Rattail import --- rattail_mailchimp/importing/mailchimp.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/rattail_mailchimp/importing/mailchimp.py b/rattail_mailchimp/importing/mailchimp.py index 6c194fb..c5f9a35 100644 --- a/rattail_mailchimp/importing/mailchimp.py +++ b/rattail_mailchimp/importing/mailchimp.py @@ -2,7 +2,7 @@ ################################################################################ # # Rattail -- Retail Software Framework -# Copyright © 2010-2023 Lance Edgar +# Copyright © 2010-2024 Lance Edgar # # This file is part of Rattail. # @@ -30,7 +30,6 @@ from collections import OrderedDict from mailchimp3 import MailChimp from rattail import importing -from rattail.time import localtime, make_utc from rattail_mailchimp import importing as mailchimp_importing @@ -38,7 +37,9 @@ class FromMailChimpToRattail(importing.ToRattailHandler): """ Handler for MailChimp -> Rattail cache import """ + host_key = 'mailchimp' host_title = "MailChimp" + generic_host_title = "MailChimp" def get_importers(self): importers = OrderedDict() @@ -53,7 +54,7 @@ class FromMailChimp(importing.Importer): """ def setup(self): - super(FromMailChimp, self).setup() + super().setup() self.api_key = self.config.require('mailchimp', 'api_key') self.mailchimp = MailChimp(self.api_key) @@ -65,10 +66,10 @@ class FromMailChimp(importing.Importer): # issue..since we clearly have a UTC value value = value[:-6] dt = datetime.datetime.strptime(value, '%Y-%m-%dT%H:%M:%S') - dt = localtime(self.config, dt, from_utc=True) + dt = self.app.localtime(dt, from_utc=True) else: dt = datetime.datetime.strptime(value, '%Y-%m-%dT%H:%M:%S%z') - dt = localtime(self.config, dt) + dt = self.app.localtime(dt) return dt @@ -95,7 +96,7 @@ class MailChimpListImporter(FromMailChimp, mailchimp_importing.model.MailChimpLi return { 'id': mclist['id'], 'name': mclist['name'], - 'date_created': make_utc(date_created), + 'date_created': self.app.make_utc(date_created), } @@ -160,6 +161,6 @@ class MailChimpListMemberImporter(FromMailChimp, mailchimp_importing.model.MailC 'status': member['status'], # TODO: this API endpoint does not appear to include this field? # 'unsubscribe_reason': member.get('unsubscribe_reason'), - 'last_changed': make_utc(last_changed), + 'last_changed': self.app.make_utc(last_changed), 'source': member['source'], } From 3591b7e317f996b4118c3688a8a3719e8ad33b4f Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Fri, 5 Jul 2024 10:08:20 -0500 Subject: [PATCH 17/19] =?UTF-8?q?bump:=20version=200.3.2=20=E2=86=92=200.3?= =?UTF-8?q?.3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 6 ++++++ pyproject.toml | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dafe9f3..9009e56 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to rattail-mailchimp will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). +## v0.3.3 (2024-07-05) + +### Fix + +- define `host_key` for MailChimp -> Rattail import + ## v0.3.2 (2024-07-01) ### Fix diff --git a/pyproject.toml b/pyproject.toml index 1c88935..cd0bf7e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,7 +6,7 @@ build-backend = "hatchling.build" [project] name = "rattail-mailchimp" -version = "0.3.2" +version = "0.3.3" description = "Rattail Software Interfaces for MailChimp" readme = "README.rst" authors = [{name = "Lance Edgar", email = "lance@edbob.org"}] From 860355f8af00600334bdcfea24bf5b0af5bb9ec4 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Fri, 16 Aug 2024 10:12:47 -0500 Subject: [PATCH 18/19] fix: avoid deprecated base class for config extension --- rattail_mailchimp/config.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rattail_mailchimp/config.py b/rattail_mailchimp/config.py index 9005b78..4bad837 100644 --- a/rattail_mailchimp/config.py +++ b/rattail_mailchimp/config.py @@ -24,10 +24,10 @@ Config extensions for rattail-mailchimp """ -from rattail.config import ConfigExtension +from wuttjamaican.conf import WuttaConfigExtension -class MailchimpConfigExtension(ConfigExtension): +class MailchimpConfigExtension(WuttaConfigExtension): """ Config extension for rattail-mailchimp """ From b2113bcd88031fbae67dc5d5a48401e6ab90a9ca Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Fri, 13 Sep 2024 18:34:46 -0500 Subject: [PATCH 19/19] docs: use markdown for readme file --- README.md | 11 +++++++++++ README.rst | 14 -------------- pyproject.toml | 2 +- 3 files changed, 12 insertions(+), 15 deletions(-) create mode 100644 README.md delete mode 100644 README.rst diff --git a/README.md b/README.md new file mode 100644 index 0000000..5b17139 --- /dev/null +++ b/README.md @@ -0,0 +1,11 @@ + +# rattail_mailchimp + +Rattail is a retail software framework, released under the GNU General +Public License. + +This package contains software interfaces for the +[MailChimp](https://mailchimp.com/) system. + +Please see the [Rattail Project](https://rattailproject.org/) for more +information. diff --git a/README.rst b/README.rst deleted file mode 100644 index 25dc9c3..0000000 --- a/README.rst +++ /dev/null @@ -1,14 +0,0 @@ - -rattail_mailchimp -================= - -Rattail is a retail software framework, released under the GNU General -Public License. - -This package contains software interfaces for the `MailChimp`_ system. - -.. _`MailChimp`: https://mailchimp.com/ - -Please see the `Rattail Project`_ for more information. - -.. _`Rattail Project`: https://rattailproject.org/ diff --git a/pyproject.toml b/pyproject.toml index cd0bf7e..335d26c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -8,7 +8,7 @@ build-backend = "hatchling.build" name = "rattail-mailchimp" version = "0.3.3" description = "Rattail Software Interfaces for MailChimp" -readme = "README.rst" +readme = "README.md" authors = [{name = "Lance Edgar", email = "lance@edbob.org"}] license = {text = "GNU GPL v3+"} classifiers = [