Skip to content

Comments

Clean date function for TargetExtra#30

Open
brendanrmills wants to merge 4 commits intoTOMToolkit:mainfrom
brendanrmills:main
Open

Clean date function for TargetExtra#30
brendanrmills wants to merge 4 commits intoTOMToolkit:mainfrom
brendanrmills:main

Conversation

@brendanrmills
Copy link

I noticed that if you wanted to save the contents of an alert into a bunch of TargetExtra objects to keep track of the parameters, the TargetExtra class would throw a RuntimeWarning

/home/bmills/bmillsWork/tom_test/new_venv/lib/python3.9/site-packages/django/db/models/fields/__init__.py:1534: RuntimeWarning:
DateTimeField TargetExtra.time_value received a naive datetime (2018-07-07 08:25:56.001000) while time zone support is active.
This was because TargetExtra casts the date as a datetime but it is common for django projects to require timezone information. This was fixed by adding a clean_date() method that just appends ' UTC' to the end of the firstdate and lastdate. I also wrote a small testing function to verify this.

@JulienPeloton
Copy link
Collaborator

Hi @brendanrmills -- many thanks for checking, and for the update!

Actually, it's been a while I did not run a query -- but the team should resume soon on using the module for follow-up, so we will inspect carefully and add new features that we recently discussed.

from tom_fink.fink import FinkBroker
# from tom_fink.fink import FinkQueryForm, FinkBroker

test_alert1 = {,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo: there should not be comma here

@phycodurus phycodurus self-assigned this Oct 31, 2022
@jchate6 jchate6 self-assigned this Mar 10, 2023
@jchate6
Copy link
Contributor

jchate6 commented Mar 13, 2023

@brendanrmills and @JulienPeloton Is this PR still live?

@rachel3834
Copy link

Please merge this PR if there are no conflicts

@jchate6 jchate6 self-requested a review January 17, 2024 19:03
@JulienPeloton
Copy link
Collaborator

I would be tempted to merge the changes. However the CI is failing, and the fail happens early, at the metadata generation for the package:

× python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [30 lines of output]
      /opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/site-packages/setuptools/__init__.py:80: _DeprecatedInstaller: setuptools.installer and fetch_build_eggs are deprecated.
      !!
      
              ********************************************************************************
              Requirements should be satisfied by a PEP 517 installer.
              If you are using pip, you can try `pip install --use-pep517`.
              ********************************************************************************
      
      !!
        dist.fetch_build_eggs(dist.setup_requires)
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/home/runner/work/tom_fink/tom_fink/setup.py", line 25, in <module>
          setup(
        File "/opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/site-packages/setuptools/__init__.py", line 103, in setup
          return distutils.core.setup(**attrs)
        File "/opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/site-packages/setuptools/_distutils/core.py", line 147, in setup
          _setup_distribution = dist = klass(attrs)
        File "/opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/site-packages/setuptools/dist.py", line 303, in __init__
          _Distribution.__init__(self, dist_attrs)
        File "/opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/site-packages/setuptools/_distutils/dist.py", line 283, in __init__
          self.finalize_options()
        File "/opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/site-packages/setuptools/dist.py", line 654, in finalize_options
          ep(self)
        File "/opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/site-packages/setuptools/dist.py", line 674, in _finalize_setup_keywords
          ep.load()(self, ep.name, value)
        File "/home/runner/work/tom_fink/tom_fink/.eggs/setuptools_scm-8.0.4-py3.8.egg/setuptools_scm/_integration/setuptools.py", line 80, in version_keyword
          assert isinstance(value, dict), "version_keyword expects a dict or True"
      AssertionError: version_keyword expects a dict or True
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

I would log the error, and investigate in a separate branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Data Services Data Services User Issue Raised by a user

Projects

Status: Needs Review

Development

Successfully merging this pull request may close these issues.

5 participants