-
Notifications
You must be signed in to change notification settings - Fork 21
skpkg: getting package up to scikit-package
CI standards
#340
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
Changes from all commits
6977f3e
bd4fa97
d292578
3227e2f
cd84158
9170c23
bd3f896
09b3d8f
e5ad3ab
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
**Added:** | ||
|
||
* <news item> | ||
|
||
**Changed:** | ||
|
||
* <news item> | ||
|
||
**Deprecated:** | ||
|
||
* <news item> | ||
|
||
**Removed:** | ||
|
||
* <news item> | ||
|
||
**Fixed:** | ||
|
||
* Support ``scikit-package`` Level 5 standard for file structure and CI workflow (https://scikit-package.github.io/scikit-package/). | ||
|
||
|
||
**Security:** | ||
|
||
* <news item> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,7 @@ | ||
#!/usr/bin/env python | ||
############################################################################## | ||
# | ||
# diffpy by DANSE Diffraction group | ||
# Simon J. L. Billinge | ||
# (c) 2010 The Trustees of Columbia University | ||
# in the City of New York. All rights reserved. | ||
# (c) 2024 The Trustees of Columbia University in the City of New York. | ||
# (c) 2025 The Trustees of Columbia University in the City of New York. | ||
# All rights reserved. | ||
# | ||
# File coded by: Billinge Group members and community contributors. | ||
|
@@ -16,14 +12,3 @@ | |
# See LICENSE.rst for license information. | ||
# | ||
############################################################################## | ||
"""diffpy - tools for structure analysis by diffraction. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. its unlikely that we want to delete the contents of this file. But I am not sure. Is this a new development that we can handle the namespace strcture (diffpy.something) without this extend path? We may want to ask @bobleesj There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. An empty The namespace's``init.py
|
||
|
||
Blank namespace package. | ||
""" | ||
|
||
|
||
from pkgutil import extend_path | ||
|
||
__path__ = extend_path(__path__, __name__) | ||
|
||
# End of file |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,23 @@ | ||
#!/usr/bin/env python | ||
############################################################################## | ||
# | ||
# (c) 2024 The Trustees of Columbia University in the City of New York. | ||
# (c) 2025 The Trustees of Columbia University in the City of New York. | ||
# All rights reserved. | ||
# | ||
# File coded by: Billinge Group members and community contributors. | ||
# File coded by: Simon Billinge, Billinge Group members. | ||
# | ||
# See GitHub contributions for a more detailed list of contributors. | ||
# https://github.com/diffpy/diffpy.utils/graphs/contributors | ||
# | ||
# See LICENSE.rst for license information. | ||
# | ||
############################################################################## | ||
"""Shared utilities for diffpy packages.""" | ||
"""General utilities for analyzing diffraction data.""" | ||
|
||
# package version | ||
from diffpy.utils.version import __version__ | ||
from diffpy.utils.version import __version__ # noqa | ||
|
||
# silence the pyflakes syntax checker | ||
assert __version__ or True | ||
|
||
# End of file |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,112 +1,19 @@ | ||
import json | ||
from pathlib import Path | ||
|
||
import numpy as np | ||
import pytest | ||
|
||
from diffpy.utils.diffraction_objects import DiffractionObject | ||
|
||
|
||
@pytest.fixture | ||
def user_filesystem(tmp_path): | ||
base_dir = Path(tmp_path) | ||
home_dir = base_dir / "home_dir" | ||
home_dir.mkdir(parents=True, exist_ok=True) | ||
cwd_dir = home_dir / "cwd_dir" | ||
cwd_dir = base_dir / "cwd_dir" | ||
cwd_dir.mkdir(parents=True, exist_ok=True) | ||
home_config_data = { | ||
"owner_name": "home_ownername", | ||
"owner_email": "home@email.com", | ||
"owner_orcid": "home_orcid", | ||
} | ||
|
||
home_config_data = {"username": "home_username", "email": "home@email.com"} | ||
with open(home_dir / "diffpyconfig.json", "w") as f: | ||
json.dump(home_config_data, f) | ||
yield home_dir, cwd_dir | ||
|
||
|
||
@pytest.fixture | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. do you want to delete all our tests? |
||
def datafile(): | ||
"""Fixture to dynamically load any test file.""" | ||
base_path = Path(__file__).parent / "testdata" # Adjusted base path | ||
|
||
def _load(filename): | ||
return base_path / filename | ||
|
||
return _load | ||
|
||
|
||
@pytest.fixture | ||
def do_minimal(): | ||
# Create an instance of DiffractionObject with empty xarray and yarray | ||
# values, and a non-empty wavelength | ||
return DiffractionObject( | ||
xarray=np.empty(0), yarray=np.empty(0), xtype="tth", wavelength=1.54 | ||
) | ||
|
||
|
||
@pytest.fixture | ||
def do_minimal_tth(): | ||
# Create an instance of DiffractionObject with non-empty xarray, yarray, | ||
# and wavelength values | ||
return DiffractionObject( | ||
wavelength=2 * np.pi, | ||
xarray=np.array([30, 60]), | ||
yarray=np.array([1, 2]), | ||
xtype="tth", | ||
) | ||
|
||
|
||
@pytest.fixture | ||
def do_minimal_d(): | ||
# Create an instance of DiffractionObject with non-empty xarray, yarray, | ||
# and wavelength values | ||
return DiffractionObject( | ||
wavelength=1.54, | ||
xarray=np.array([1, 2]), | ||
yarray=np.array([1, 2]), | ||
xtype="d", | ||
) | ||
|
||
|
||
@pytest.fixture | ||
def wavelength_warning_msg(): | ||
return ( | ||
"No wavelength has been specified. You can continue to use the " | ||
"DiffractionObject, but some of its powerful features will not be " | ||
"available. " | ||
"To specify a wavelength, if you have " | ||
"do = DiffractionObject(xarray, yarray, 'tth'), " | ||
"you may set do.wavelength = 1.54 for a wavelength of 1.54 angstroms." | ||
) | ||
|
||
|
||
@pytest.fixture | ||
def invalid_q_or_d_or_wavelength_error_msg(): | ||
return ( | ||
"The supplied input array and wavelength will result in an " | ||
"impossible two-theta. " | ||
"Please check these values and re-instantiate the DiffractionObject " | ||
"with correct values." | ||
) | ||
|
||
|
||
@pytest.fixture | ||
def invalid_add_type_error_msg(): | ||
return ( | ||
"You may only add a DiffractionObject with another DiffractionObject " | ||
"or a scalar value. " | ||
"Please rerun by adding another DiffractionObject instance or a " | ||
"scalar value. " | ||
"e.g., my_do_1 + my_do_2 or my_do + 10 or 10 + my_do" | ||
) | ||
|
||
|
||
@pytest.fixture | ||
def x_values_not_equal_error_msg(): | ||
return ( | ||
"The two objects have different values in x arrays " | ||
"(my_do.all_arrays[:, [1, 2, 3]]). " | ||
"Please ensure the x values of the two objects are identical " | ||
"by re-instantiating the DiffractionObject with the correct x value " | ||
"inputs." | ||
) | ||
yield tmp_path |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
"""Unit tests for __version__.py.""" | ||
|
||
import diffpy.utils | ||
import diffpy.utils # noqa | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is probably ok to leave these There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @sbillinge I'll investigate to see if there is a way to remove this. There might be a shell script we can run that removes this after the package is created. Something like There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. no shell script, but maybe something in the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @bobleesj Do you have any insight on how this might be done? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why did you add
|
||
|
||
|
||
def test_package_version(): | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please check the license to make sure it is BSD before accepting this change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sbillinge confirmed BSD from skpkg
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The relevant license is the diffpy.utils license not the skpkg license. What is the current diffpy.utils license.