Skip to content
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

Fix/improve documentation #5

Draft
wants to merge 17 commits into
base: develop
Choose a base branch
from
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
49 changes: 49 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
language: python
git:
depth: 3
cache: pip
matrix:
# mark build as complete as soon as the versions that may not fail is finished
fast_finish: true
include:
- python: 3.6
dist: trusty
addons:
postgresql: '9.5'
- python: 3.7
dist: xenial
#env: NO_RMQ='t'
addons:
postgresql: '9.5'
apt:
packages:
- rabbitmq-server
- python: 3.8
dist: xenial
addons:
postgresql: '9.5'
apt:
packages:
- rabbitmq-server
services:
- postgresql
- rabbitmq
before_install:
# Now we install the needed dependencies
- sudo apt-get install locate
- sudo service postgresql stop
- sudo apt-get remove postgresql
- sudo apt-get install postgresql-9.5
- sudo updatedb
install: # python installations
- pip install -U pip wheel setuptools
# install package and requirements for tests
- pip install -e .[testing]
script:
# refresh entry points
- reentry scan
# run tests
- cd tests; pytest --cov-report=term-missing --cov=aiida_jutools -sv .
after_success:
- pip install codecov
- codecov
4 changes: 2 additions & 2 deletions aiida_jutools/structure_analyzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
import spglib

# local imports
from terminal_colors import *
from .terminal_colors import *
# CSQ color for sequence
# CDB color for structure database
# CRC color for recipe
Expand All @@ -48,7 +48,7 @@
# CER color for error messages
# COK color for OK messages
# CIN color for info messages
from ptable import ptable
from .ptable import ptable

__copyright__ = (u"Copyright (c), 2019-2020, Forschungszentrum Jülich GmbH, "
"IAS-1/PGI-1, Germany. All rights reserved.")
Expand Down
11 changes: 10 additions & 1 deletion docs/requirements_for_rtd.txt
Original file line number Diff line number Diff line change
@@ -1 +1,10 @@
aiida-core>0.9.0
aiida-core
masci-tools
aiida-kkr
numpy
scipy
pycifrw
pymatgen
spglib
pandas
humanfriendly
45 changes: 1 addition & 44 deletions docs/source/conf.py
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@
#html_search_scorer = 'scorer.js'

# Output file base name for HTML help builder.
htmlhelp_basename = 'aiida-jutoolsdoc'
htmlhelp_basename = 'aiida-jutools-doc'

# -- Options for LaTeX output --------------------------------------------------

Expand Down Expand Up @@ -301,49 +301,6 @@
configuration.BACKEND = "django"
configuration.AIIDADB_PROFILE = "default"

'''
def run_apidoc(_):
"""Runs sphinx-apidoc when building the documentation.

Needs to be done in conf.py in order to include the APIdoc in the
build on readthedocs.

See also https://github.com/rtfd/readthedocs.org/issues/1139
"""
source_dir = os.path.abspath(os.path.dirname(__file__))
apidoc_dir = os.path.join(source_dir, 'apidoc')
package_dir = os.path.join(source_dir, os.pardir, os.pardir)

# In #1139, they suggest the route below, but for me this ended up
# calling sphinx-build, not sphinx-apidoc
#from sphinx.apidoc import main
#main([None, '-e', '-o', apidoc_dir, package_dir, '--force'])

import subprocess
cmd_path = 'sphinx-apidoc'
if hasattr(sys, 'real_prefix'): # Check to see if we are in a virtualenv
# If we are, assemble the path manually
cmd_path = os.path.abspath(os.path.join(sys.prefix, 'bin', 'sphinx-apidoc'))

options = [
'-o', apidoc_dir, package_dir,
'--private',
'--force',
'--no-headings',
'--module-first',
'--no-toc',
'--maxdepth', '4',
]

# See https://stackoverflow.com/a/30144019
env = os.environ.copy()
env["SPHINX_APIDOC_OPTIONS"] = 'members,special-members,private-members,undoc-members,show-inheritance'
subprocess.check_call([cmd_path] + options, env=env)
'''

#def setup(app):
# app.connect('builder-inited', run_apidoc)


# -- Options for manual page output --------------------------------------------

Expand Down
4 changes: 2 additions & 2 deletions docs/source/index.rst
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#########################################
######################################################################
`AiiDA`_ helper tools used by the aiida-plugins for the `juDFT`_ codes
#########################################
######################################################################

.. image:: images/AiiDA_transparent_logo.png
:width: 40%
Expand Down
50 changes: 49 additions & 1 deletion docs/source/module_guide/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,53 @@ Modules provided with aiida-jutools (API reference)
.. toctree::
:maxdepth: 3

