Science Score: 57.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
✓CITATION.cff file
Found CITATION.cff file -
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
✓DOI references
Found 3 DOI reference(s) in README -
○Academic publication links
-
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (7.5%) to scientific vocabulary
Keywords
Repository
Data specifications by data classes
Basic Info
- Host: GitHub
- Owner: astropenguin
- License: mit
- Language: Python
- Default Branch: main
- Homepage: https://astropenguin.github.io/dataspecs/v4.0.0
- Size: 1.67 MB
Statistics
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
- Releases: 17
Topics
Metadata Files
README.md
dataspecs
Data specifications by data classes
Installation
shell
pip install dataspecs
Basic usage
Common imports and tags
```python from dataclasses import dataclass from dataspecs import TagBase, from_dataclass from enum import auto from typing import Annotated as Ann
class Tag(TagBase): ATTR = auto() DATA = auto() DTYPE = auto() ```
Simple specifications
```python @dataclass class Weather: temp: list[float] humid: list[float] location: str
specs = from_dataclass(Weather([20.0, 25.0], [50.0, 55.0], "Tokyo"))
print(specs)
Specs([
Spec(path=Path('/temp'), name='temp', tags=(), type=list[float], data=[20.0, 25.0]),
Spec(path=Path('/temp/0'), name='0', tags=(), type=
Simple specifications with tags
```python @dataclass class Weather: temp: Ann[list[float], Tag.DATA] humid: Ann[list[float], Tag.DATA] location: str
specs = from_dataclass(Weather([20.0, 25.0], [50.0, 55.0], "Tokyo"))
print(specs)
Specs([
Spec(path=Path('/temp'), name='temp', tags=(
Nested specifications (with tags)
```python @dataclass class Meta: units: Ann[str, Tag.ATTR]
@dataclass class Weather: temp: Ann[list[Ann[float, Tag.DTYPE]], Tag.DATA, Meta("degC")] humid: Ann[list[Ann[float, Tag.DTYPE]], Tag.DATA, Meta("%")] location: str
specs = from_dataclass(Weather([20.0, 25.0], [50.0, 55.0], "Tokyo"))
print(specs)
Specs([
Spec(path=Path('/temp'), name='temp', tags=(
Selecting specifications
python
specs[Tag.DATA]
Specs([
Spec(path=Path('/temp'), name='temp', tags=(<Tag.DATA: 2>,), type=list[float], data=[20.0, 25.0]),
Spec(path=Path('/humid'), name='humid', tags=(<Tag.DATA: 2>,), type=list[float], data=[50.0, 55.0]),
])
python
specs[Tag]
Specs([
Spec(path=Path('/temp'), name='temp', tags=(<Tag.DATA: 2>,), type=list[float], data=[20.0, 25.0]),
Spec(path=Path('/temp/0'), name='0', tags=(<Tag.DTYPE: 3>,), type=<class 'float'>, data=None),
Spec(path=Path('/temp/units'), name='units', tags=(<Tag.ATTR: 1>,), type=<class 'str'>, data='degC'),
Spec(path=Path('/humid'), name='humid', tags=(<Tag.DATA: 2>,), type=list[float], data=[50.0, 55.0]),
Spec(path=Path('/humid/0'), name='0', tags=(<Tag.DTYPE: 3>,), type=<class 'float'>, data=None),
Spec(path=Path('/humid/units'), name='units', tags=(<Tag.ATTR: 1>,), type=<class 'str'>, data='%'),
])
python
specs[str]
Specs([
Spec(path=Path('/temp/units'), name='units', tags=(<Tag.ATTR: 1>,), type=<class 'str'>, data='degC'),
Spec(path=Path('/humid/units'), name='units', tags=(<Tag.ATTR: 1>,), type=<class 'str'>, data='%'),
Spec(path=Path('/location'), name='location', tags=(), type=<class 'str'>, data='Tokyo'),
])
python
specs["/temp/[a-z]+"]
Specs([
Spec(path=Path('/temp/units'), name='units', tags=(<Tag.ATTR: 1>,), type=<class 'str'>, data='degC'),
])
Grouping specifications
python
specs.groupby("tags")
[
Specs([
Spec(path=Path('/temp'), name='temp', tags=(<Tag.DATA: 2>,), type=list[float], data=[20.0, 25.0]),
Spec(path=Path('/humid'), name='humid', tags=(<Tag.DATA: 2>,), type=list[float], data=[50.0, 55.0]),
]),
Specs([
Spec(path=Path('/temp/0'), name='0', tags=(<Tag.DTYPE: 3>,), type=<class 'float'>, data=None),
Spec(path=Path('/humid/0'), name='0', tags=(<Tag.DTYPE: 3>,), type=<class 'float'>, data=None),
]),
Specs([
Spec(path=Path('/temp/units'), name='units', tags=(<Tag.ATTR: 1>,), type=<class 'str'>, data='degC'),
Spec(path=Path('/humid/units'), name='units', tags=(<Tag.ATTR: 1>,), type=<class 'str'>, data='%'),
]),
Specs([
Spec(path=Path('/location'), name='location', tags=(), type=<class 'str'>, data='Tokyo'),
]),
]
Advanced usage
Formatting specifications
```python from dataspecs import Format, format
@dataclass class Meta: units: Ann[str, Tag.ATTR]
@dataclass class Weather: temp: Ann[float, Meta("{0}")] humid: Ann[float, Meta("{0}")] tempunits: Ann[str, Format("/temp/units")] humidunits: Ann[str, Format("/humid/units")]
format(fromdataclass(Weather(20.0, 50.0, "degC", "%")))
Specs([
Spec(path=Path('/temp'), name='temp', tags=(), type=
Naming specifications
```python from dataspecs import Name, name
@dataclass class Weather: temp: Ann[float, Name("Ground temperature")] humid: Ann[float, Name("Relative humidity")]
name(from_dataclass(Weather(20.0, 50.0)))
Specs([
Spec(path=Path('/temp'), name='Ground temperature', tags=(), type=
Replacing specifications
```python from dataspecs import Replace, replace
@dataclass class Weather: temp: Ann[list[Ann[float, Tag.DTYPE]], Tag.DATA] humid: Ann[list[Ann[float, Tag.DTYPE]], Tag.DATA] dtype: Ann[type, Replace("/[a-z]+/0", "type")]
replace(from_dataclass(Weather([20.0, 25.0], [50.0, 55.0], int)))
Specs([
Spec(path=Path('/temp'), name='temp', tags=(
Specification rules
First union type as representative type
```python @dataclass class Weather: temp: list[int | float] | (int | float)
from_dataclass(Weather(0.0))
Specs([
Spec(path=Path('/temp'), name='temp', tags=(), type=list[int | float], data=0.0),
Spec(path=Path('/temp/0'), name='0', tags=(), type=
Owner
- Name: Akio Taniguchi
- Login: astropenguin
- Kind: user
- Location: Nagoya, Japan
- Company: Nagoya University
- Website: https://astropengu.in
- Twitter: astropengu_in
- Repositories: 76
- Profile: https://github.com/astropenguin
Project assistant professor (LMT-FINER)
Citation (CITATION.cff)
# This CITATION.cff file was generated with cffinit.
# Visit https://bit.ly/cffinit to generate yours today!
cff-version: 1.2.0
title: dataspecs
message: >-
If you use this software, please cite it using the
metadata from this file.
type: software
authors:
- given-names: Akio
family-names: Taniguchi
email: taniguchi.akio@gmail.com
affiliation: Kitami Institute of Technology
orcid: 'https://orcid.org/0000-0002-9695-6183'
identifiers:
- type: doi
value: 10.5281/zenodo.10652375
repository-code: 'https://github.com/astropenguin/dataspecs'
url: 'https://astropenguin.github.io/dataspecs/v5.0.0'
abstract: Data specifications by data classes
keywords:
- python
- dataclasses
- specifications
- typing
license: MIT
version: 5.0.0
date-released: '2025-01-14'
GitHub Events
Total
- Create event: 25
- Release event: 8
- Issues event: 43
- Watch event: 2
- Delete event: 18
- Push event: 74
- Pull request event: 39
Last Year
- Create event: 25
- Release event: 8
- Issues event: 43
- Watch event: 2
- Delete event: 18
- Push event: 74
- Pull request event: 39
Issues and Pull Requests
Last synced: 6 months ago
All Time
- Total issues: 53
- Total pull requests: 61
- Average time to close issues: 24 days
- Average time to close pull requests: 3 days
- Total issue authors: 1
- Total pull request authors: 1
- Average comments per issue: 0.0
- Average comments per pull request: 0.0
- Merged pull requests: 54
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 23
- Pull requests: 37
- Average time to close issues: 12 days
- Average time to close pull requests: 1 day
- Issue authors: 1
- Pull request authors: 1
- Average comments per issue: 0.0
- Average comments per pull request: 0.0
- Merged pull requests: 31
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- astropenguin (54)
Pull Request Authors
- astropenguin (87)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 1
-
Total downloads:
- pypi 128 last-month
- Total dependent packages: 0
- Total dependent repositories: 0
- Total versions: 17
- Total maintainers: 1
pypi.org: dataspecs
Data specifications by data classes
- Documentation: https://dataspecs.readthedocs.io/
- License: MIT License Copyright (c) 2023-2025 Akio Taniguchi 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 the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
Latest release: 5.0.0
published about 1 year ago
Rankings
Maintainers (1)
Dependencies
- actions/checkout v3 composite
- actions/setup-python v4 composite
- actions/checkout v3 composite
- actions/setup-python v4 composite
- black 23.9.1
- click 8.1.7
- colorama 0.4.6
- exceptiongroup 1.1.3
- iniconfig 2.0.0
- mypy 1.5.1
- mypy-extensions 1.0.0
- nodeenv 1.8.0
- packaging 23.1
- pathspec 0.11.2
- platformdirs 3.10.0
- pluggy 1.3.0
- pyright 1.1.327
- pytest 7.4.2
- setuptools 68.2.2
- tomli 2.0.1
- typing-extensions 4.8.0
- python ^3.9
- abatilo/actions-poetry v2 composite
- actions/checkout v3 composite
- actions/setup-python v4 composite
- peaceiris/actions-gh-pages v3 composite