Research
Security News
Kill Switch Hidden in npm Packages Typosquatting Chalk and Chokidar
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
The original Python Inline Source by Sam Willis is no longer maintained. Please raise your issues and questions in jurooravec/python-inline-source-2.
The PyPI package and VSCode extension have also been migrated:
- PyPI: sourcetypes -> sourcetypes2
- VSCode: samwillis.python-inline-source -> jurooravec.python-inline-source-2
This fork is based on v0.0.4.
Type annotations for various languages, when applied to multi line strings will syntax
highlighting with the python-inline-source-2
VS Code plugin.
Supports html
, css
, javascript
, typescript
, sql
, graphql
,
multiple css extension languages, template languages and many more,
see below for a full list.
Uses typing.Annotated
to annotate the str
type with the language used. You can use
typing.get_type_hints
at runtime to determine the language that a string has been annotated with.
On Python versions prior to 3.9 uses typing_extensions to support Annotated
types.
pip install sourcetypes2
Use a type decoration named for language that you are using:
import sourcetypes
my_html_string: sourcetypes.html = """
<h1>Some HTML</h1>
"""
or:
from sourcetypes import html
my_html_string: html = """
<h1>Some HTML</h1>
"""
markdown
(aliased as md
)html
django_html
(aliased as django
)django_txt
jinja
jinja_html
css
(aliased as style
, and styles
)scss
less
sass
stylus
javascript
(aliased as js
)jsx
(aliased as javascriptreact
, and react
)typescript
(aliased as ts
)tsx
(aliased as typescriptreact
)coffeescript
(aliased as coffee
)sql
json
yaml
graphql
xml
python
py.typed
. #4Install twine and build
pip install twine build
Packaging:
python -m build --sdist --wheel --outdir dist/ .
Publishing:
twine upload --repository pypi dist/* -u __token__ -p <pypi-token>
FAQs
Python Source Code Types For Inline Syntax Highlighting
We found that sourcetypes2 demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.