calver-2022.6.26
توضیحات
Setuptools extension for CalVer package versions
| ویژگی | مقدار |
|---|---|
| سیستم عامل | - |
| نام فایل | calver-2022.6.26 |
| نام | calver |
| نسخه کتابخانه | 2022.6.26 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | Dustin Ingram |
| ایمیل نویسنده | di@python.org |
| آدرس صفحه اصلی | https://github.com/di/calver |
| آدرس اینترنتی | https://pypi.org/project/calver/ |
| مجوز | - |
# CalVer
The `calver` package is a [setuptools](https://pypi.org/p/setuptools) extension
for automatically defining your Python package version as a calendar version.
## Usage
First, ensure `calver` is present during the project's build step by specifying
it as one of the build requirements:
`pyproject.toml`:
```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`:
```python
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
```
## Configuration
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`:
```python
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`:
```python
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'],
...
)
```
زبان مورد نیاز
| مقدار | نام |
|---|---|
| >=3.5 | Python |
نحوه نصب
نصب پکیج whl calver-2022.6.26:
pip install calver-2022.6.26.whl
نصب پکیج tar.gz calver-2022.6.26:
pip install calver-2022.6.26.tar.gz