Compare commits
No commits in common. "master" and "v0.2.0" have entirely different histories.
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -1,4 +1 @@
|
||||||
*~
|
|
||||||
*.pyc
|
|
||||||
dist/
|
|
||||||
rattail_mailchimp.egg-info/
|
rattail_mailchimp.egg-info/
|
||||||
|
|
28
CHANGELOG.md
28
CHANGELOG.md
|
@ -5,34 +5,6 @@ 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/)
|
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).
|
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
|
|
||||||
|
|
||||||
- remove legacy command definitions
|
|
||||||
|
|
||||||
## v0.3.1 (2024-06-14)
|
|
||||||
|
|
||||||
### Fix
|
|
||||||
|
|
||||||
- fallback to `importlib_metadata` on older python
|
|
||||||
|
|
||||||
## 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.
|
|
||||||
|
|
||||||
## [0.2.0] - 2024-06-03
|
## [0.2.0] - 2024-06-03
|
||||||
### Changed
|
### Changed
|
||||||
- Migrate all commands to use `typer`.
|
- Migrate all commands to use `typer`.
|
||||||
|
|
11
README.md
11
README.md
|
@ -1,11 +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](https://mailchimp.com/) system.
|
|
||||||
|
|
||||||
Please see the [Rattail Project](https://rattailproject.org/) for more
|
|
||||||
information.
|
|
14
README.rst
Normal file
14
README.rst
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
|
||||||
|
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/
|
|
@ -1,54 +0,0 @@
|
||||||
|
|
||||||
[build-system]
|
|
||||||
requires = ["hatchling"]
|
|
||||||
build-backend = "hatchling.build"
|
|
||||||
|
|
||||||
|
|
||||||
[project]
|
|
||||||
name = "rattail-mailchimp"
|
|
||||||
version = "0.3.3"
|
|
||||||
description = "Rattail Software Interfaces for MailChimp"
|
|
||||||
readme = "README.md"
|
|
||||||
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.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
|
|
|
@ -1,9 +1,3 @@
|
||||||
# -*- coding: utf-8; -*-
|
# -*- coding: utf-8; -*-
|
||||||
|
|
||||||
try:
|
__version__ = '0.2.0'
|
||||||
from importlib.metadata import version
|
|
||||||
except ImportError:
|
|
||||||
from importlib_metadata import version
|
|
||||||
|
|
||||||
|
|
||||||
__version__ = version('rattail-mailchimp')
|
|
||||||
|
|
|
@ -26,7 +26,7 @@ Rattail Commands for MailChimp integration
|
||||||
|
|
||||||
import typer
|
import typer
|
||||||
|
|
||||||
from rattail.commands import rattail_typer
|
from rattail.commands import rattail_typer, ImportSubcommand
|
||||||
from rattail.commands.typer import importer_command, typer_get_runas_user
|
from rattail.commands.typer import importer_command, typer_get_runas_user
|
||||||
from rattail.commands.importing import ImportCommandHandler
|
from rattail.commands.importing import ImportCommandHandler
|
||||||
|
|
||||||
|
@ -46,3 +46,21 @@ def import_mailchimp(
|
||||||
config, import_handler_key='to_rattail.from_mailchimp.import')
|
config, import_handler_key='to_rattail.from_mailchimp.import')
|
||||||
kwargs['user'] = typer_get_runas_user(ctx)
|
kwargs['user'] = typer_get_runas_user(ctx)
|
||||||
handler.run(kwargs, progress=progress)
|
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)
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
################################################################################
|
################################################################################
|
||||||
#
|
#
|
||||||
# Rattail -- Retail Software Framework
|
# Rattail -- Retail Software Framework
|
||||||
# Copyright © 2010-2024 Lance Edgar
|
# Copyright © 2010-2023 Lance Edgar
|
||||||
#
|
#
|
||||||
# This file is part of Rattail.
|
# This file is part of Rattail.
|
||||||
#
|
#
|
||||||
|
@ -30,6 +30,7 @@ from collections import OrderedDict
|
||||||
from mailchimp3 import MailChimp
|
from mailchimp3 import MailChimp
|
||||||
|
|
||||||
from rattail import importing
|
from rattail import importing
|
||||||
|
from rattail.time import localtime, make_utc
|
||||||
from rattail_mailchimp import importing as mailchimp_importing
|
from rattail_mailchimp import importing as mailchimp_importing
|
||||||
|
|
||||||
|
|
||||||
|
@ -37,9 +38,7 @@ class FromMailChimpToRattail(importing.ToRattailHandler):
|
||||||
"""
|
"""
|
||||||
Handler for MailChimp -> Rattail cache import
|
Handler for MailChimp -> Rattail cache import
|
||||||
"""
|
"""
|
||||||
host_key = 'mailchimp'
|
|
||||||
host_title = "MailChimp"
|
host_title = "MailChimp"
|
||||||
generic_host_title = "MailChimp"
|
|
||||||
|
|
||||||
def get_importers(self):
|
def get_importers(self):
|
||||||
importers = OrderedDict()
|
importers = OrderedDict()
|
||||||
|
@ -54,7 +53,7 @@ class FromMailChimp(importing.Importer):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def setup(self):
|
def setup(self):
|
||||||
super().setup()
|
super(FromMailChimp, self).setup()
|
||||||
|
|
||||||
self.api_key = self.config.require('mailchimp', 'api_key')
|
self.api_key = self.config.require('mailchimp', 'api_key')
|
||||||
self.mailchimp = MailChimp(self.api_key)
|
self.mailchimp = MailChimp(self.api_key)
|
||||||
|
@ -66,10 +65,10 @@ class FromMailChimp(importing.Importer):
|
||||||
# issue..since we clearly have a UTC value
|
# issue..since we clearly have a UTC value
|
||||||
value = value[:-6]
|
value = value[:-6]
|
||||||
dt = datetime.datetime.strptime(value, '%Y-%m-%dT%H:%M:%S')
|
dt = datetime.datetime.strptime(value, '%Y-%m-%dT%H:%M:%S')
|
||||||
dt = self.app.localtime(dt, from_utc=True)
|
dt = localtime(self.config, dt, from_utc=True)
|
||||||
else:
|
else:
|
||||||
dt = datetime.datetime.strptime(value, '%Y-%m-%dT%H:%M:%S%z')
|
dt = datetime.datetime.strptime(value, '%Y-%m-%dT%H:%M:%S%z')
|
||||||
dt = self.app.localtime(dt)
|
dt = localtime(self.config, dt)
|
||||||
return dt
|
return dt
|
||||||
|
|
||||||
|
|
||||||
|
@ -96,7 +95,7 @@ class MailChimpListImporter(FromMailChimp, mailchimp_importing.model.MailChimpLi
|
||||||
return {
|
return {
|
||||||
'id': mclist['id'],
|
'id': mclist['id'],
|
||||||
'name': mclist['name'],
|
'name': mclist['name'],
|
||||||
'date_created': self.app.make_utc(date_created),
|
'date_created': make_utc(date_created),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -161,6 +160,6 @@ class MailChimpListMemberImporter(FromMailChimp, mailchimp_importing.model.MailC
|
||||||
'status': member['status'],
|
'status': member['status'],
|
||||||
# TODO: this API endpoint does not appear to include this field?
|
# TODO: this API endpoint does not appear to include this field?
|
||||||
# 'unsubscribe_reason': member.get('unsubscribe_reason'),
|
# 'unsubscribe_reason': member.get('unsubscribe_reason'),
|
||||||
'last_changed': self.app.make_utc(last_changed),
|
'last_changed': make_utc(last_changed),
|
||||||
'source': member['source'],
|
'source': member['source'],
|
||||||
}
|
}
|
||||||
|
|
45
setup.cfg
Normal file
45
setup.cfg
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
# -*- 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.subcommands =
|
||||||
|
import-mailchimp = rattail_mailchimp.commands:ImportMailChimp
|
||||||
|
|
||||||
|
rattail.typer_imports =
|
||||||
|
rattail_mailchimp = rattail_mailchimp.commands
|
||||||
|
|
||||||
|
rattail.emails =
|
||||||
|
rattail_mailchimp = rattail_mailchimp.emails
|
|
@ -2,7 +2,7 @@
|
||||||
################################################################################
|
################################################################################
|
||||||
#
|
#
|
||||||
# Rattail -- Retail Software Framework
|
# Rattail -- Retail Software Framework
|
||||||
# Copyright © 2010-2024 Lance Edgar
|
# Copyright © 2010-2023 Lance Edgar
|
||||||
#
|
#
|
||||||
# This file is part of Rattail.
|
# This file is part of Rattail.
|
||||||
#
|
#
|
||||||
|
@ -20,23 +20,7 @@
|
||||||
# Rattail. If not, see <http://www.gnu.org/licenses/>.
|
# Rattail. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#
|
#
|
||||||
################################################################################
|
################################################################################
|
||||||
"""
|
|
||||||
Config extensions for rattail-mailchimp
|
|
||||||
"""
|
|
||||||
|
|
||||||
from wuttjamaican.conf import WuttaConfigExtension
|
from setuptools import setup
|
||||||
|
|
||||||
|
setup()
|
||||||
class MailchimpConfigExtension(WuttaConfigExtension):
|
|
||||||
"""
|
|
||||||
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')
|
|
18
tasks.py
18
tasks.py
|
@ -2,7 +2,7 @@
|
||||||
################################################################################
|
################################################################################
|
||||||
#
|
#
|
||||||
# Rattail -- Retail Software Framework
|
# Rattail -- Retail Software Framework
|
||||||
# Copyright © 2010-2024 Lance Edgar
|
# Copyright © 2010-2022 Lance Edgar
|
||||||
#
|
#
|
||||||
# This file is part of Rattail.
|
# This file is part of Rattail.
|
||||||
#
|
#
|
||||||
|
@ -30,15 +30,17 @@ import shutil
|
||||||
from invoke import task
|
from invoke import task
|
||||||
|
|
||||||
|
|
||||||
|
here = os.path.abspath(os.path.dirname(__file__))
|
||||||
|
exec(open(os.path.join(here, 'rattail_mailchimp', '_version.py')).read())
|
||||||
|
|
||||||
|
|
||||||
@task
|
@task
|
||||||
def release(c):
|
def release(ctx):
|
||||||
"""
|
"""
|
||||||
Release a new version of 'rattail-mailchimp'.
|
Release a new version of 'rattail-mailchimp'.
|
||||||
"""
|
"""
|
||||||
if os.path.exists('dist'):
|
shutil.rmtree('rattail_mailchimp.egg-info')
|
||||||
shutil.rmtree('dist')
|
ctx.run('python -m build --sdist')
|
||||||
if os.path.exists('rattail_mailchimp.egg-info'):
|
|
||||||
shutil.rmtree('rattail_mailchimp.egg-info')
|
|
||||||
c.run('python -m build --sdist')
|
|
||||||
|
|
||||||
c.run('twine upload dist/*')
|
filename = 'rattail-mailchimp-{}.tar.gz'.format(__version__)
|
||||||
|
ctx.run('twine upload dist/{}'.format(filename))
|
||||||
|
|
Loading…
Reference in a new issue