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

Refactor v1 incompatibility warning #2100

Merged
merged 4 commits into from
Nov 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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 RELEASE.rst
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ How to release a new version of Holidays
- send "Holidays 'v<version>' has been released!" (or similar) message
to Vacanza Team Slack #release channel
- pull the recent changes from ``main`` branch into ``dev``
- bump the Holidays version at ``holidays/__init__.py`` file
- bump the Holidays version at ``holidays/version.py`` file
- create a commit with 'Initialize v<version>' message, e.g.
'Initialize v0.40' and push it to ``dev`` branch (this may require
running ``make package`` to pass the tests locally)
Expand Down
18 changes: 3 additions & 15 deletions holidays/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,26 +10,14 @@
# Website: https://github.com/vacanza/holidays
# License: MIT (see LICENSE file)

# flake8: noqa: F403

import warnings
# ruff: noqa: F403

from holidays.constants import *
from holidays.deprecation import (
FUTURE_INCOMPATIBILITY_WARNING_TEMPLATE,
FutureIncompatibilityWarning,
)
from holidays.deprecations.v1_incompatibility import *
from holidays.holiday_base import *
from holidays.registry import EntityLoader
from holidays.utils import *

__version__ = "0.60"

from holidays.version import __version__ # noqa: F401

EntityLoader.load("countries", globals())
EntityLoader.load("financial", globals())

warnings.warn(
FUTURE_INCOMPATIBILITY_WARNING_TEMPLATE.format(version=__version__),
FutureIncompatibilityWarning,
)
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,13 @@
# Website: https://github.com/vacanza/holidays
# License: MIT (see LICENSE file)

import warnings

from holidays.version import __version__

FUTURE_INCOMPATIBILITY_WARNING_TEMPLATE = """

This is a future version incompatibility warning from Holidays library v{version}
This is a future version incompatibility warning from Holidays v{version}
to inform you about an upcoming change in our API versioning strategy that may affect your
project's dependencies. Starting from version 1.0 onwards, we will be following a loose form of
Semantic Versioning (SemVer, https://semver.org) to provide clearer communication regarding any
Expand All @@ -22,7 +26,7 @@
updates that introduce breaking changes to our API. To ensure the stability of your projects,
we highly recommend pinning the version of our API that you rely on. You can pin your current
holidays v0.x dependency (e.g., holidays=={version}) or limit it (e.g., holidays<1.0) in order to
avoid potentially unwanted upgrade to the version 1.0 when it's released (ETA 2024Q4 - 2025Q1).
avoid potentially unwanted upgrade to the version 1.0 when it's released (ETA 2025Q1-Q2).

If you have any questions or concerns regarding this change, please don't hesitate to reach out
to us via https://github.com/vacanza/holidays/discussions/1800.
Expand All @@ -31,3 +35,9 @@

class FutureIncompatibilityWarning(DeprecationWarning):
pass


warnings.warn(
FUTURE_INCOMPATIBILITY_WARNING_TEMPLATE.format(version=__version__),
FutureIncompatibilityWarning,
)
13 changes: 13 additions & 0 deletions holidays/version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# holidays
# --------
# A fast, efficient Python library for generating country, province and state
# specific sets of holidays on the fly. It aims to make determining whether a
# specific date is a holiday as fast and flexible as possible.
#
# Authors: Vacanza Team and individual contributors (see AUTHORS file)
# dr-prodigy <dr.prodigy.github@gmail.com> (c) 2017-2023
# ryanss <ryanssdev@icloud.com> (c) 2014-2017
# Website: https://github.com/vacanza/holidays
# License: MIT (see LICENSE file)

__version__ = "0.60"
5 changes: 2 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -83,16 +83,15 @@ disable_error_code = "attr-defined"

[tool.pytest.ini_options]
filterwarnings = [
"ignore::DeprecationWarning:holidays",
"ignore::DeprecationWarning:xdist",
"ignore::DeprecationWarning:holidays.deprecations.v1_incompatibility",
]

[tool.rstcheck]
ignore_directives = ["automodule", "autosummary"]
ignore_languages = ["python"]

[tool.setuptools.dynamic]
version = { attr = "holidays.__version__" }
version = { attr = "holidays.version.__version__" }

[tool.setuptools.packages.find]
include = ["holidays*"]