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

Update package configuration: migrate to pyproject.toml #1466

Merged
merged 9 commits into from
Sep 22, 2023
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
5 changes: 0 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,6 @@ repos:
hooks:
- id: tox-ini-fmt

- repo: https://github.com/asottile/setup-cfg-fmt
rev: v2.4.0
hooks:
- id: setup-cfg-fmt

- repo: local
hooks:
- id: tests
Expand Down
11 changes: 7 additions & 4 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
include CHANGES
include holidays/py.typed
include CONTRIBUTING.rst
include Makefile

recursive-include docs *
recursive-include holidays *.py
recursive-include holidays/locale *.mo
recursive-include holidays/locale *.po
recursive-include scripts/l10n *.py
recursive-include tests *.py
recursive-include requirements *

prune docs/build
prune tests
4 changes: 2 additions & 2 deletions holidays/holiday_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -579,12 +579,12 @@ def __repr__(self) -> str:
parts.append(f"holidays.financial_holidays({self.market!r}")
parts.append(")")
elif hasattr(self, "country"):
if parts:
parts.append(" + ")
parts.append(f"holidays.country_holidays({self.country!r}")
if self.subdiv:
parts.append(f", subdiv={self.subdiv!r}")
parts.append(")")
else:
parts.append("holidays.HolidayBase()")

return "".join(parts)

Expand Down
65 changes: 57 additions & 8 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,18 +1,67 @@
[project]
name = "holidays"
version = "0.34"
description = "Generate and work with holidays in Python"
license = { file = "LICENSE" }
readme = "README.rst"
requires-python = ">=3.8"

authors = [{ email = "[email protected]", name = "Maurizio Montel" }]
dependencies = ["python-dateutil"]
classifiers = [
"Classifier: Development Status :: 4 - Beta",
"Classifier: Intended Audience :: Developers",
"Classifier: License :: OSI Approved :: MIT License",
"Classifier: Operating System :: OS Independent",
"Classifier: Programming Language :: Python",
"Classifier: Programming Language :: Python :: 3",
"Classifier: Programming Language :: Python :: 3 :: Only",
"Classifier: Programming Language :: Python :: Implementation :: CPython",
"Classifier: Programming Language :: Python :: Implementation :: PyPy",
"Classifier: Topic :: Office/Business :: Scheduling",
"Classifier: Topic :: Software Development :: Libraries :: Python Modules",
"Classifier: Topic :: Software Development :: Localization",
]
keywords = ["holidays", "calendar", "l10n"]
maintainers = [{ email = "[email protected]", name = "Arkadii Yakovets" }]

[project.urls]
Repository = "https://github.com/vacanza/python-holidays/"
Documentation = "https://python-holidays.readthedocs.io/en/latest/"
Changelog = "https://github.com/vacanza/python-holidays/releases"
Downloads = "https://pypi.org/project/holidays/"

[tool.black]
line-length = 99
target-version = ['py38', 'py39', 'py310', 'py311']
target-version = ["py38", "py39", "py310", "py311"]

[tool.coverage.run]
branch = true
omit = ['scripts/*', 'setup.py', 'tests/*']

[tool.coverage.report]
exclude_lines = ['def __repr__', 'pragma: no cover']
omit = ["scripts/*", "setup.py", "tests/*"]

[tool.isort]
known_first_party = ['holidays', 'tests']
known_first_party = ["holidays", "tests"]
line_length = 99
multi_line_output = 3
no_inline_sort = true
profile = 'black'
skip = ['docs']
profile = "black"
skip = ["docs"]


[tool.mypy]
strict = false

[[tool.mypy.overrides]]
module = "holidays.countries.*"
disable_error_code = ["override"]

[[tool.mypy.overrides]]
module = "holidays.groups.*"
disable_error_code = "attr-defined"

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

[tool.setuptools.packages.find]
include = ["holidays*"]
1 change: 1 addition & 0 deletions requirements/tests.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Test requirements.
coverage
importlib-metadata
pytest
pytest-cov
pytest-xdist
Expand Down
53 changes: 0 additions & 53 deletions setup.cfg

This file was deleted.

13 changes: 8 additions & 5 deletions tests/test_holiday_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -705,12 +705,15 @@ def test_partial(self):


class TestRepr(unittest.TestCase):
def test_country(self):
hb = CountryStub1()
self.assertEqual(repr(hb), "holidays.country_holidays('CS1')")
def test_base(self):
self.assertEqual(repr(HolidayBase()), "holidays.HolidayBase()")

hb = CountryStub1(subdiv="Subdiv1")
self.assertEqual(repr(hb), "holidays.country_holidays('CS1', subdiv='Subdiv1')")
def test_country(self):
self.assertEqual(repr(CountryStub1()), "holidays.country_holidays('CS1')")
self.assertEqual(
repr(CountryStub1(subdiv="Subdiv1")),
"holidays.country_holidays('CS1', subdiv='Subdiv1')",
)

def test_market(self):
self.assertEqual(repr(MarketStub1()), "holidays.financial_holidays('MS1')")
Expand Down
43 changes: 43 additions & 0 deletions tests/test_package.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# python-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: dr-prodigy <[email protected]> (c) 2017-2023
# ryanss <[email protected]> (c) 2014-2017
# Website: https://github.com/dr-prodigy/python-holidays
# License: MIT (see LICENSE file)

from unittest import TestCase

from importlib_metadata import metadata

import holidays


class TestPackage(TestCase):
def test_metadata(self):
ph_metadata = metadata("holidays")

for attr_name, attr_value in {
"name": "holidays",
"summary": "Generate and work with holidays in Python",
"version": holidays.__version__,
}.items():
self.assertIn(attr_name, ph_metadata)
self.assertEqual(ph_metadata[attr_name], attr_value, attr_name)

for attr_name in (
"author-email",
"classifier",
"description",
"keywords",
"license",
"license-file",
"maintainer-email",
"project-url",
"requires-python",
):
self.assertIn(attr_name, ph_metadata)
self.assertTrue(ph_metadata[attr_name], attr_name)
3 changes: 3 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ commands =
pre-commit autoupdate
pre-commit run --all-files

[flake8]
extend-ignore = E203

[pytest]
filterwarnings =
ignore:The --rsyncdir .* are deprecated:DeprecationWarning