timevec 0.2.0__tar.gz → 0.3.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- timevec-0.3.1/.github/workflows/gitignore-in.yml +16 -0
- {timevec-0.2.0 → timevec-0.3.1}/.github/workflows/happy.yml +1 -1
- {timevec-0.2.0 → timevec-0.3.1}/.github/workflows/pypi-publish.yml +8 -17
- {timevec-0.2.0 → timevec-0.3.1}/.github/workflows/python-test.yml +21 -21
- {timevec-0.2.0 → timevec-0.3.1}/.gitignore +18 -13
- timevec-0.3.1/.gitignore.in +5 -0
- {timevec-0.2.0 → timevec-0.3.1}/LICENSE +1 -1
- {timevec-0.2.0 → timevec-0.3.1}/PKG-INFO +20 -12
- {timevec-0.2.0 → timevec-0.3.1}/mypy.ini +1 -1
- timevec-0.3.1/pyproject.toml +82 -0
- timevec-0.3.1/setup.cfg +4 -0
- {timevec-0.2.0 → timevec-0.3.1}/tests/test_builtin_math.py +1 -1
- {timevec-0.2.0 → timevec-0.3.1}/tests/test_many_dates.py +20 -5
- {timevec-0.2.0 → timevec-0.3.1}/tests/test_numpy_datetime64.py +0 -1
- {timevec-0.2.0 → timevec-0.3.1}/timevec/__init__.py +21 -0
- {timevec-0.2.0 → timevec-0.3.1}/timevec/_version.py +2 -2
- {timevec-0.2.0 → timevec-0.3.1}/timevec/numpy_datetime64.py +2 -2
- {timevec-0.2.0 → timevec-0.3.1}/timevec.egg-info/PKG-INFO +20 -12
- {timevec-0.2.0 → timevec-0.3.1}/timevec.egg-info/SOURCES.txt +2 -3
- timevec-0.3.1/timevec.egg-info/requires.txt +3 -0
- timevec-0.3.1/uv.lock +1183 -0
- timevec-0.2.0/.flake8 +0 -2
- timevec-0.2.0/.gitignore.in +0 -10
- timevec-0.2.0/poetry.lock +0 -1166
- timevec-0.2.0/pyproject.toml +0 -71
- timevec-0.2.0/setup.cfg +0 -40
- timevec-0.2.0/timevec.egg-info/requires.txt +0 -3
- {timevec-0.2.0 → timevec-0.3.1}/.github/renovate.json5 +0 -0
- {timevec-0.2.0 → timevec-0.3.1}/.github/workflows/spellcheck.yml +0 -0
- {timevec-0.2.0 → timevec-0.3.1}/README.md +0 -0
- {timevec-0.2.0 → timevec-0.3.1}/examples/day_vec.svg +0 -0
- {timevec-0.2.0 → timevec-0.3.1}/examples/month_vec.svg +0 -0
- {timevec-0.2.0 → timevec-0.3.1}/examples/plot.py +0 -0
- {timevec-0.2.0 → timevec-0.3.1}/examples/week_vec.svg +0 -0
- {timevec-0.2.0 → timevec-0.3.1}/examples/year_vec.svg +0 -0
- {timevec-0.2.0 → timevec-0.3.1}/tests/test_numpy.py +0 -0
- {timevec-0.2.0 → timevec-0.3.1}/tests/test_same_result.py +0 -0
- {timevec-0.2.0 → timevec-0.3.1}/tests/test_util.py +0 -0
- {timevec-0.2.0 → timevec-0.3.1}/timevec/builtin_math.py +0 -0
- {timevec-0.2.0 → timevec-0.3.1}/timevec/numpy.py +0 -0
- {timevec-0.2.0 → timevec-0.3.1}/timevec/py.typed +0 -0
- {timevec-0.2.0 → timevec-0.3.1}/timevec/util.py +0 -0
- {timevec-0.2.0 → timevec-0.3.1}/timevec.egg-info/dependency_links.txt +0 -0
- {timevec-0.2.0 → timevec-0.3.1}/timevec.egg-info/top_level.txt +0 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
name: Update gitignore file
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
schedule:
|
|
5
|
+
# daily at 00:00
|
|
6
|
+
- cron: '0 0 * * *'
|
|
7
|
+
|
|
8
|
+
permissions:
|
|
9
|
+
contents: write
|
|
10
|
+
pull-requests: write
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
update-gitignore:
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
steps:
|
|
16
|
+
- uses: gitignore-in/gh-action@v0.2.2
|
|
@@ -15,27 +15,18 @@ jobs:
|
|
|
15
15
|
|
|
16
16
|
- name: Set up Python
|
|
17
17
|
id: setup-python
|
|
18
|
-
uses: actions/setup-python@
|
|
18
|
+
uses: actions/setup-python@v5
|
|
19
19
|
with:
|
|
20
|
-
python-version: "3.
|
|
20
|
+
python-version: "3.13"
|
|
21
21
|
|
|
22
|
-
- name: Set up
|
|
23
|
-
uses:
|
|
22
|
+
- name: Set up uv
|
|
23
|
+
uses: astral-sh/setup-uv@v5
|
|
24
24
|
|
|
25
|
-
- name:
|
|
26
|
-
|
|
27
|
-
with:
|
|
28
|
-
path: ~/.cache/pypoetry/virtualenvs
|
|
29
|
-
key: ${{ runner.os }}-build-${{ matrix.python }}-${{ hashFiles('**/poetry.lock') }}
|
|
30
|
-
restore-keys: |
|
|
31
|
-
${{ runner.os }}-build-${{ matrix.python }}-${{ hashFiles('**/poetry.lock') }}
|
|
32
|
-
${{ runner.os }}-build-${{ matrix.python }}-
|
|
33
|
-
${{ runner.os }}-
|
|
34
|
-
- run: poetry install
|
|
25
|
+
- name: Install dependencies
|
|
26
|
+
run: uv sync
|
|
35
27
|
|
|
36
28
|
- name: Build
|
|
37
|
-
|
|
38
|
-
run: poetry run poe build
|
|
29
|
+
run: uv build
|
|
39
30
|
|
|
40
31
|
- name: Publish distribution to Test PyPI
|
|
41
32
|
uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -43,7 +34,7 @@ jobs:
|
|
|
43
34
|
with:
|
|
44
35
|
user: __token__
|
|
45
36
|
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
|
|
46
|
-
|
|
37
|
+
repository-url: https://test.pypi.org/legacy/
|
|
47
38
|
|
|
48
39
|
- name: Publish distribution to PyPI
|
|
49
40
|
if: github.event_name == 'release' && !github.event.release.prerelease
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
name: Test
|
|
2
2
|
on:
|
|
3
|
-
-
|
|
3
|
+
# pull-request events are not triggered when a PR is merged
|
|
4
|
+
# push events are not triggered when a PR created from a fork repository
|
|
5
|
+
# So we need both to run tests on every PR and after merging
|
|
6
|
+
pull_request:
|
|
7
|
+
push:
|
|
8
|
+
branches:
|
|
9
|
+
- main
|
|
4
10
|
|
|
5
11
|
jobs:
|
|
6
12
|
test:
|
|
@@ -8,52 +14,46 @@ jobs:
|
|
|
8
14
|
strategy:
|
|
9
15
|
fail-fast: false
|
|
10
16
|
matrix:
|
|
11
|
-
python: ["3.
|
|
17
|
+
python: ["3.9", "3.10", "3.11", "3.12", "3.13"]
|
|
12
18
|
steps:
|
|
13
19
|
- name: Checkout
|
|
14
20
|
uses: actions/checkout@v4
|
|
15
21
|
|
|
16
22
|
- name: Set up Python
|
|
17
23
|
id: setup-python
|
|
18
|
-
uses: actions/setup-python@
|
|
24
|
+
uses: actions/setup-python@v5
|
|
19
25
|
with:
|
|
20
26
|
python-version: "${{ matrix.python }}"
|
|
21
27
|
|
|
22
|
-
- name: Set up
|
|
23
|
-
uses:
|
|
28
|
+
- name: Set up uv
|
|
29
|
+
uses: astral-sh/setup-uv@v5
|
|
24
30
|
|
|
25
|
-
- name: Cache
|
|
26
|
-
uses: actions/cache@v3
|
|
27
|
-
with:
|
|
28
|
-
path: ~/.cache/pypoetry/virtualenvs
|
|
29
|
-
key: ${{ runner.os }}-build-${{ matrix.python }}-${{ hashFiles('**/poetry.lock') }}
|
|
30
|
-
restore-keys: |
|
|
31
|
-
${{ runner.os }}-build-${{ matrix.python }}-${{ hashFiles('**/poetry.lock') }}
|
|
32
|
-
${{ runner.os }}-build-${{ matrix.python }}-
|
|
33
|
-
${{ runner.os }}-
|
|
34
31
|
- name: Install dependencies
|
|
35
|
-
run:
|
|
32
|
+
run: |
|
|
33
|
+
uv python pin ${{ matrix.python }}
|
|
34
|
+
uv sync
|
|
36
35
|
|
|
37
36
|
- name: Lint
|
|
38
|
-
run:
|
|
37
|
+
run: uv run poe check
|
|
39
38
|
|
|
40
39
|
- name: Check Python version
|
|
41
40
|
run: |
|
|
42
|
-
actual_version=$(
|
|
41
|
+
actual_version=$(uv run python --version)
|
|
43
42
|
expected_version="Python ${{ matrix.python }}"
|
|
44
43
|
if [ "$actual_version" == *"$expected_version"* ]; then
|
|
45
44
|
echo "Expected $expected_version, but got $actual_version"
|
|
46
45
|
exit 1
|
|
47
46
|
fi
|
|
47
|
+
|
|
48
48
|
- name: Test
|
|
49
|
-
run:
|
|
49
|
+
run: uv run poe test
|
|
50
50
|
|
|
51
51
|
- name: Coverage
|
|
52
|
-
run:
|
|
52
|
+
run: uv run poe coverage-xml
|
|
53
53
|
|
|
54
54
|
- name: Upload coverage report to Codecov
|
|
55
|
-
if: matrix.python == '3.
|
|
56
|
-
uses: codecov/codecov-action@
|
|
55
|
+
if: matrix.python == '3.13'
|
|
56
|
+
uses: codecov/codecov-action@v5
|
|
57
57
|
with:
|
|
58
58
|
token: ${{ secrets.CODECOV_TOKEN }}
|
|
59
59
|
files: ./coverage.xml
|
|
@@ -1,5 +1,11 @@
|
|
|
1
|
+
# DO NOT EDIT THIS FILE
|
|
2
|
+
# Generated by gitignore.in
|
|
3
|
+
# Edit .gitignore.in instead of this file
|
|
4
|
+
# Run `gitignore.in` to build .gitignore
|
|
5
|
+
# -----------------------------------------------------------------------------
|
|
6
|
+
# gibo dump Linux
|
|
1
7
|
### Generated by gibo (https://github.com/simonwhitaker/gibo)
|
|
2
|
-
### https://raw.github.com/github/gitignore/
|
|
8
|
+
### https://raw.github.com/github/gitignore/4488915eec0b3a45b5c63ead28f286819c0917de/Global/Linux.gitignore
|
|
3
9
|
|
|
4
10
|
*~
|
|
5
11
|
|
|
@@ -14,10 +20,10 @@
|
|
|
14
20
|
|
|
15
21
|
# .nfs files are created when an open file is removed but is still being accessed
|
|
16
22
|
.nfs*
|
|
17
|
-
|
|
18
|
-
|
|
23
|
+
# -----------------------------------------------------------------------------
|
|
24
|
+
# gibo dump Windows
|
|
19
25
|
### Generated by gibo (https://github.com/simonwhitaker/gibo)
|
|
20
|
-
### https://raw.github.com/github/gitignore/
|
|
26
|
+
### https://raw.github.com/github/gitignore/4488915eec0b3a45b5c63ead28f286819c0917de/Global/Windows.gitignore
|
|
21
27
|
|
|
22
28
|
# Windows thumbnail cache files
|
|
23
29
|
Thumbs.db
|
|
@@ -43,10 +49,10 @@ $RECYCLE.BIN/
|
|
|
43
49
|
|
|
44
50
|
# Windows shortcuts
|
|
45
51
|
*.lnk
|
|
46
|
-
|
|
47
|
-
|
|
52
|
+
# -----------------------------------------------------------------------------
|
|
53
|
+
# gibo dump macOS
|
|
48
54
|
### Generated by gibo (https://github.com/simonwhitaker/gibo)
|
|
49
|
-
### https://raw.github.com/github/gitignore/
|
|
55
|
+
### https://raw.github.com/github/gitignore/4488915eec0b3a45b5c63ead28f286819c0917de/Global/macOS.gitignore
|
|
50
56
|
|
|
51
57
|
# General
|
|
52
58
|
.DS_Store
|
|
@@ -74,10 +80,10 @@ Icon
|
|
|
74
80
|
Network Trash Folder
|
|
75
81
|
Temporary Items
|
|
76
82
|
.apdisk
|
|
77
|
-
|
|
78
|
-
|
|
83
|
+
# -----------------------------------------------------------------------------
|
|
84
|
+
# gibo dump Python
|
|
79
85
|
### Generated by gibo (https://github.com/simonwhitaker/gibo)
|
|
80
|
-
### https://raw.github.com/github/gitignore/
|
|
86
|
+
### https://raw.github.com/github/gitignore/4488915eec0b3a45b5c63ead28f286819c0917de/Python.gitignore
|
|
81
87
|
|
|
82
88
|
# Byte-compiled / optimized / DLL files
|
|
83
89
|
__pycache__/
|
|
@@ -239,6 +245,5 @@ cython_debug/
|
|
|
239
245
|
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
240
246
|
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
241
247
|
#.idea/
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
timevec/_version.py
|
|
248
|
+
# -----------------------------------------------------------------------------
|
|
249
|
+
_version.py
|
|
@@ -1,27 +1,35 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.2
|
|
2
2
|
Name: timevec
|
|
3
|
-
Version: 0.
|
|
4
|
-
Summary: Get some usable vector representations of datetime
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
Version: 0.3.1
|
|
4
|
+
Summary: Get some usable vector representations of datetime.
|
|
5
|
+
Author-email: Yui KITSU <kitsuyui+github@kitsuyui.com>
|
|
6
|
+
License: Copyright 2023-2025 Kitsu Yui
|
|
7
|
+
|
|
8
|
+
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
|
9
|
+
|
|
10
|
+
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
|
11
|
+
|
|
12
|
+
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
|
13
|
+
|
|
14
|
+
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
|
15
|
+
|
|
16
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
17
|
+
|
|
18
|
+
Project-URL: Homepage, https://github.com/kitsuyui/python-timevec
|
|
9
19
|
Classifier: Development Status :: 3 - Alpha
|
|
10
20
|
Classifier: License :: OSI Approved :: BSD License
|
|
11
|
-
Classifier: Programming Language :: Python :: 3.8
|
|
12
21
|
Classifier: Programming Language :: Python :: 3.9
|
|
13
22
|
Classifier: Programming Language :: Python :: 3.10
|
|
14
23
|
Classifier: Programming Language :: Python :: 3.11
|
|
15
24
|
Classifier: Programming Language :: Python :: 3.12
|
|
25
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
16
26
|
Classifier: Intended Audience :: Developers
|
|
17
|
-
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
18
27
|
Classifier: Topic :: Software Development :: Libraries
|
|
19
|
-
|
|
20
|
-
Requires-Python: >=3.8
|
|
28
|
+
Requires-Python: >=3.9
|
|
21
29
|
Description-Content-Type: text/markdown
|
|
22
30
|
License-File: LICENSE
|
|
23
31
|
Provides-Extra: numpy
|
|
24
|
-
Requires-Dist: numpy; extra == "numpy"
|
|
32
|
+
Requires-Dist: numpy>=1.25.0; extra == "numpy"
|
|
25
33
|
|
|
26
34
|
# timevec
|
|
27
35
|
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "timevec"
|
|
3
|
+
dynamic = ["version"]
|
|
4
|
+
requires-python = ">=3.9"
|
|
5
|
+
dependencies = []
|
|
6
|
+
description = "Get some usable vector representations of datetime."
|
|
7
|
+
readme = {file = "README.md", content-type = "text/markdown"}
|
|
8
|
+
license = { file = "LICENSE" }
|
|
9
|
+
authors = [
|
|
10
|
+
{name = "Yui KITSU", email = "kitsuyui+github@kitsuyui.com"}
|
|
11
|
+
]
|
|
12
|
+
classifiers = [
|
|
13
|
+
"Development Status :: 3 - Alpha",
|
|
14
|
+
"License :: OSI Approved :: BSD License",
|
|
15
|
+
"Programming Language :: Python :: 3.9",
|
|
16
|
+
"Programming Language :: Python :: 3.10",
|
|
17
|
+
"Programming Language :: Python :: 3.11",
|
|
18
|
+
"Programming Language :: Python :: 3.12",
|
|
19
|
+
"Programming Language :: Python :: 3.13",
|
|
20
|
+
"Intended Audience :: Developers",
|
|
21
|
+
"Topic :: Software Development :: Libraries",
|
|
22
|
+
]
|
|
23
|
+
[project.optional-dependencies]
|
|
24
|
+
numpy = [
|
|
25
|
+
# https://endoflife.date/numpy
|
|
26
|
+
"numpy>=1.25.0",
|
|
27
|
+
]
|
|
28
|
+
|
|
29
|
+
[project.urls]
|
|
30
|
+
Homepage = "https://github.com/kitsuyui/python-timevec"
|
|
31
|
+
|
|
32
|
+
[tool.uv]
|
|
33
|
+
dev-dependencies = [
|
|
34
|
+
"pytest",
|
|
35
|
+
"pytest-cov",
|
|
36
|
+
"poethepoet",
|
|
37
|
+
"setuptools-scm",
|
|
38
|
+
"ruff",
|
|
39
|
+
"mypy",
|
|
40
|
+
"numpy",
|
|
41
|
+
"matplotlib",
|
|
42
|
+
]
|
|
43
|
+
|
|
44
|
+
[tool.setuptools]
|
|
45
|
+
package-data = { "timevec" = ["py.typed"], "*" = ["README.md, LICENSE"] }
|
|
46
|
+
package-dir = { "timevec" = "timevec" }
|
|
47
|
+
|
|
48
|
+
[tool.poetry]
|
|
49
|
+
# I use poetry as just a package manager.
|
|
50
|
+
# So, I only write the settings that poetry needs.
|
|
51
|
+
# The actual package metadata is written in setup.cfg.
|
|
52
|
+
# I use pypa/build for packaging.
|
|
53
|
+
name = "timevec"
|
|
54
|
+
version = "0.0.0"
|
|
55
|
+
description = ""
|
|
56
|
+
authors = []
|
|
57
|
+
packages = [{ include = "timevec" }]
|
|
58
|
+
|
|
59
|
+
[build-system]
|
|
60
|
+
requires = ["setuptools", "setuptools_scm"]
|
|
61
|
+
build-backend = "setuptools.build_meta"
|
|
62
|
+
|
|
63
|
+
[tool.setuptools_scm]
|
|
64
|
+
write_to = "timevec/_version.py"
|
|
65
|
+
version_scheme = "only-version"
|
|
66
|
+
local_scheme = "no-local-version"
|
|
67
|
+
|
|
68
|
+
[tool.poe.tasks]
|
|
69
|
+
test = "pytest"
|
|
70
|
+
coverage-xml = "pytest --cov=timevec --doctest-modules --cov-report=xml"
|
|
71
|
+
format = "ruff format timevec"
|
|
72
|
+
check = [
|
|
73
|
+
{cmd = "ruff check timevec tests"},
|
|
74
|
+
{cmd = "mypy timevec tests"},
|
|
75
|
+
]
|
|
76
|
+
|
|
77
|
+
[tool.ruff]
|
|
78
|
+
line-length = 79
|
|
79
|
+
|
|
80
|
+
[tool.mypy]
|
|
81
|
+
strict = true
|
|
82
|
+
ignore_missing_imports = false
|
timevec-0.3.1/setup.cfg
ADDED
|
@@ -45,7 +45,7 @@ def assert_range_vector_value(
|
|
|
45
45
|
fn: Callable[[datetime.datetime], Tuple[float, float]],
|
|
46
46
|
*,
|
|
47
47
|
abs: float = 1e-6,
|
|
48
|
-
):
|
|
48
|
+
) -> None:
|
|
49
49
|
assert fn(range.begin) == pytest.approx((1.0, 0.0), abs=abs)
|
|
50
50
|
assert fn(range.end_of_first_quarter) == pytest.approx((0.0, 1.0), abs=abs)
|
|
51
51
|
assert fn(range.end_of_second_quarter) == pytest.approx((-1.0, 0.0), abs=abs)
|
|
@@ -1,18 +1,33 @@
|
|
|
1
|
+
from typing import Iterable, Literal
|
|
2
|
+
|
|
1
3
|
import timevec.numpy as tvn
|
|
2
4
|
import timevec.numpy_datetime64 as tv64
|
|
3
5
|
import timevec.builtin_math as tv
|
|
4
6
|
import numpy as np
|
|
5
7
|
import datetime
|
|
6
8
|
|
|
7
|
-
import pytest
|
|
8
|
-
|
|
9
9
|
|
|
10
10
|
def test_many_dates() -> None:
|
|
11
11
|
# start 1-01-01
|
|
12
12
|
dt = datetime.datetime(11, 1, 1, 0, 0, 0)
|
|
13
|
-
full
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
full: Iterable[
|
|
14
|
+
Literal[
|
|
15
|
+
"long_time",
|
|
16
|
+
"millennium",
|
|
17
|
+
"century",
|
|
18
|
+
"decade",
|
|
19
|
+
"year",
|
|
20
|
+
"month",
|
|
21
|
+
"week",
|
|
22
|
+
"day",
|
|
23
|
+
]
|
|
24
|
+
] = ["long_time", "millennium", "century", "decade", "year", "month", "week", "day"]
|
|
25
|
+
minimal: Iterable[Literal["long_time", "century", "year", "day"]] = [
|
|
26
|
+
"long_time",
|
|
27
|
+
"century",
|
|
28
|
+
"year",
|
|
29
|
+
"day",
|
|
30
|
+
]
|
|
16
31
|
|
|
17
32
|
# try all the functions does not raise an exception
|
|
18
33
|
for i in range(50000):
|
|
@@ -10,3 +10,24 @@ Day of the week ... periodicity in a week (distinction between weekdays and holi
|
|
|
10
10
|
When dealing with these, it is desirable to vectorize with periodicity in mind.
|
|
11
11
|
That is, at 23:59 on a given day, it is desirable that the value is close to 00:00 on the next day.
|
|
12
12
|
To achieve this, the time is represented as a combination of cos and sin."""
|
|
13
|
+
|
|
14
|
+
# https://packaging-guide.openastronomy.org/en/latest/advanced/versioning.html
|
|
15
|
+
from ._version import __version__
|
|
16
|
+
|
|
17
|
+
try:
|
|
18
|
+
from . import builtin_math
|
|
19
|
+
except ImportError:
|
|
20
|
+
pass
|
|
21
|
+
|
|
22
|
+
try:
|
|
23
|
+
from . import numpy_datetime64
|
|
24
|
+
except ImportError:
|
|
25
|
+
pass
|
|
26
|
+
|
|
27
|
+
try:
|
|
28
|
+
from . import numpy
|
|
29
|
+
except ImportError:
|
|
30
|
+
pass
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
__all__ = ["builtin_math", "numpy_datetime64", "numpy", "__version__"]
|
|
@@ -98,7 +98,7 @@ def datetime64_to_vecs(
|
|
|
98
98
|
dt: np.datetime64,
|
|
99
99
|
targets: Iterable[util.TARGET],
|
|
100
100
|
*,
|
|
101
|
-
dtype: npt.DTypeLike = np.float64
|
|
101
|
+
dtype: npt.DTypeLike = np.float64,
|
|
102
102
|
) -> Dict[util.TARGET, npt.NDArray]:
|
|
103
103
|
"""Convert a numpy.datetime64 to a vector"""
|
|
104
104
|
dt2 = datetime64_to_datetime(dt)
|
|
@@ -106,7 +106,7 @@ def datetime64_to_vecs(
|
|
|
106
106
|
|
|
107
107
|
|
|
108
108
|
def datetime64_from_vecs(
|
|
109
|
-
items: Dict[util.TARGET, npt.NDArray]
|
|
109
|
+
items: Dict[util.TARGET, npt.NDArray],
|
|
110
110
|
) -> np.datetime64:
|
|
111
111
|
"""Convert a vector to a numpy.datetime64"""
|
|
112
112
|
dt = tvn.datetime_from_vecs(items)
|
|
@@ -1,27 +1,35 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.2
|
|
2
2
|
Name: timevec
|
|
3
|
-
Version: 0.
|
|
4
|
-
Summary: Get some usable vector representations of datetime
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
Version: 0.3.1
|
|
4
|
+
Summary: Get some usable vector representations of datetime.
|
|
5
|
+
Author-email: Yui KITSU <kitsuyui+github@kitsuyui.com>
|
|
6
|
+
License: Copyright 2023-2025 Kitsu Yui
|
|
7
|
+
|
|
8
|
+
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
|
9
|
+
|
|
10
|
+
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
|
11
|
+
|
|
12
|
+
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
|
13
|
+
|
|
14
|
+
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
|
15
|
+
|
|
16
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
17
|
+
|
|
18
|
+
Project-URL: Homepage, https://github.com/kitsuyui/python-timevec
|
|
9
19
|
Classifier: Development Status :: 3 - Alpha
|
|
10
20
|
Classifier: License :: OSI Approved :: BSD License
|
|
11
|
-
Classifier: Programming Language :: Python :: 3.8
|
|
12
21
|
Classifier: Programming Language :: Python :: 3.9
|
|
13
22
|
Classifier: Programming Language :: Python :: 3.10
|
|
14
23
|
Classifier: Programming Language :: Python :: 3.11
|
|
15
24
|
Classifier: Programming Language :: Python :: 3.12
|
|
25
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
16
26
|
Classifier: Intended Audience :: Developers
|
|
17
|
-
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
18
27
|
Classifier: Topic :: Software Development :: Libraries
|
|
19
|
-
|
|
20
|
-
Requires-Python: >=3.8
|
|
28
|
+
Requires-Python: >=3.9
|
|
21
29
|
Description-Content-Type: text/markdown
|
|
22
30
|
License-File: LICENSE
|
|
23
31
|
Provides-Extra: numpy
|
|
24
|
-
Requires-Dist: numpy; extra == "numpy"
|
|
32
|
+
Requires-Dist: numpy>=1.25.0; extra == "numpy"
|
|
25
33
|
|
|
26
34
|
# timevec
|
|
27
35
|
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
.flake8
|
|
2
1
|
.gitignore
|
|
3
2
|
.gitignore.in
|
|
4
3
|
LICENSE
|
|
5
4
|
README.md
|
|
6
5
|
mypy.ini
|
|
7
|
-
poetry.lock
|
|
8
6
|
pyproject.toml
|
|
9
|
-
|
|
7
|
+
uv.lock
|
|
10
8
|
.github/renovate.json5
|
|
9
|
+
.github/workflows/gitignore-in.yml
|
|
11
10
|
.github/workflows/happy.yml
|
|
12
11
|
.github/workflows/pypi-publish.yml
|
|
13
12
|
.github/workflows/python-test.yml
|