Skip to content

Commit

Permalink
PyPI package
Browse files Browse the repository at this point in the history
  • Loading branch information
IvanChernyshov committed Dec 18, 2020
1 parent c01e46e commit a4a827f
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 29 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
__pycache__/
.spyproject/
dist/
build/
*.egg-info/
2 changes: 2 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
README.md
LICENSE
33 changes: 5 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,37 +17,13 @@ The example of input and output files for the script is provided in *example* di

## Installation

*filter_los_csd* requires installation of:

1. Python 3;
2. [numpy](https://numpy.org/);
3. [pandas](https://pandas.pydata.org/);
4. [PyCifRW](https://www.iucr.org/resources/cif/software/pycifrw).

All this libraries can be installed on Windows, Linux and macOS. Here we provide installation using cross-platform software package manager Conda.

The easiest way to get Conda is having it installed as part of the [Anaconda Python distribution](https://www.anaconda.com/distribution/). A possible (but a bit more complex to use) alternative is provided with the smaller and more self-contained [Miniconda](https://docs.conda.io/en/latest/miniconda.html).

After conda installation, create new environment and install necessary packages:
*filter_los_csd* is a multiplatform Python3 package. Use `pip` to install it:

```
> conda create -n los python=3 numpy pandas
> conda install -n los -c conda-forge pycifrw
> pip install filter_los_csd
```

Finally, the new environment must be activated so that the corresponding python interpreter becomes available in the same shell:

```
> source activate los
```

or, in Windows:

```
> activate los
```

For more details see the [Conda user guide](https://docs.conda.io/projects/conda/en/latest/user-guide/index.html).
*filter_los_csd* depends on the [PyCifRW](http://pypi.org/project/PyCifRW/) package, which requires a C/C++ compiler, and pip installation will fail if you do not have one. The best choice for Windows is `Visual Studio Building Tools`, and for Linux, `gcc` would be enough. If you forget about it, pip will give you the installation error and platform-specific advice on fixing it.

## Syntax

Expand All @@ -63,7 +39,7 @@ The script takes two necessary parameters as input:
Thus, the easiest command is:

```
> python filter_csd_los.py test.csv test.cif
> filter_csd_los.py test.csv test.cif
```

As output the script creates **{csv_name}_los.csv** file containing the same info as the original file with three additional columns:
Expand Down Expand Up @@ -105,3 +81,4 @@ In addition, the script has several optional parameters:
* *-V* or *--volume*: maximal allowed cell volume, Å<sup>3</sup>. Available values are:
* positive numeric value: in this case the script does not calculate contact shielding for crystals with crystallographic cell volume more than specified. It can be useful if there are a lot of crystals with large crystallographic cells (V > 10 000 Å<sup>3</sup>) which are treated slowly.
* unspecified: no filtering by volume is applied.

4 changes: 3 additions & 1 deletion filter_los_csd.py → bin/filter_los_csd.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# version 0.06
#!/usr/bin/env python

# version 0.07

################################### imports ###################################

Expand Down
30 changes: 30 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import setuptools

with open('README.md', 'r', encoding = 'utf-8') as inpf:
long_description = inpf.read()

setuptools.setup(
name = 'filter_los_csd',
version = '1.3.0',
author = 'Ivan Yu. Chernyshov',
author_email = '[email protected]',
description = 'CML tool filtering line-of-sights contacts',
long_description = long_description,
long_description_content_type = 'text/markdown',
url = 'https://github.com/EPiCs-group/filter_los_csd',
packages = [],
scripts = ['bin/filter_los_csd.py'],
classifiers=[
'Programming Language :: Python :: 3',
'License :: OSI Approved :: MIT License',
'Operating System :: OS Independent',
'Development Status :: 4 - Beta',
'Topic :: Scientific/Engineering :: Chemistry'
],
install_requires=[
'numpy==1.19.3', # TODO: remove restriction after fmod() fix: https://developercommunity.visualstudio.com/content/problem/1207405/fmod-after-an-update-to-windows-2004-is-causing-a.html
'pandas>=1.0',
'PyCifRW>=4.0'
],
python_requires = '>=3.6',
)

0 comments on commit a4a827f

Please sign in to comment.