utilities
.. automodule:: aiida_jutools.ptable
:members:
:private-members:
:special-members:

.. automodule:: aiida_jutools.terminal_colors
:members:
:private-members:
:special-members:

.. automodule:: aiida_jutools.util_computer
:members:
:private-members:
:special-members:

.. automodule:: aiida_jutools.util_group
:members:
:private-members:
:special-members:

.. automodule:: aiida_jutools.util_node
:members:
:private-members:
:special-members:

.. automodule:: aiida_jutools.structure_analyzer
:members:
:private-members:
:special-members:

.. automodule:: aiida_jutools.util_code
:members:
:private-members:
:special-members:

.. automodule:: aiida_jutools.util_data
:members:
:private-members:
:special-members:

.. automodule:: aiida_jutools.util_kkr
:members:
:private-members:
:special-members:

.. automodule:: aiida_jutools.util_process
:members:
:private-members:
:special-members:

3 changes: 0 additions & 3 deletions docs/source/user_guide/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,3 @@ User's guide
.. toctree::
:maxdepth: 3

tools


4 changes: 0 additions & 4 deletions docs/source/user_guide/tools.rst

This file was deleted.

14 changes: 10 additions & 4 deletions setup.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
{
"name": "aiida-jutools",
"author": "JuDFTteam, Philipp Rüßmann",
"author": "JuDFTteam",
"author_email": "p.ruessmann@fz-juelich.de",
"description": "AiiDA helper for Jülich AiiDA plugins",
"url": "https://github.com/JuDFTteam/aiida-jutools",
"download_url": "https://github.com/JuDFTteam/aiida-jutools",
"license": "MIT",
"classifiers": [
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.4",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Development Status :: 4 - Beta",
"Environment :: Plugins",
"Intended Audience :: Science/Research",
Expand All @@ -30,12 +29,19 @@
"numpy",
"scipy",
"pycifrw",
"pymatgen",
"spglib",
"pandas",
"humanfriendly"
],
"extras_require": {
"pre-commit": [
"testing": [
"pytest-cov",
"pgtest"
],
"docs": [
"Sphinx",
"sphinx-rtd-theme"
]
},
"entry_points": {
Expand Down
27 changes: 27 additions & 0 deletions tests/files/Cu_mp-30_computed.cif
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# generated using pymatgen
data_Cu
_symmetry_space_group_name_H-M 'P 1'
_cell_length_a 2.56061937
_cell_length_b 2.56061937
_cell_length_c 2.56061937
_cell_angle_alpha 60.00000000
_cell_angle_beta 60.00000000
_cell_angle_gamma 60.00000000
_symmetry_Int_Tables_number 1
_chemical_formula_structural Cu
_chemical_formula_sum Cu1
_cell_volume 11.87189593
_cell_formula_units_Z 1
loop_
_symmetry_equiv_pos_site_id
_symmetry_equiv_pos_as_xyz
1 'x, y, z'
loop_
_atom_site_type_symbol
_atom_site_label
_atom_site_symmetry_multiplicity
_atom_site_fract_x
_atom_site_fract_y
_atom_site_fract_z
_atom_site_occupancy
Cu Cu0 1 0.000000 -0.000000 0.000000 1
25 changes: 16 additions & 9 deletions aiida_jutools/str2aiida.py → tests/test_structure_analyzer.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,11 @@
- apart from aiida, pymatgen and PyCifRW packages are needed to use > analyze_symmetry <
"""

import sys

# aiida imports
from aiida import load_profile
load_profile()

from structure_analyzer import analyze_symmetry
from terminal_colors import *
from aiida.manage.tests.pytest_fixtures import aiida_profile
from aiida_jutools.structure_analyzer import analyze_symmetry
from aiida_jutools.terminal_colors import *
from pprint import pprint
import pathlib

__copyright__ = (u"Copyright (c), 2019-2020, Forschungszentrum Jülich GmbH, "
"IAS-1/PGI-1, Germany. All rights reserved.")
Expand Down Expand Up @@ -56,4 +52,15 @@ def cif2astr(cifpath):
print('\n'+'extras:'+'\n')
pprint(structure['aiida_structure_conventional'].extras, width=256)

cif2astr('/path/to/cif/file.cif')

def test_cif2astr(aiida_profile):
cifpath = pathlib.Path('files/Cu_mp-30_computed.cif')
cif_abspath = str(cifpath.absolute())
print(cif_abspath)
cif2astr(cif_abspath)


if __name__=='__main__':
from aiida import load_profile
load_profile()
test_cif2astr(None)