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

Epoch - unix timestamp #240

Merged
merged 7 commits into from
Nov 20, 2024
Merged

Epoch - unix timestamp #240

merged 7 commits into from
Nov 20, 2024

Conversation

commonism
Copy link
Contributor

using type float, format: date-time to serialize datetime.datetime

fix #238

using type float, format: date-time to serialize datetime.datetime
Copy link

codecov bot commented Nov 16, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (e186814) to head (e4becc9).
Report is 55 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##              main      #240    +/-   ##
==========================================
  Coverage   100.00%   100.00%            
==========================================
  Files           11        20     +9     
  Lines          685      1085   +400     
  Branches       169       257    +88     
==========================================
+ Hits           685      1085   +400     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.


🚨 Try these New Features:

tests/test_epoch.py:5: in <module>
    from pydantic_extra_types import epoch
pydantic_extra_types/epoch.py:12: in <module>
    class _Base(datetime.datetime):
pydantic_extra_types/epoch.py:27: in _Base
    cls, source: type[Any], handler: Callable[[Any], CoreSchema]
E   TypeError: 'type' object is not subscriptable
Copy link
Collaborator

@yezz123 yezz123 left a comment

Choose a reason for hiding this comment

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

Hello @commonism Thank you for your PR 🙌🏻

I have two little comments one for the docstring & the other one for adding the JSON schema test here: https://github.com/pydantic/pydantic-extra-types/blob/main/tests/test_json_schema.py

pydantic_extra_types/epoch.py Show resolved Hide resolved
@commonism commonism requested a review from yezz123 November 20, 2024 18:56
@yezz123 yezz123 merged commit 3668b3a into pydantic:main Nov 20, 2024
20 checks passed
@commonism commonism deleted the epoch branch November 21, 2024 05:31
yezz123 pushed a commit that referenced this pull request Nov 21, 2024
yezz123 added a commit that referenced this pull request Nov 26, 2024
* ♻️ Migrate Pydantic Extra Types to use uv

* ♻️ Update CI workflow and Makefile to remove pyright and install extra dependencies

* ♻️ Update CI workflow to use uv for installing extra dependencies and remove typecheck from pre-commit config

* ✨ add new type: Epoch Unix Timestamp (#240)

* ✨ Fix formatting in epoch.py log entry comment

* 🎨  Add blank line for improved readability in epoch

* ♻️ Refactor dependency management in pyproject.toml and Makefile; update CI workflow for improved linting and coverage

* ♻️ Refactor CI workflow and dependency management; unify optional dependencies under 'all' and 'extra'

* ✨ Add step to install all extra dependencies in CI workflow

---------

Co-authored-by: commonism <[email protected]>
commonism added a commit to commonism/aiopenapi3 that referenced this pull request Nov 29, 2024
have a datatype for epoch datetimes
type:integer/number with format:date-time is datetime

c.f. pydantic/pydantic-extra-types#240
commonism added a commit to commonism/aiopenapi3 that referenced this pull request Nov 29, 2024
* v20/v3x - epoch datetime values

have a datatype for epoch datetimes
type:integer/number with format:date-time is datetime

c.f. pydantic/pydantic-extra-types#240
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

data type for unix timestamp - Epoch
2 participants