-
Notifications
You must be signed in to change notification settings - Fork 1
skpkg: migrate src folder, migrate test folder #23
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 2 commits
f861952
ef02af3
22c82cf
3b68bab
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 |
|---|---|---|
| @@ -1,18 +1,14 @@ | ||
| #!/usr/bin/env python | ||
| ############################################################################## | ||
| # | ||
| # dpx.pdfgetxgui by Simon J. L. Billinge group | ||
| # (c) 2012 Trustees of the Columbia University | ||
| # in the City of New York. All rights reserved. | ||
| # (c) 2025 The Trustees of Columbia University in the City of New York. | ||
| # All rights reserved. | ||
| # | ||
| # File coded by: Xiaohao Yang | ||
| # File coded by: Billinge Group members and community contributors. | ||
|
||
| # | ||
| # See AUTHORS.txt for a list of people who contributed. | ||
| # See LICENSE.txt for license information. | ||
| # See GitHub contributions for a more detailed list of contributors. | ||
| # https://github.com/diffpy/diffpy.srxplanargui/graphs/contributors | ||
| # | ||
| # See LICENSE.rst for license information. | ||
| # | ||
| ############################################################################## | ||
| """Blank namespace package.""" | ||
|
|
||
| __import__("pkg_resources").declare_namespace(__name__) | ||
|
|
||
| # End of file | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,19 +1,23 @@ | ||
| #!/usr/bin/env python | ||
| ############################################################################## | ||
| # | ||
| # dpx.pdfgetxgui by Simon J. L. Billinge group | ||
| # (c) 2012 Trustees of the Columbia University | ||
| # in the City of New York. All rights reserved. | ||
| # (c) 2025 The Trustees of Columbia University in the City of New York. | ||
|
||
| # All rights reserved. | ||
| # | ||
| # File coded by: Xiaohao Yang | ||
| # File coded by: Rundong Hua, Simon Billinge, Billinge Group members. | ||
|
||
| # | ||
| # See AUTHORS.txt for a list of people who contributed. | ||
| # See LICENSE.txt for license information. | ||
| # See GitHub contributions for a more detailed list of contributors. | ||
| # https://github.com/diffpy/diffpy.srxplanargui/graphs/contributors | ||
| # | ||
| # See LICENSE.rst for license information. | ||
| # | ||
| ############################################################################## | ||
| """xPDFsuite, a software for PDF transformation and visualization.""" | ||
|
|
||
| # package version | ||
| from diffpy.srxplanargui.version import __version__ # noqa | ||
|
|
||
| # obtain version information | ||
| # from diffpy.srxplanargui.version import __version__ | ||
| # silence the pyflakes syntax checker | ||
| assert __version__ or True | ||
|
|
||
| # End of file | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| import argparse | ||
|
|
||
| from diffpy.srxplanargui.version import __version__ # noqa | ||
|
|
||
|
|
||
| def main(): | ||
| parser = argparse.ArgumentParser( | ||
| prog="diffpy.srxplanargui", | ||
| description=( | ||
| "xPDFsuite, a software for PDF transformation and visualization.\n\n" | ||
| "For more information, visit: " | ||
| "https://github.com/diffpy/diffpy.srxplanargui/" | ||
| ), | ||
| formatter_class=argparse.RawDescriptionHelpFormatter, | ||
| ) | ||
|
|
||
| parser.add_argument( | ||
| "--version", | ||
| action="store_true", | ||
| help="Show the program's version number and exit", | ||
| ) | ||
|
|
||
| args = parser.parse_args() | ||
|
|
||
| if args.version: | ||
| print(f"diffpy.srxplanargui {__version__}") | ||
| else: | ||
| # Default behavior when no arguments are given | ||
| parser.print_help() | ||
|
|
||
|
|
||
| if __name__ == "__main__": | ||
| main() |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,28 +1,26 @@ | ||
| #!/usr/bin/env python | ||
| ############################################################################## | ||
| # | ||
| # diffpy.srxplanar by DANSE Diffraction group | ||
| # Simon J. L. Billinge | ||
| # (c) 2010 Trustees of the Columbia University | ||
| # in the City of New York. All rights reserved. | ||
| # (c) 2025 The Trustees of Columbia University in the City of New York. | ||
|
||
| # All rights reserved. | ||
| # | ||
| # File coded by: Xiaohao Yang | ||
| # File coded by: Rundong Hua, Simon Billinge, Billinge Group members. | ||
|
||
| # | ||
| # See AUTHORS.txt for a list of people who contributed. | ||
| # See LICENSENOTICE.txt for license information. | ||
| # See GitHub contributions for a more detailed list of contributors. | ||
| # https://github.com/diffpy/diffpy.srxplanargui/graphs/contributors # noqa: E501 | ||
| # | ||
| # See LICENSE.rst for license information. | ||
| # | ||
| ############################################################################## | ||
| """Definition of __version__ and __date__ for this package.""" | ||
|
|
||
| # obtain version information | ||
| from pkg_resources import get_distribution | ||
| """Definition of __version__.""" | ||
|
|
||
| _pkgname = __name__.rsplit(".", 1)[0] | ||
| __version__ = get_distribution(_pkgname).version | ||
| # We do not use the other three variables, but can be added back if needed. | ||
| # __all__ = ["__date__", "__git_commit__", "__timestamp__", "__version__"] | ||
|
|
||
| # we assume that tag_date was used and __version__ ends in YYYYMMDD | ||
| __date__ = ( | ||
| __version__[-8:-4] + "-" + __version__[-4:-2] + "-" + __version__[-2:] | ||
| ) | ||
| # obtain version information | ||
| from importlib.metadata import PackageNotFoundError, version | ||
|
|
||
| # End of file | ||
| try: | ||
| __version__ = version("diffpy.srxplanargui") | ||
| except PackageNotFoundError: | ||
| __version__ = "unknown" | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| import json | ||
| from pathlib import Path | ||
|
|
||
| import pytest | ||
|
|
||
|
|
||
| @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 = base_dir / "cwd_dir" | ||
| cwd_dir.mkdir(parents=True, exist_ok=True) | ||
|
|
||
| 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 tmp_path |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| """Unit tests for __version__.py.""" | ||
|
|
||
| import diffpy.srxplanargui # noqa | ||
|
|
||
|
|
||
| def test_package_version(): | ||
| """Ensure the package version is defined and not set to the initial | ||
| placeholder.""" | ||
| assert hasattr(diffpy.srxplanargui, "__version__") | ||
| assert diffpy.srxplanargui.__version__ != "0.0.0" |
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.
This should be
2012-2025. In general, it will go from the old date to the current date.