Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
The calver
package is a setuptools extension
for automatically defining your Python package version as a calendar version.
First, ensure calver
is present during the project's build step by specifying
it as one of the build requirements:
pyproject.toml
:
[build-system]
requires = ["setuptools>=42", "calver"]
To enable generating the version automatically based on the date, add the
following to setup.py
:
setup.py
:
from setuptools import setup
setup(
...
use_calver=True,
setup_requires=['calver'],
...
)
You can test that it is working with:
$ python setup.py --version
2020.6.16
By default, when setting use_calver=True
, it uses the following to generate
the version string:
>>> import datetime
>>> datetime.datetime.now().strftime("%Y.%m.%d")
2020.6.16
You can override the format string by passing it instead of True
:
setup.py
:
from setuptools import setup
setup(
...
use_calver="%Y.%m.%d.%H.%M",
setup_requires=['calver'],
...
)
You can override this entirely by passing a callable instead, which will be called with no arguments at build time:
setup.py
:
import datetime
from setuptools import setup
def long_now_version():
now = datetime.datetime.now()
return now.strftime("%Y").zfill(5) + "." + now.strftime("%m.%d")
setup(
...
use_calver=long_now_version,
setup_requires=['calver'],
...
)
FAQs
Setuptools extension for CalVer package versions
We found that calver demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers 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.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.