Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrading Dependencies #516

Open
wants to merge 30 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
d5290dc
Refactoring Dependencies to drop 3.7 and 3.8 support
TheBurchLog Nov 1, 2024
a149fae
Update pr actions to include 3.12 and 3.13
TheBurchLog Nov 1, 2024
5fdaca3
fixing UTC usage
TheBurchLog Nov 1, 2024
083c245
Migrate to new date time field
TheBurchLog Nov 4, 2024
621e13c
Fixed Marshmallow
TheBurchLog Nov 4, 2024
f0e4b6d
Remove Metadata for legacy marshmallow schemas
TheBurchLog Nov 4, 2024
35698fd
removed legacy test
TheBurchLog Nov 4, 2024
957bf8f
Removing pytz dependency
TheBurchLog Nov 4, 2024
284a0bf
replaced utcnow() function
TheBurchLog Nov 4, 2024
53c7b33
Fixed now utc
TheBurchLog Nov 5, 2024
abae4ab
Raw fields as many
TheBurchLog Nov 5, 2024
91d720b
Reverted to legacy datatime object
TheBurchLog Nov 6, 2024
b8d7e69
fixed imports
TheBurchLog Nov 6, 2024
80e0116
add float support for epoch
TheBurchLog Nov 6, 2024
fae7b8c
Set Timezone
TheBurchLog Nov 13, 2024
cc5f8c5
Adding to_epoch support for timezones
TheBurchLog Nov 13, 2024
5e83310
Update fixtures.py
TheBurchLog Nov 13, 2024
4b18147
Update fixtures.py
TheBurchLog Nov 13, 2024
35c309a
Merge branch 'develop' into python_3_9_support
TheBurchLog Nov 21, 2024
3b87309
Updating Timezone Defaults
TheBurchLog Nov 22, 2024
07cfdca
Updating Testing
TheBurchLog Nov 22, 2024
e580283
Merge branch 'develop' into python_3_9_support
TheBurchLog Dec 2, 2024
8161380
Adding strict feature for parsing
TheBurchLog Dec 3, 2024
4edbb37
load valid data
TheBurchLog Dec 3, 2024
3531482
return valid data
TheBurchLog Dec 3, 2024
17875b0
logging
TheBurchLog Dec 3, 2024
fa87a9b
exclude unknown fields
TheBurchLog Dec 3, 2024
dbe77f4
exclude unknown fields
TheBurchLog Dec 3, 2024
7d074e1
formatting
TheBurchLog Dec 11, 2024
c93f194
Merge branch 'develop' into python_3_9_support
TheBurchLog Dec 17, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/pr-actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: [ '3.8', '3.9', '3.10', '3.11']
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13']
os: ['ubuntu-latest']
name: PyTests OS ${{ matrix.os }} - Python ${{ matrix.python-version }}
steps:
Expand Down
33 changes: 19 additions & 14 deletions brewtils/models.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# -*- coding: utf-8 -*-

import copy
from datetime import datetime
from datetime import datetime, timezone
from enum import Enum
from zoneinfo import ZoneInfo

import pytz # noqa # not in requirements file
import six # noqa # not in requirements file

from brewtils.errors import ModelError, _deprecate
Expand Down Expand Up @@ -468,7 +468,7 @@ def __init__(self, heartbeat=None, history=None):

def set_status_heartbeat(self, status, max_history=None):

self.heartbeat = datetime.utcnow()
self.heartbeat = datetime.now(timezone.utc)
self.history.append(
StatusHistory(status=copy.deepcopy(status), heartbeat=self.heartbeat)
)
Expand Down Expand Up @@ -1264,7 +1264,7 @@ def __repr__(self):
class DateTrigger(BaseModel):
schema = "DateTriggerSchema"

def __init__(self, run_date=None, timezone=None):
def __init__(self, run_date=None, timezone="UTC"):
self.run_date = run_date
self.timezone = timezone

Expand All @@ -1280,9 +1280,10 @@ def scheduler_attributes(self):

@property
def scheduler_kwargs(self):
tz = pytz.timezone(self.timezone)

return {"timezone": tz, "run_date": tz.localize(self.run_date)}
tz = ZoneInfo(self.timezone.upper())

return {"timezone": tz, "run_date": self.run_date.replace(tzinfo=tz)}


class IntervalTrigger(BaseModel):
Expand All @@ -1297,7 +1298,7 @@ def __init__(
seconds=None,
start_date=None,
end_date=None,
timezone=None,
timezone="UTC",
jitter=None,
reschedule_on_finish=None,
):
Expand Down Expand Up @@ -1339,14 +1340,16 @@ def scheduler_attributes(self):

@property
def scheduler_kwargs(self):
tz = pytz.timezone(self.timezone)
tz = ZoneInfo(self.timezone.upper())

kwargs = {key: getattr(self, key) for key in self.scheduler_attributes}
kwargs.update(
{
"timezone": tz,
"start_date": tz.localize(self.start_date) if self.start_date else None,
"end_date": tz.localize(self.end_date) if self.end_date else None,
"start_date": (
self.start_date.replace(tzinfo=tz) if self.start_date else None
),
"end_date": self.end_date.replace(tzinfo=tz) if self.end_date else None,
}
)

Expand All @@ -1368,7 +1371,7 @@ def __init__(
second=None,
start_date=None,
end_date=None,
timezone=None,
timezone="UTC",
jitter=None,
):
self.year = year
Expand Down Expand Up @@ -1415,14 +1418,16 @@ def scheduler_attributes(self):

@property
def scheduler_kwargs(self):
tz = pytz.timezone(self.timezone)
tz = ZoneInfo(self.timezone.upper())

kwargs = {key: getattr(self, key) for key in self.scheduler_attributes}
kwargs.update(
{
"timezone": tz,
"start_date": tz.localize(self.start_date) if self.start_date else None,
"end_date": tz.localize(self.end_date) if self.end_date else None,
"start_date": (
self.start_date.replace(tzinfo=tz) if self.start_date else None
),
"end_date": self.end_date.replace(tzinfo=tz) if self.end_date else None,
}
)

Expand Down
8 changes: 4 additions & 4 deletions brewtils/schema_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -370,9 +370,9 @@ def parse_job_ids(cls, job_id_json, from_string=False, **kwargs):
schema = brewtils.schemas.JobExportInputSchema(**kwargs)

if from_string:
return schema.loads(job_id_json).data
return schema.loads(job_id_json)
else:
return schema.load(job_id_json).data
return schema.load(job_id_json)

@classmethod
def parse_garden(cls, garden, from_string=False, **kwargs):
Expand Down Expand Up @@ -561,7 +561,7 @@ def parse(

schema.context["models"] = cls._models

return schema.loads(data).data if from_string else schema.load(data).data
return schema.loads(data) if from_string else schema.load(data)

# Serialization methods
@classmethod
Expand Down Expand Up @@ -1162,7 +1162,7 @@ def serialize(

schema = getattr(brewtils.schemas, schema_name)(**kwargs)

return schema.dumps(model).data if to_string else schema.dump(model).data
return schema.dumps(model) if to_string else schema.dump(model)

# Explicitly force to_string to False so only original call returns a string
multiple = [
Expand Down
Loading
Loading