Skip to content

Commit

Permalink
finishing the recut
Browse files Browse the repository at this point in the history
  • Loading branch information
sbillinge committed Sep 16, 2024
1 parent 8a29941 commit 153f843
Show file tree
Hide file tree
Showing 14 changed files with 225 additions and 154 deletions.
2 changes: 1 addition & 1 deletion .codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ coverage:
target: auto
if_no_uploads: error
if_not_found: success
if_ci_failed: failure
if_ci_failed: error
paths: '!*/tests/.*'

tests:
Expand Down
29 changes: 5 additions & 24 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -1,32 +1,13 @@
# Configuration of the coverage.py tool for reporting test coverage.

[run]
source =
diffpy.utils
[report]
# RE patterns for lines to be excluded from consideration.
exclude_lines =
## Have to re-enable the standard pragma
pragma: no cover
## Don't complain if tests don't hit defensive assertion code:
raise AssertionError
raise NotImplementedError
^[ ]*assert False

## Don't complain if non-runnable code isn't run:
^[ ]*@unittest.skip\b
^[ ]{4}unittest.main()
if __name__ == .__main__.:
omit =
*/python?.?/*
*/site-packages/nose/*
# ignore _version.py and versioneer.py
.*version.*
*_version.py
# ignore wx directory
*/wx/*


[run]
source =
src/diffpy/utils/
omit =
## exclude debug.py from codecov report
*/tests/debug.py
exclude_lines =
if __name__ == '__main__':
5 changes: 2 additions & 3 deletions .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@ exclude =
__pycache__,
build,
dist,
versioneer.py,
doc/manual/source/conf.py
doc/source/conf.py
max-line-length = 115
# Ignore some style 'errors' produced while formatting by 'black' (see link below)
# Ignore some style 'errors' produced while formatting by 'black'
# https://black.readthedocs.io/en/stable/guides/using_black_with_other_tools.html#labels-why-pycodestyle-warnings
extend-ignore = E203
88 changes: 69 additions & 19 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,49 +1,99 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Packages
*.egg
*.egg-info
dist
build
eggs
parts
bin
var
sdist
temp
develop-eggs
# Distribution / packaging
.Python
env/
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
venv/
*.egg-info/
.installed.cfg
lib
lib64
tags
*.egg
bin/
temp/
tags/
errors.err

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt
MANIFEST

# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.tox
.coverage.*
.cache
nosetests.xml
coverage.xml
*,cover
.hypothesis/

# Translations
*.mo
*.pot

# Mr Developer
.mr.developer.cfg
.project
.pydevproject

# Django stuff:
*.log

# Sphinx documentation
docs/build/
docs/source/generated/

# pytest
.pytest_cache/

# PyBuilder
target/

# Editor files
# mac
.DS_Store
*~

# vim
*.swp
*.swo

# pycharm
.idea/

# VSCode
.vscode/

# Ipython Notebook
.ipynb_checkpoints

