Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion .github/workflows/doc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
uses: actions/checkout@v6
with: { submodules: recursive }
- uses: prefix-dev/setup-pixi@v0.9.3
with: { pixi-version: v0.50.2 }
with: { pixi-version: v0.63.2 }
- name: build documentation
run: |
pixi run doc
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- name: checkout
uses: actions/checkout@v6
- uses: prefix-dev/setup-pixi@v0.9.3
with: { pixi-version: v0.50.2 }
with: { pixi-version: v0.63.2 }
- name: pylint
run: pixi run pylint
- name: black
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
with: { submodules: recursive }
- uses: prefix-dev/setup-pixi@v0.9.3
with:
pixi-version: v0.50.2
pixi-version: v0.63.2
- name: doctest
run: |
pixi run -e ${{ matrix.environment }} doctest ${{ matrix.remote-data == 'remote' && '--remote-data' || '' }}
Expand Down
24 changes: 24 additions & 0 deletions doc/news/load-metadata.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
**Added:**

* Added <news item>.

**Changed:**

* Changed <news item>.

**Removed:**

* Removed deprecated module `cv_collection`.
* Removed deprecated module `cv_entry`.

**Fixed:**

* Fixed <news item>.

**Deprecated:**

* Deprecated <news item>.

**Performance:**

* Improved <news item>.
4 changes: 4 additions & 0 deletions examples/from_csv/from_csv_multiple_headers.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
E,j
V,A / cm2
1,2
3,4
21 changes: 19 additions & 2 deletions pixi.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ unitpackage = "unitpackage.entrypoint:cli"
[tool.setuptools]
packages = [
"unitpackage",
"unitpackage.cv",
"unitpackage.database",
"unitpackage.electrochemistry",
"unitpackage.loaders",
Expand Down
63 changes: 4 additions & 59 deletions unitpackage/collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@
Search the collection for entries, for example,
from a single publication providing its DOI::

>>> collection.filter(lambda entry: entry.source.url == 'https://doi.org/10.1039/C0CP01001D') # doctest: +REMOTE_DATA
>>> collection.filter(lambda entry: entry.echemdb.source.url == 'https://doi.org/10.1039/C0CP01001D') # doctest: +REMOTE_DATA
[Entry('alves_2011_electrochemistry_6010_f1a_solid'), ...

"""

# ********************************************************************
# This file is part of unitpackage.
#
# Copyright (C) 2021-2025 Albert Engstfeld
# Copyright (C) 2021-2026 Albert Engstfeld
# Copyright (C) 2021 Johannes Hermann
# Copyright (C) 2021-2022 Julian Rüth
# Copyright (C) 2021 Nicolas Hörmann
Expand All @@ -47,7 +47,6 @@
# along with unitpackage. If not, see <https://www.gnu.org/licenses/>.
# ********************************************************************
import logging
from functools import cached_property

from frictionless import Package

Expand Down Expand Up @@ -138,68 +137,14 @@ def create_example(cls):
package=package,
)

@cached_property
def bibliography(self):
r"""
Return a pybtex database of all bibtex bibliography files,
associated with the entries.

EXAMPLES::

>>> collection = Collection.create_example()
>>> collection.bibliography
BibliographyData(
entries=OrderedCaseInsensitiveDict([
('alves_2011_electrochemistry_6010', Entry('article',
...
('engstfeld_2018_polycrystalline_17743', Entry('article',
...

A derived collection includes only the bibliographic entries of the remaining entries::

>>> collection.filter(lambda entry: entry.source.citationKey != 'alves_2011_electrochemistry_6010').bibliography
BibliographyData(
entries=OrderedCaseInsensitiveDict([
('engstfeld_2018_polycrystalline_17743', Entry('article',
...

A collection with entries without bibliography::

>>> collection = Collection.create_example()["no_bibliography"]
>>> collection.bibliography
''

"""
from pybtex.database import BibliographyData

bib_data = BibliographyData(
{
entry.bibliography.key: entry.bibliography
for entry in self
if entry.bibliography
}
)

if isinstance(bib_data, str):
return bib_data

# Remove duplicates from the bibliography
bib_data_ = BibliographyData()

for key, entry in bib_data.entries.items():
if key not in bib_data_.entries:
bib_data_.add_entry(key, entry)

return bib_data_

def filter(self, predicate):
r"""
Return the subset of the collection that satisfies predicate.

EXAMPLES::

>>> collection = Collection.create_example()
>>> collection.filter(lambda entry: entry.source.url == 'https://doi.org/10.1039/C0CP01001D')
>>> collection.filter(lambda entry: entry.echemdb.source.url == 'https://doi.org/10.1039/C0CP01001D')
[Entry('alves_2011_electrochemistry_6010_f1a_solid')]


Expand Down Expand Up @@ -610,7 +555,7 @@ def from_remote(cls, url=None, data=None, outdir=None):

>>> from unitpackage.collection import Collection
>>> collection = Collection.from_remote() # doctest: +REMOTE_DATA
>>> collection.filter(lambda entry: entry.source.url == 'https://doi.org/10.1039/C0CP01001D') # doctest: +REMOTE_DATA
>>> collection.filter(lambda entry: entry.echemdb.source.url == 'https://doi.org/10.1039/C0CP01001D') # doctest: +REMOTE_DATA
[Entry('alves_2011_electrochemistry_6010_f1a_solid'), Entry('alves_2011_electrochemistry_6010_f2_red')]

The folder containing the data in the zip can be specified with the :param data:.
Expand Down
Empty file removed unitpackage/cv/__init__.py
Empty file.
128 changes: 0 additions & 128 deletions unitpackage/cv/cv_collection.py

This file was deleted.

Loading
Loading