Skip to content

Commit

Permalink
Merge pull request #39 from elcaminoreal/fix-gathering-deprecation
Browse files Browse the repository at this point in the history
Fix gathering deprecation
  • Loading branch information
moshez authored Jan 11, 2024
2 parents bfa0e27 + fde4c6c commit 48a2a95
Show file tree
Hide file tree
Showing 9 changed files with 140 additions and 92 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pr-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
matrix:
include:
- { python: "3.11", os: ubuntu-latest, check: "tests-3.11" }
#- { python: "3.12", os: ubuntu-latest, check: "tests-3.12" }
- { python: "3.12", os: ubuntu-latest, check: "tests-3.12" }
- { python: "3.11", os: ubuntu-latest, check: "lint" }
- { python: "3.11", os: ubuntu-latest, check: "docs" }
- { python: "3.11", os: ubuntu-latest, check: "mypy" }
Expand Down
55 changes: 55 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Release

on:
push:
branches:
- master

permissions: # added using https://github.com/step-security/secure-workflows
contents: read

jobs:
build:
name: Build
runs-on: ubuntu-latest
permissions:
id-token: write
steps:
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2

- uses: actions/setup-python@57ded4d7d5e986d7296eab16560982c6dd7c923b
with:
python-version: "3.x"
cache: "pip"
cache-dependency-path: pyproject.toml

- name: deps
run: python -m pip install -U build

- name: env
run: env

- name: build
run: python -m build

- name: Upload built packages
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
with:
name: built-packages
path: ./dist/
if-no-files-found: warn

release-pypi:
needs: build
runs-on: ubuntu-latest
permissions:
# Used to authenticate to PyPI via OIDC.
id-token: write
steps:
- name: Download artifacts directories # goes to current working directory
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2

- name: publish
uses: pypa/gh-action-pypi-publish@0bf742be3ebe032c25dd15117957dc15d0cfc38d
with:
packages_dir: built-packages/
5 changes: 5 additions & 0 deletions git-log-head
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
commit 35f41e5b6c28ebb0b20a8c964b9bef45d9b18539
Author: Moshe Zadka <[email protected]>
Date: 2024-01-11 01:17:54 +0000

checkpoint
11 changes: 9 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
[build-system]
requires = [
"setuptools"
"setuptools", "autocalver"
]
build-backend = "setuptools.build_meta"

[project]
name = "gather"
version = "2024.1.5.3"
dynamic = ["version"]
description = "A gatherer"
readme = "README.rst"
authors = [{name = "Moshe Zadka", email = "[email protected]"}]
Expand Down Expand Up @@ -48,5 +48,12 @@ Development = "https://github.com/elcaminoreal/gather"
Documentation = "https://gather.readthedocs.io/en/latest/"
Blog = "https://gather.works"

[tool.autocalver]
use = true
log = "git-log-head"
log_command = "git log -n 1 --date=iso"
is_main_var = "GITHUB_REF"
is_main_match = ".*/trunk$"

[project.entry-points.gather]
gather = "gather"
54 changes: 28 additions & 26 deletions requirements-docs.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,57 +4,59 @@
#
# pip-compile --extra=docs --output-file=requirements-docs.txt pyproject.toml
#
alabaster==0.7.12
alabaster==0.7.16
# via sphinx
attrs==21.4.0
attrs==23.2.0
# via gather (pyproject.toml)
babel==2.10.3
babel==2.14.0
# via sphinx
certifi==2022.6.15
certifi==2023.11.17
# via requests
charset-normalizer==2.1.0
charset-normalizer==3.3.2
# via requests
docutils==0.18.1
docutils==0.20.1
# via sphinx
idna==3.3
idna==3.6
# via requests
imagesize==1.4.1
# via sphinx
incremental==21.3.0
incremental==22.10.0
# via gather (pyproject.toml)
jinja2==3.1.2
jinja2==3.1.3
# via sphinx
markupsafe==2.1.1
markupsafe==2.1.3
# via jinja2
packaging==21.3
packaging==23.2
# via sphinx
pygments==2.12.0
pygments==2.17.2
# via sphinx
pyparsing==3.0.9
# via packaging
pytz==2022.1
# via babel
requests==2.28.1
requests==2.31.0
# via sphinx
snowballstemmer==2.2.0
# via sphinx
sphinx==5.0.2
# via gather (pyproject.toml)
sphinxcontrib-applehelp==1.0.2
sphinx==7.2.6
# via
# gather (pyproject.toml)
# sphinxcontrib-applehelp
# sphinxcontrib-devhelp
# sphinxcontrib-htmlhelp
# sphinxcontrib-qthelp
# sphinxcontrib-serializinghtml
sphinxcontrib-applehelp==1.0.7
# via sphinx
sphinxcontrib-devhelp==1.0.2
sphinxcontrib-devhelp==1.0.5
# via sphinx
sphinxcontrib-htmlhelp==2.0.0
sphinxcontrib-htmlhelp==2.0.4
# via sphinx
sphinxcontrib-jsmath==1.0.1
# via sphinx
sphinxcontrib-qthelp==1.0.3
sphinxcontrib-qthelp==1.0.6
# via sphinx
sphinxcontrib-serializinghtml==1.1.5
sphinxcontrib-serializinghtml==1.1.9
# via sphinx
toolz==0.12.0
# via gather (pyproject.toml)
urllib3==1.26.9
urllib3==2.1.0
# via requests
venusian==3.0.0
venusian==3.1.0
# via gather (pyproject.toml)
43 changes: 19 additions & 24 deletions requirements-lint.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,50 +4,45 @@
#
# pip-compile --extra=lint --output-file=requirements-lint.txt pyproject.toml
#
astroid==2.11.6
astroid==3.0.2
# via pylint
attrs==21.4.0
attrs==23.2.0
# via gather (pyproject.toml)
black==22.6.0
black==23.12.1
# via gather (pyproject.toml)
click==8.1.3
click==8.1.7
# via black
dill==0.3.5.1
dill==0.3.7
# via pylint
flake8==4.0.1
flake8==7.0.0
# via gather (pyproject.toml)
incremental==21.3.0
incremental==22.10.0
# via gather (pyproject.toml)
isort==5.10.1
isort==5.13.2
# via pylint
lazy-object-proxy==1.7.1
# via astroid
mccabe==0.6.1
mccabe==0.7.0
# via
# flake8
# pylint
mypy-extensions==0.4.3
mypy-extensions==1.0.0
# via black
pathspec==0.9.0
packaging==23.2
# via black
platformdirs==2.5.2
pathspec==0.12.1
# via black
platformdirs==4.1.0
# via
# black
# pylint
pycodestyle==2.8.0
pycodestyle==2.11.1
# via flake8
pyflakes==2.4.0
pyflakes==3.2.0
# via flake8
pylint==2.14.4
pylint==3.0.3
# via gather (pyproject.toml)
tomlkit==0.11.0
tomlkit==0.12.3
# via pylint
toolz==0.12.0
# via gather (pyproject.toml)
venusian==3.0.0
venusian==3.1.0
# via gather (pyproject.toml)
wrapt==1.14.1
# via astroid