# version information
setup.cfg
/src/diffpy/*/version.cfg

# Rever
rever/

# PyCharm
.idea/
23 changes: 10 additions & 13 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
recursive-include src *
include AUTHORS.txt LICENSE*.txt README.rst
recursive-exclude src *.py[co]
global-exclude .gitattributes .gitignore .gitarchive.cfg
global-exclude .DS_Store
graft src
graft tests
graft requirements

# Avoid user content in setup.cfg to make distribution reproducible.
exclude setup.cfg
include AUTHORS.rst LICENSE*.rst README.rst

# Exclude git-tracked files spuriously added by setuptools_scm
exclude .coveragerc
exclude .travis*
prune conda-recipe
prune devutils
prune doc
# Exclude all bytecode files and __pycache__ directories
global-exclude *.py[cod] # Exclude all .pyc, .pyo, and .pyd files.
global-exclude .DS_Store # Exclude Mac filesystem artifacts.
global-exclude __pycache__ # Exclude Python cache directories.
global-exclude .git* # Exclude git files and directories.
global-exclude .idea # Exclude PyCharm project settings.
113 changes: 73 additions & 40 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,9 +1,39 @@
.. image:: https://github.com/diffpy/diffpy.utils/actions/workflows/main.yml/badge.svg
:target: https://github.com/diffpy/diffpy.utils/actions/workflows/main.yml
|Icon| |title|_
===============

.. image:: https://codecov.io/gh/diffpy/diffpy.utils/branch/main/graph/badge.svg
:target: https://codecov.io/gh/diffpy/diffpy.utils
.. |title| replace:: diffpy.utils
.. _title: https://diffpy.github.io/diffpy.utils

.. |Icon| image:: https://avatars.githubusercontent.com/diffpy
:target: https://diffpy.github.io/diffpy.utils
:height: 100px

|PyPi| |Forge| |PythonVersion| |PR|

|CI| |Codecov| |Black| |Tracking|

.. |Black| image:: https://img.shields.io/badge/code_style-black-black
:target: https://github.com/psf/black

.. |CI| image:: https://github.com/diffpy/diffpy.utils/actions/workflows/codecov-on-merge-to-main.yml/badge.svg
:target: https://github.com/diffpy/diffpy.utils/actions/workflows/codecov-on-merge-to-main.yml

.. |Codecov| image:: https://codecov.io/gh/diffpy/diffpy.utils/branch/main/graph/badge.svg
:target: https://codecov.io/gh/diffpy/diffpy.utils

.. |Forge| image:: https://img.shields.io/conda/vn/conda-forge/diffpy.utils
:target: https://anaconda.org/conda-forge/diffpy.utils

.. |PR| image:: https://img.shields.io/badge/PR-Welcome-29ab47ff

.. |PyPi| image:: https://img.shields.io/pypi/v/diffpy.utils
:target: https://pypi.org/project/diffpy.utils/

.. |PythonVersion| image:: https://img.shields.io/pypi/pyversions/diffpy.utils
:target: https://pypi.org/project/diffpy.utils/

.. |Tracking| image:: https://img.shields.io/badge/issue_tracking-github-blue
:target: https://github.com/diffpy/diffpy.utils/issues

diffpy.utils
========================================================================
Expand All @@ -16,78 +46,81 @@ program. The package also includes an interpolation function based on the
Whittaker-Shannon formula that can be used to resample a PDF or other profile
function over a new grid.

For more information about the diffpy.utils library, see the users manual at
http://diffpy.github.io/diffpy.utils.
Citation
--------

If you use diffpy.utils in a scientific publication, we would like you to cite this package as

diffpy.utils Package, https://github.com/diffpy/diffpy.utils

INSTALLATION
------------------------------------------------------------------------
Installation
------------

The preferred method is to use `Miniconda Python
<https://docs.conda.io/projects/miniconda/en/latest/miniconda-install.html>`_
and install from the "conda-forge" channel of Conda packages.

To add "conda-forge" to the conda channels, run the following in a terminal. ::

conda config --add channels conda-forge
conda config --add channels conda-forge

We want to install our packages in a suitable conda environment.
The following creates and activates a new environment named ``diffpy-utils`` ::
The following creates and activates a new environment named ``diffpy.utils_env`` ::

conda create -n diffpy-utils python=3
conda activate diffpy-utils
conda create -n diffpy.utils_env python=3
conda activate diffpy.utils_env

Then, to fully install ``diffpy.utils`` in our active environment, run ::

conda install diffpy.utils
conda install diffpy.utils

Another option is to use ``pip`` to download and install the latest release from
`Python Package Index <https://pypi.python.org>`_.
To install using ``pip`` into your ``diffpy-utils`` environment, we will also have to install dependencies ::
To install using ``pip`` into your ``diffpy.utils_env`` environment, we will also have to install dependencies ::

pip install numpy
pip install diffpy.utils
pip install -r https://raw.githubusercontent.com/diffpy/diffpy.utils/main/requirements/run.txt

For those planning to use functions in the ``diffpy.utils.wx`` module, you will also need to install ``wxPython``.
Both of the following lines will install this package. ::
and then install the package ::

conda install wxPython
pip install wxPython
pip install diffpy.utils

If you prefer to install from sources, after installing the dependencies, obtain the source archive from
`GitHub <https://github.com/diffpy/diffpy.utils/>`_. Once installed, ``cd`` into your ``diffpy.utils`` directory
and run the following ::

pip install .
pip install .

To check the installation integrity, if the following passes all checks, you are good! ::
Support and Contribute
----------------------

pip install pytest
python -m diffpy.utils.tests.run
`Diffpy user group <https://groups.google.com/g/diffpy-users>`_ is the discussion forum for general questions and discussions about the use of diffpy.utils. Please join the diffpy.utils users community by joining the Google group. The diffpy.utils project welcomes your expertise and enthusiasm!

If you see a bug or want to request a feature, please `report it as an issue <https://github.com/diffpy/diffpy.utils/issues>`_ and/or `submit a fix as a PR <https://github.com/diffpy/diffpy.utils/pulls>`_. You can also post it to the `Diffpy user group <https://groups.google.com/g/diffpy-users>`_.

DEVELOPMENT
------------------------------------------------------------------------

diffpy.utils is an open-source software developed as a part of the
DiffPy-CMI complex modeling initiative at the Brookhaven National
Laboratory. The diffpy.utils sources are hosted at
https://github.com/diffpy/diffpy.utils.

Feel free to fork the project and contribute. To install diffpy.utils
Feel free to fork the project and contribute. To install diffpy.utils
in a development mode, with its sources being directly used by Python
rather than copied to a package directory, use the following in the root
directory ::

pip install -e .
pip install -e .

To ensure code quality and to prevent accidental commits into the default branch, please set up the use of our pre-commit
hooks.

1. Install pre-commit in your working environment by running ``conda install pre-commit``.

Note that this is only supported for `setuptools` version 62.0 and above.
2. Initialize pre-commit (one time only) ``pre-commit install``.

Thereafter your code will be linted by black and isort and checked against flake8 before you can commit.
If it fails by black or isort, just rerun and it should pass (black and isort will modify the files so should
pass after they are modified). If the flake8 test fails please see the error messages and fix them manually before
trying to commit again.

CONTACTS
------------------------------------------------------------------------
Improvements and fixes are always appreciated.

For more information on diffpy.utils please visit the project web-page
Before contribuing, please read our `Code of Conduct <https://github.com/diffpy/diffpy.utils/blob/main/CODE_OF_CONDUCT.rst>`_.

http://www.diffpy.org/
Contact
-------

or email Prof. Simon Billinge at sb2896@columbia.edu.
For more information on diffpy.utils please visit the project `web-page <https://diffpy.github.io/>`_ or email Prof. Simon Billinge at sb2896@columbia.edu.
9 changes: 5 additions & 4 deletions doc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ SPHINXOPTS =
SPHINXBUILD = sphinx-build
PAPER =
BUILDDIR = build
BASENAME = $(subst .,,$(subst $() $(),,diffpy.utils))

# User-friendly check for sphinx-build
ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1)
Expand Down Expand Up @@ -85,17 +86,17 @@ qthelp:
@echo
@echo "Build finished; now you can run "qcollectiongenerator" with the" \
".qhcp project file in $(BUILDDIR)/qthelp, like this:"
@echo "# qcollectiongenerator $(BUILDDIR)/qthelp/diffpyutils.qhcp"
@echo "# qcollectiongenerator $(BUILDDIR)/qthelp/$(BASENAME).qhcp"
@echo "To view the help file:"
@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/diffpyutils.qhc"
@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/$(BASENAME).qhc"

devhelp:
$(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
@echo
@echo "Build finished."
@echo "To view the help file:"
@echo "# mkdir -p $$HOME/.local/share/devhelp/diffpyutils"
@echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/diffpyutils"
@echo "# mkdir -p $$HOME/.local/share/devhelp/$(BASENAME)"
@echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/$(BASENAME)"
@echo "# devhelp"

epub:
Expand Down
Loading

0 comments on commit 153f843

Please sign in to comment.