scrapinghub / scrapinghub/dateparser

Adding `DEBUG_INFO` setting

Open
#560 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Type: Enhancement
Dominant language
Python
Stars
2.9k
Forks
520
Avg merge
22h 56m
Merged PRs (30d)
6

Description

I was thinking about how to improve the "debugging" process when weird things happen...

And I realized that it could be really useful to add an option to "see" what happens behind the scenes. It could be, for example, a setting called DEBUG_INFO that when True shows relevant information to help you to understand what's happening.

I was trying a little and that's what I got.


Input:

dateparser.parse('07/03/2009')

Log:

Interpretation: 07 - 03 - 2009
Order: month, day, year
Used locale: en

Out:

2009-07-03 00:00:00

Input:

dateparser.parse('2009')

Log:

Missing: Day, Month
Interpretation: 2009
Order: year
Used locale: en

Out:

2009-09-05 00:00:00

Input:

dateparser.parse('Feb 2009')

Log:

Missing: Day
Interpretation: february - 2009
Order: year
Used locale: en

Out:

2009-02-05 00:00:00

Input:

dateparser.parse('07/03/2009', locales=['fr'])

Log:

Interpretation: 07 - 03 - 2009
Order: day, month, year
Used locale: fr

Out:

2009-03-07 00:00:00

Input:

dateparser.parse('en 2 días')

Log:

Used locale: es

Out:

2019-09-07 17:46:02.653798

Of course there are a lot of new information that could appear in the log, that's just an idea.

What do you think?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Review the issue's proposed DEBUG_INFO examples and determine the intended scope of the setting, including which parsing details it should expose and how users would enable it. Before implementation, define acceptance criteria for the logged information and its output behavior; the issue names no files or tests to run.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.