tsutsu3 / linkify-it-py Goto Github PK
View Code? Open in Web Editor NEWLinks recognition library with full unicode support
License: Other
Links recognition library with full unicode support
License: Other
It would be nice if we could support all these typos.
Context: I'm using linkify-it as part of a spam/malicious links-checker and I see these typos escaping our watchful gaze :)
The sdist package at PyPI is missing tests. Please add tests to sdist to allow downstream testing. Thank you.
Are there any plans to account for passing in HTML documents, so that this can be used without re-linking URLs that are already wrapped by <a>
tags? I realize this is a non-trivial problem and would probably be a ton of work, just wondering if it is on the roadmap or not. (I'm ultimately looking for something to potentially replace Bleach's Linkify class.)
Schema key containing -
is not producing any matches.
from linkify_it import LinkifyIt
linkify = LinkifyIt().add('foo-bar:', 'http:')
print(linkify.test('Check foo-bar://baz')) # False
For comparison, the original linkify-it:
const linkify = require('linkify-it')();
linkify.add('foo-bar:', 'http:');
console.log(linkify.test('Check foo-bar://baz')); // true
I ran tests for 2.0.1 sdist and it failed:
____________________ ERROR collecting test/test_linkify.py _____________________
ImportError while importing test module '$(BUILD_DIR)/test/test_linkify.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/lib/python3.9/importlib/__init__.py:127: in import_module
return _bootstrap._gcd_import(name[level:], package, level)
test/test_linkify.py:7: in <module>
from .utils import read_fixture_file
E ImportError: attempted relative import with no known parent package
The sdist is apparently missing some files in the test
directory.
If you release on conda-forge, then I'll include in markdown-it-py conda requirements ๐
(If you don't know, you need to make a PR to https://github.com/conda-forge/staged-recipes)
It looks like create any temporary directory in source tree causes that pep517 based build fails
+ cd linkify-it-py-2.0.2
+ mkdir tmp
+ /usr/bin/python3 -sBm build -w --no-isolation
* Getting build dependencies for wheel...
ERROR setuptools_scm._integration.setuptools pyproject.toml does not contain a tool.setuptools_scm section
Traceback (most recent call last):
File "/usr/lib/python3.8/site-packages/setuptools_scm/_integration/pyproject_reading.py", line 53, in read_pyproject
section = defn.get("tool", {})[tool_name]
KeyError: 'setuptools_scm'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/lib/python3.8/site-packages/setuptools_scm/_integration/setuptools.py", line 121, in infer_version
config = _config.Configuration.from_file(dist_name=dist_name)
File "/usr/lib/python3.8/site-packages/setuptools_scm/_config.py", line 128, in from_file
pyproject_data = _read_pyproject(name, _load_toml=_load_toml)
File "/usr/lib/python3.8/site-packages/setuptools_scm/_integration/pyproject_reading.py", line 55, in read_pyproject
raise LookupError(f"{name} does not contain a tool.{tool_name} section") from e
LookupError: pyproject.toml does not contain a tool.setuptools_scm section
No `packages` or `py_modules` configuration, performing automatic discovery.
`flat-layout` detected -- analysing .
discovered packages -- ['linkify_it', 'SPECPARTS', 'temp']
Traceback (most recent call last):
File "/usr/lib/python3.8/site-packages/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
main()
File "/usr/lib/python3.8/site-packages/pyproject_hooks/_in_process/_in_process.py", line 335, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File "/usr/lib/python3.8/site-packages/pyproject_hooks/_in_process/_in_process.py", line 118, in get_requires_for_build_wheel
return hook(config_settings)
File "/usr/lib/python3.8/site-packages/setuptools/build_meta.py", line 355, in get_requires_for_build_wheel
return self._get_build_requires(config_settings, requirements=['wheel'])
File "/usr/lib/python3.8/site-packages/setuptools/build_meta.py", line 325, in _get_build_requires
self.run_setup()
File "/usr/lib/python3.8/site-packages/setuptools/build_meta.py", line 341, in run_setup
exec(code, locals())
File "<string>", line 1, in <module>
File "/usr/lib/python3.8/site-packages/setuptools/__init__.py", line 103, in setup
return distutils.core.setup(**attrs)
File "/usr/lib/python3.8/site-packages/setuptools/_distutils/core.py", line 159, in setup
dist.parse_config_files()
File "/usr/lib/python3.8/site-packages/setuptools/dist.py", line 653, in parse_config_files
pyprojecttoml.apply_configuration(self, filename, ignore_option_errors)
File "/usr/lib/python3.8/site-packages/setuptools/config/pyprojecttoml.py", line 66, in apply_configuration
config = read_configuration(filepath, True, ignore_option_errors, dist)
File "/usr/lib/python3.8/site-packages/setuptools/config/pyprojecttoml.py", line 131, in read_configuration
return expand_configuration(asdict, root_dir, ignore_option_errors, dist)
File "/usr/lib/python3.8/site-packages/setuptools/config/pyprojecttoml.py", line 156, in expand_configuration
return _ConfigExpander(config, root_dir, ignore_option_errors, dist).expand()
File "/usr/lib/python3.8/site-packages/setuptools/config/pyprojecttoml.py", line 204, in expand
self._expand_all_dynamic(dist, package_dir)
File "/usr/lib/python3.8/site-packages/setuptools/config/pyprojecttoml.py", line 249, in _expand_all_dynamic
version=self._obtain_version(dist, package_dir),
File "/usr/lib/python3.8/site-packages/setuptools/config/pyprojecttoml.py", line 298, in _obtain_version
return _expand.version(self._obtain(dist, "version", package_dir))
File "/usr/lib/python3.8/site-packages/setuptools/config/pyprojecttoml.py", line 287, in _obtain
return self._expand_directive(
File "/usr/lib/python3.8/site-packages/setuptools/config/pyprojecttoml.py", line 281, in _expand_directive
return _expand.read_attr(directive["attr"], package_dir, root_dir)
File "/usr/lib/python3.8/site-packages/setuptools/config/expand.py", line 189, in read_attr
_parent_path, path, module_name = _find_module(module_name, package_dir, root_dir)
File "/usr/lib/python3.8/site-packages/setuptools/config/expand.py", line 230, in _find_module
if package_dir:
File "/usr/lib/python3.8/site-packages/setuptools/config/expand.py", line 460, in __len__
return len(self._target())
File "/usr/lib/python3.8/site-packages/setuptools/config/expand.py", line 453, in _target
self._value = self._obtain()
File "/usr/lib/python3.8/site-packages/setuptools/config/expand.py", line 423, in _get_package_dir
self()
File "/usr/lib/python3.8/site-packages/setuptools/config/expand.py", line 413, in __call__
self._dist.set_defaults(name=False) # Skip name, we can still be parsing
File "/usr/lib/python3.8/site-packages/setuptools/discovery.py", line 353, in __call__
self._analyse_package_layout(ignore_ext_modules)
File "/usr/lib/python3.8/site-packages/setuptools/discovery.py", line 387, in _analyse_package_layout
or self._analyse_flat_layout()
File "/usr/lib/python3.8/site-packages/setuptools/discovery.py", line 444, in _analyse_flat_layout
return self._analyse_flat_packages() or self._analyse_flat_modules()
File "/usr/lib/python3.8/site-packages/setuptools/discovery.py", line 450, in _analyse_flat_packages
self._ensure_no_accidental_inclusion(top_level, "packages")
File "/usr/lib/python3.8/site-packages/setuptools/discovery.py", line 480, in _ensure_no_accidental_inclusion
raise PackageDiscoveryError(cleandoc(msg))
setuptools.errors.PackageDiscoveryError: Multiple top-level packages discovered in a flat-layout: ['tmp', 'linkify_it'].
To avoid accidental inclusion of unwanted files or directories,
setuptools will not proceed with this build.
If you are trying to create a single distribution with multiple packages
on purpose, you should not rely on automatic discovery.
Instead, consider the following options:
1. set up custom discovery (`find` directive with `include` or `exclude`)
2. use a `src-layout`
3. explicitly set `py_modules` or `packages` with a list of names
To find more information, look for "package discovery" on setuptools docs.
ERROR Backend subprocess exited when trying to invoke get_requires_for_build_wheel
Update to prevent warnings.
ref: https://github.com/tsutsu3/linkify-it-py/actions/runs/7774761949
Node.js 16 actions are deprecated. Please update the following actions to use Node.js 20: actions/checkout@v3, actions/setup-python@v4. For more information see: https://github.blog/changelog/2023-09-22-github-actions-transitioning-from-node-16-to-node-20/.
I assume that if the code is using setattr(LinkifyIt, "func", val.get("normalize"))
to define func
, it should use getattr
to fetch func
, instead of self.func
. As it is right now, this pisses of my Python linter :)
see e.g. tsutsu3/uc.micro-py@4aa77c2
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.