# The following packages are considered to be unsafe in a requirements file:
# setuptools
12 changes: 6 additions & 6 deletions requirements-mypy.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@
#
# pip-compile --extra=mypy --output-file=requirements-mypy.txt pyproject.toml
#
attrs==21.4.0
attrs==23.2.0
# via gather (pyproject.toml)
incremental==21.3.0
incremental==22.10.0
# via gather (pyproject.toml)
mypy==0.961
mypy==1.8.0
# via gather (pyproject.toml)
mypy-extensions==0.4.3
mypy-extensions==1.0.0
# via mypy
toolz==0.12.0
# via gather (pyproject.toml)
typing-extensions==4.3.0
typing-extensions==4.9.0
# via mypy
venusian==3.0.0
venusian==3.1.0
# via gather (pyproject.toml)
30 changes: 15 additions & 15 deletions requirements-tests.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,47 +4,47 @@
#
# pip-compile --extra=tests --output-file=requirements-tests.txt pyproject.toml
#
attrs==21.4.0
attrs==23.2.0
# via
# automat
# gather (pyproject.toml)
# twisted
# virtue
automat==20.2.0
automat==22.10.0
# via twisted
click==8.1.3
click==8.1.7
# via virtue
colorama==0.4.5
colorama==0.4.6
# via virtue
constantly==15.1.0
constantly==23.10.4
# via twisted
coverage[toml]==6.4.1
coverage[toml]==7.4.0
# via gather (pyproject.toml)
hyperlink==21.0.0
# via twisted
idna==3.3
idna==3.6
# via hyperlink
incremental==21.3.0
incremental==22.10.0
# via
# gather (pyproject.toml)
# twisted
pyhamcrest==2.0.3
pyhamcrest==2.1.0
# via gather (pyproject.toml)
pyrsistent==0.18.1
pyrsistent==0.20.0
# via virtue
six==1.16.0
# via automat
toolz==0.12.0
# via gather (pyproject.toml)
twisted==22.4.0
twisted==23.10.0
# via virtue
typing-extensions==4.3.0
typing-extensions==4.9.0
# via twisted
venusian==3.0.0
venusian==3.1.0
# via gather (pyproject.toml)
virtue==2.1.1
virtue==2023.8.2
# via gather (pyproject.toml)
zope-interface==5.4.0
zope-interface==6.1
# via twisted

# The following packages are considered to be unsafe in a requirements file:
Expand Down
20 changes: 2 additions & 18 deletions src/gather/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,29 +26,15 @@
Gather can be used to collect anything.
"""
import collections
import contextlib
import importlib.metadata
import sys
import warnings

import attr
import venusian


@contextlib.contextmanager
def _ignore_deprecation():
warnings.filterwarnings(action="ignore", category=DeprecationWarning)
try:
yield
finally:
warnings.filters.pop(0)


def _get_modules():
eps = importlib.metadata.entry_points()
with _ignore_deprecation():
gather_points = eps["gather"]
for entry_point in gather_points:
for entry_point in importlib.metadata.entry_points(name="gather"):
module = importlib.import_module(entry_point.value)
yield module

Expand Down Expand Up @@ -137,9 +123,7 @@ def ignore_import_error(_unused):
registry = collections.defaultdict(set)
scanner = venusian.Scanner(registry=registry, tag=self)
for module in _get_modules():
# Venusian is using a newly-deprecated method to scan modules
with _ignore_deprecation():
scanner.scan(module, onerror=ignore_import_error)
scanner.scan(module, onerror=ignore_import_error)
return registry


Expand Down

0 comments on commit 48a2a95

Please sign in to comment.