Skip to content

Modernize package#62

Open
mpasternak wants to merge 14 commits into
infrae:masterfrom
mpasternak:modernize-package
Open

Modernize package#62
mpasternak wants to merge 14 commits into
infrae:masterfrom
mpasternak:modernize-package

Conversation

@mpasternak
Copy link
Copy Markdown
Contributor

No description provided.

Michał Pasternak and others added 14 commits July 6, 2017 02:42
`datetime.datetime.utcnow()` is deprecated since Python 3.12 and
scheduled for removal in a future version:

    DeprecationWarning: datetime.datetime.utcnow() is deprecated and
    scheduled for removal in a future version. Use timezone-aware
    objects to represent datetimes in UTC:
    datetime.datetime.now(datetime.UTC).

`datetime_to_datestamp()` in `oaipmh/datestamp.py` asserts that the
input has `tzinfo is None`, so we convert the timezone-aware UTC
value back to naive with `.replace(tzinfo=None)` before passing it
in. The resulting `responseDate` string in the OAI-PMH response is
unchanged.

This is the only `datetime.utcnow()` call in the codebase; after
this change, pyoai no longer emits `DeprecationWarning` for it on
Python 3.12+.
Replace deprecated datetime.utcnow() with timezone-aware equivalent
- Generated pyproject.toml with metadata migrated from setup.py/setup.cfg
- Python requirement raised to >=3.10 (dropping EOL 2.7/3.5-3.9)
- Initialized uv; uv.lock added to .gitignore (library)
- Removed obsolete packaging files: setup.py, setup.cfg, MANIFEST.in
- Updated .gitignore with modern Python patterns

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- Normalized version 2.5.2pre -> 2.5.2 (PEP 440 compliant)
- Added [tool.bumpver] config to pyproject.toml
- Single source of truth: pyproject.toml only

Previously the version was inconsistent: setup.py had 2.5.2pre while
setup.cfg bumpversion pointed to 2.5.0.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- Added .pre-commit-config.yaml with ruff lint + format
- Configured ruff with basic flake8-equivalent rules (E, F, W)
- Hooks run only on staged files — existing code not reformatted
- Added hygiene hooks: trailing-whitespace, end-of-file-fixer,
  check-yaml, check-added-large-files, detect-private-key

Install with: pre-commit install

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- Python matrix: 3.10, 3.11, 3.12, 3.13 (was 2.7, 3.6-3.8)
- Use uv for Python install + dependency resolution
- Replace tox invocation with direct pytest
- Upgraded action versions: checkout@v4, setup-uv@v5
- Added informational-only ruff lint job (non-blocking)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- Configured [tool.pytest.ini_options] in pyproject.toml
- python_classes = ["*TestCase"] to avoid collecting non-test TestError
- Removed tox.ini and src/oaipmh/tests/runtests.sh

Python 3.12+ compatibility fixes (required for test matrix):
- pkg_resources (removed from stdlib setuptools) -> importlib.metadata
- unittest.makeSuite / test_suite() -> removed (dead code for zope.testrunner)
- unittest.assertEquals (removed alias) -> assertEqual
- unittest.assert_ (removed alias) -> assertTrue
- lxml evaluator.evaluate (removed attribute) -> evaluator is callable directly
- Relative imports: `from fakeclient` -> `from .fakeclient`
- Dropped Python 2 compat shims (StringIO fallbacks, urllib2 fallback, six.PY2/PY3)

All 58 tests pass on Python 3.13.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- Replaced six.text_type with str
- Removed six.PY3 check (always True)
- Removed six from [project] dependencies

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Deleted:
- .hgignore, .hgtags (Mercurial remnants, repo is on git)
- buildout.cfg (zc.buildout config; replaced by uv)
- Makefile (referenced `python setup.py sdist upload`; had bogus path
  from another project; superseded by uv)
- INSTALL.txt (outdated: mentioned Python 2.3, `python setup.py install`,
  and codespeak lxml URL)

README.rst:
- Fixed Python 2 `print record` -> `print(record)`
- Updated CI badge to new workflow URL (mpasternak/pyoai)
- Added Python version support badge (3.10-3.13)
- Added modern installation instructions (pip, uv)
- Added development quickstart (uv sync, uv run pytest)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants