Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 4.1.0 #54

Merged
merged 29 commits into from
Jan 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
2cbbc9d
:bug: Fix nested list in mkdocs
kinegratii Nov 25, 2022
26be8b7
New license year
kinegratii Feb 12, 2023
6ee1851
Add FestivalLibrary.extend_term_festivals
kinegratii Dec 19, 2023
cd4c7c4
:construction_worker: Update development library
kinegratii Dec 23, 2023
51246e5
:construction_worker: New build tool for PEP 518
kinegratii Dec 31, 2023
f6b1682
:tada: Happy New Year!
kinegratii Jan 1, 2024
c978162
:hammer: New pyproject.toml config
kinegratii Jan 1, 2024
dc8571b
:pencil: Update document
kinegratii Jan 5, 2024
c668207
:construction_worker: Migrate coverage with pyproject.toml
kinegratii Jan 8, 2024
85ff27f
:sparkles: Update FestivalCreator UI
kinegratii Jan 9, 2024
1b1fb0c
:sparkles: Update FestivalCreator UI layout
kinegratii Jan 9, 2024
580a64d
:construction_worker: Migrate mkdos-material to 9.5.3
kinegratii Jan 9, 2024
4dfc186
:sparkles: Update FestivalCreator UI layout
kinegratii Jan 9, 2024
7b569d9
:sparkles: Refactor borax.capp
kinegratii Jan 10, 2024
ae2b502
:pencil: Update document.Fix #52
kinegratii Jan 12, 2024
02105b4
:recycle: Refactor borax.calendars.dataset
kinegratii Jan 13, 2024
f4578e4
:rotating_light: Improve code
kinegratii Jan 18, 2024
9e359fe
:pencil: Update docs
kinegratii Jan 18, 2024
b6ba25e
:sparkles: Add change festival source
kinegratii Jan 18, 2024
131728a
:green_heart: Fix Codecov
kinegratii Jan 19, 2024
a12a0c2
:wrench: migrate flake8 with pyproject.toml
kinegratii Jan 20, 2024
a6fd5eb
:sparkles: Add tests
kinegratii Jan 23, 2024
b495518
:sparkles: Add Festival.code & Upgrade to python3.9+
kinegratii Jan 24, 2024
e9f4297
:sparkles: code improve
kinegratii Jan 24, 2024
fb66fad
:sparkles: Add FestivalLibrary.load
kinegratii Jan 25, 2024
7cc0a84
:sparkles: Make solar&lunar readonly for WrappedDate
kinegratii Jan 26, 2024
39a9a1c
:sparkles: Refactor FestivalLibrary.load
kinegratii Jan 27, 2024
b7ec13d
:pencil: Update docs
kinegratii Jan 30, 2024
a9b410e
:bookmark: release v4.1.0
kinegratii Jan 31, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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'
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
Loading