jinja2-time icon indicating copy to clipboard operation
jinja2-time copied to clipboard

Drop arrow

Open pganssle opened this issue 7 years ago • 7 comments
trafficstars

From what I can tell, arrow is effectively unmaintained at this point or nearly so, and does not have their trove classifiers set up to support Python 3.6. We were packaging cookiecutter for Python 3.6 and realized that this is the main blocker on explicit support for Python 3.6.

Since the main things jinja2_time is using arrow for is as (mostly) a thin wrapper around python-dateutil, it is easy enough to cut out the unmaintained middleman in favor of using python-dateutil directly. I believe that this PR should maintain the same API.

(Note that arrow has also deprecated the use of relative keywords in replace anyway, so the replace parts of this need to change anyway).

pganssle avatar Jan 02 '18 18:01 pganssle

@hackebrot I think the CI failure is something to do with the way you're running tox. Recently @gaborbernat set up tox/travis over on dateutil, and I believe the way he did it was to have tox always execute with environment py (which uses the interpreter that was used to invoke tox), rather than executing each environment separately using the same Python interpreter. I suspect that approach will fix this issue.

pganssle avatar Jan 02 '18 18:01 pganssle

Ping @hackebrot

pydanny avatar May 07 '18 03:05 pydanny

It seems Arrow is now maintained again.

vincentbernat avatar Nov 03 '19 07:11 vincentbernat

Even if Arrow is maintained again, it would probably still be a good idea to drop the dependency since it's not really necessary.

pganssle avatar Nov 04 '19 15:11 pganssle

I'm happy to drop arrow from jinja2-time if we can do that without causing breakage for cookiecutter users. 🍪

hackebrot avatar Nov 04 '19 15:11 hackebrot

I don't see why it would, the current version passes all the tests and replicates the functionality that arrow is providing. The tests seemed like they were failing, but it seems like that was unrelated to my change.

I've rebased against master, let's see if it fixes the tests.

pganssle avatar Nov 04 '19 15:11 pganssle

Hi @pganssle! Thanks for your patch! There are some problems with the _TZOFFSET_MATCH regex in this patch:

  • Recent versions of Python (at least >= 3.9, possibly earlier) have deprecated \d within a regex unless the backslash is escaped; this is easy to fix by writing re.compile(r'(?... making the string a raw string (so backslashes are not treated specially)
  • The regex ends with ^; I presume this should be $ instead
  • Being pedantic, \d matches any Unicode digit character, but should probably only match [0-9]. This is probably fine to ignore, or alternatively add flags=re.ASCII to restrict the meaning of \d.

juliangilbey avatar Nov 30 '21 08:11 juliangilbey