Skip to content

Commit d352170

Browse files
authored
Merge pull request #82 from pepkit/release/0.14.0
Release/0.14.0
2 parents ecaa6db + 34a8331 commit d352170

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+580
-702
lines changed

.github/workflows/black.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ jobs:
66
lint:
77
runs-on: ubuntu-latest
88
steps:
9-
- uses: actions/checkout@v2
10-
- uses: actions/setup-python@v2
11-
- uses: psf/black@stable
9+
- uses: actions/checkout@v6
10+
- uses: actions/setup-python@v6
11+
with:
12+
python-version: "3.12"
13+
- run: pip install ruff
14+
- run: ruff check .
15+
- run: ruff format --check .
Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
# This workflows will upload a Python Package using Twine when a release is created
2-
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
3-
41
name: Upload Python Package
52

63
on:
@@ -9,23 +6,21 @@ on:
96

107
jobs:
118
deploy:
12-
139
runs-on: ubuntu-latest
10+
name: upload release to PyPI
11+
permissions:
12+
contents: read
13+
id-token: write
1414

1515
steps:
16-
- uses: actions/checkout@v2
16+
- uses: actions/checkout@v6
1717
- name: Set up Python
18-
uses: actions/setup-python@v2
18+
uses: actions/setup-python@v6
1919
with:
2020
python-version: '3.x'
21-
- name: Install dependencies
22-
run: |
23-
python -m pip install --upgrade pip
24-
pip install setuptools wheel twine
25-
- name: Build and publish
26-
env:
27-
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
28-
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
29-
run: |
30-
python setup.py sdist bdist_wheel
31-
twine upload dist/*
21+
- name: Install build dependencies
22+
run: python -m pip install --upgrade pip build
23+
- name: Build package
24+
run: python -m build
25+
- name: Publish package distributions to PyPI
26+
uses: pypa/gh-action-pypi-publish@release/v1

.github/workflows/run-codecov.yml

Lines changed: 0 additions & 21 deletions
This file was deleted.

.github/workflows/run-pytest.yml

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Run pytests
22

33
on:
44
push:
5-
branches: [dev]
5+
branches: [master, dev]
66
pull_request:
77
branches: [master]
88

@@ -11,25 +11,19 @@ jobs:
1111
runs-on: ${{ matrix.os }}
1212
strategy:
1313
matrix:
14-
python-version: [3.6, 3.9]
14+
python-version: ["3.8", "3.14"]
1515
os: [ubuntu-latest]
1616

1717
steps:
18-
- uses: actions/checkout@v2
18+
- uses: actions/checkout@v6
1919

2020
- name: Set up Python ${{ matrix.python-version }}
21-
uses: actions/setup-python@v2
21+
uses: actions/setup-python@v6
2222
with:
2323
python-version: ${{ matrix.python-version }}
2424

25-
- name: Install dev dependencies
26-
run: if [ -f requirements/requirements-dev.txt ]; then pip install -r requirements/requirements-dev.txt; fi
27-
28-
- name: Install test dependencies
29-
run: if [ -f requirements/requirements-test.txt ]; then pip install -r requirements/requirements-test.txt; fi
30-
31-
- name: Install attmap
32-
run: python -m pip install .
25+
- name: Install package with test dependencies
26+
run: python -m pip install ".[test]"
3327

3428
- name: Run pytest tests
35-
run: pytest tests --cov=./ --cov-report=xml
29+
run: pytest tests

.pre-commit-config.yaml

Lines changed: 0 additions & 21 deletions
This file was deleted.

MANIFEST.in

Lines changed: 0 additions & 3 deletions
This file was deleted.

README.md

Lines changed: 52 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,56 @@
11
# attmap
22

3-
[![Build Status](https://travis-ci.org/pepkit/attmap.svg?branch=master)](https://travis-ci.org/pepkit/attmap)
4-
[![Coverage Status](https://coveralls.io/repos/github/pepkit/attmap/badge.svg?branch=master)](https://coveralls.io/github/pepkit/attmap?branch=master)
3+
[![Run pytests](https://github.com/pepkit/attmap/actions/workflows/run-pytest.yml/badge.svg)](https://github.com/pepkit/attmap/actions/workflows/run-pytest.yml)
54

6-
Key-value Mapping supporting nesting and attribute-style access
5+
Key-value Mapping supporting nesting and attribute-style access.
76

8-
Originally motivated by and designed for the [pepkit family projects](https://pepkit.github.io/).
7+
**Note:** This package is no longer actively developed. Consider using plain dicts or dataclasses for new projects.
8+
9+
Originally designed for the [pepkit family projects](https://pepkit.github.io/).
10+
11+
## Install
12+
13+
```
14+
pip install attmap
15+
```
16+
17+
## Class hierarchy
18+
19+
- `AttMapLike` (abstract base)
20+
- `AttMap` — dict-backed mapping with dot notation access
21+
- `OrdAttMap` — insertion-ordered (extends `OrderedDict`)
22+
- `PathExAttMap` — expands environment variables in path-like string values
23+
- `EchoAttMap` — returns the key itself when a value is not set
24+
25+
## Customizing subclasses
26+
27+
### Excluding keys from text representation
28+
29+
Override `_excl_from_repr` in a subclass:
30+
31+
```python
32+
def _excl_from_repr(self, k, cls):
33+
protected = ["reserved_metadata", "REZKEY"]
34+
return k in protected
35+
```
36+
37+
### Excluding class name from repr
38+
39+
Override `__repr__` using the `exclude_class_list` argument to `_render`:
40+
41+
```python
42+
def __repr__(self):
43+
return self._render(
44+
self._simplify_keyvalue(self._data_for_repr(), self._new_empty_basic_map),
45+
exclude_class_list="YacAttMap",
46+
)
47+
```
48+
49+
### Excluding classes from `to_dict` conversion
50+
51+
Override `_excl_classes_from_todict`:
52+
53+
```python
54+
def _excl_classes_from_todict(self):
55+
return (pandas.DataFrame, ClassToExclude)
56+
```

attmap/__init__.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
""" Package-scope definitions """
1+
"""Dot notation support for Mappings."""
22

33
from ._att_map_like import AttMapLike
4-
from ._version import __version__
54
from .attmap import AttMap
65
from .attmap_echo import *
76
from .helpers import *

0 commit comments

Comments
 (0)