Skip to content

Commit

Permalink
Merge pull request #54 from kinegratii/develop
Browse files Browse the repository at this point in the history
Release 4.1.0
  • Loading branch information
kinegratii authored Jan 31, 2024
2 parents 0640795 + a9b410e commit 2735fe7
Show file tree
Hide file tree
Showing 41 changed files with 999 additions and 252 deletions.
17 changes: 0 additions & 17 deletions .coveragerc

This file was deleted.

3 changes: 2 additions & 1 deletion .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']
python-version: ['3.9', '3.10', '3.11', '3.12']

steps:
- uses: actions/checkout@v2
Expand All @@ -42,6 +42,7 @@ jobs:
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
with:
token: ${{secrets.CODECOV_TOKEN}}
file: ./coverage.xml
env_vars: OS,PYTHON
name: codecov-umbrella
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2015-2022 kinegratii
Copyright (c) 2015-2024 kinegratii

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
Expand Down
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
include borax/calendars/FestivalData.csv
include borax/calendars/dataset/FestivalData.csv
include borax/calendars/dataset/festivals_ext1.csv
36 changes: 24 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Borax - python3工具库 - 中国农历/中文数字/设计模式/树形结构
# Borax - python农历&节日工具库 - 中文数字/设计模式/树形结构


[![PyPI](https://img.shields.io/pypi/v/borax.svg)](https://pypi.org/project/borax)
Expand Down Expand Up @@ -33,10 +33,11 @@ Borax 是一个Python3工具集合库。包括了以下几个话题:

Borax 的 python 版本要求如下

| borax 版本 | python版本 |
| ------ | ------ |
| 4.x | 3.7+ |
| 3.x | 3.5+ |
| borax 版本 | python版本 | 维护状态 |
| ------ | ------ | ------ |
| 4.1.x | 3.9+ | 维护开发 |
| 4.0.0 | 3.7+ | 维护至2024年12月31日 |
| 3.x | 3.5+ | 不再维护 |

可以通过 *pip* 安装 :

Expand All @@ -49,7 +50,7 @@ $ pip install borax
Borax的版本符合 [语义化版本](https://semver.org/lang/zh-CN/) ,格式为 `<主版本号>.<副版本号>.<修正版本号>`, 推荐使用下面方式定义Borax的依赖版本号。

```text
borax~=3.5
borax~=4.1
```

## 使用示例 (Usage)
Expand All @@ -58,15 +59,15 @@ borax~=3.5

一个支持1900-2100年的农历日期工具库。

> 本模块的数据和算法参考自项目 [jjonline/calendar.js](https://github.com/jjonline/calendar.js)
> 本模块的数据和算法参考自项目 [jjonline/calendar.js](https://github.com/jjonline/calendar.js) ,部分算法和数据有所修改
创建日期,日期推算

```python
from datetime import timedelta
from borax.calendars import LunarDate

# 获取今天的农历日期(农历2018年七月初一
# 获取今天的农历日期(农历二〇一八年七月初一
print(LunarDate.today()) # LunarDate(2018, 7, 1, 0)

# 将公历日期转化为农历日期
Expand Down Expand Up @@ -99,7 +100,7 @@ festival = LunarFestival(month=1, day=1)
print(festival.description) # '农历每年正月初一'

# 下一次春节的具体日期以及距离天数
print(festival.countdown()) # (273, <GeneralDate:2022-02-01(二〇二二年正月初一)>)
print(festival.countdown()) # (273, <WrappedDate:2022-02-01(二〇二二年正月初一)>)

# 接下来5个春节的日期 ['2022-02-01(二〇二二年正月初一)', '2023-01-22(二〇二三年正月初一)', '2024-02-10(二〇二四年正月初一)', '2025-01-29(二〇二五年正月初一)', '2026-02-17(二〇二六年正月初一)']
print([str(wd) for wd in festival.list_days(start_date=date.today(), count=5)])
Expand Down Expand Up @@ -202,13 +203,15 @@ print(FinanceNumbers.to_capital_str(decimal.Decimal(4.50))) # '肆元伍角零

## 文档 (Document)

文档由 [Material for MkDocs](https://squidfunk.github.io/mkdocs-material/) 构建,另外备用文档使用 [docsify](https://docsify.js.org/) 构建。
文档由 [Material for MkDocs](https://squidfunk.github.io/mkdocs-material/) 构建 ~~,另外备用文档使用 [docsify](https://docsify.js.org/) 构建~~

> 2024年1月起,仅保留 Read the Docs 文档源。
|| 网址 |
| ---- | ---- |
| read-the-docs | [https://borax.readthedocs.io/zh_CN/latest/](https://borax.readthedocs.io/zh_CN/latest/) |
| github | [https://kinegratii.github.io/borax](https://kinegratii.github.io/borax) |
| gitee | [https://kinegratii.gitee.io/borax](https://kinegratii.gitee.io/borax) |
| github(已废弃) | [https://kinegratii.github.io/borax](https://kinegratii.github.io/borax) |
| gitee(已废弃) | [https://kinegratii.gitee.io/borax](https://kinegratii.gitee.io/borax) |

## 开发特性和规范 (Development Features)

Expand All @@ -217,6 +220,15 @@ print(FinanceNumbers.to_capital_str(decimal.Decimal(4.50))) # '肆元伍角零
- [x] [nose2](https://pypi.org/project/nose2/) | [pytest](https://docs.pytest.org/en/latest/)
- [x] [Github Action](https://github.com/kinegratii/borax/actions)
- [x] [Code Coverage](https://codecov.io/)
- [x] [pyproject.toml build tools](https://packaging.python.org/)

## 项目构建 (Project Build)

从4.1.0 开始,borax 使用 *pyproject.toml* 作为项目构建的配置文件,使用以下命令构建 wheel 发行包。

```shell
python -m build -w
```

## 开源协议 (License)

Expand Down
2 changes: 1 addition & 1 deletion borax/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
__version__ = '4.0.0'
__version__ = '4.1.0'
__author__ = 'kinegratii'
File renamed without changes.
16 changes: 16 additions & 0 deletions borax/calendars/dataset/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
from pathlib import Path

__all__ = ['get_festival_dataset_path']

_FILE_DICT = {
'basic': 'FestivalData.csv',
'ext1': 'festivals_ext1.csv',
'zh-Hans': 'FestivalData.csv'
}


def get_festival_dataset_path(identifier: str) -> Path:
"""Return the full path for festival dataset csv file."""
if identifier not in _FILE_DICT:
raise ValueError(f'Festival Dataset {identifier} not found!')
return Path(__file__).parent / _FILE_DICT.get(identifier)
Loading

0 comments on commit 2735fe7

Please sign in to comment.