https://github.com/materialsproject/pymatgen-addon-template
A template for writing add-on namespace packages for pymatgen
https://github.com/materialsproject/pymatgen-addon-template
Last synced: 26 days ago
JSON representation
A template for writing add-on namespace packages for pymatgen
- Host: GitHub
- URL: https://github.com/materialsproject/pymatgen-addon-template
- Owner: materialsproject
- Created: 2021-03-06T15:11:20.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2025-01-06T21:19:28.000Z (5 months ago)
- Last Synced: 2025-04-04T22:41:43.255Z (about 2 months ago)
- Language: Python
- Size: 32.2 KB
- Stars: 6
- Watchers: 6
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.rst
Awesome Lists containing this project
README
Pymatgen-analysis-myaddon
=========================This is a template for writing an add-on for pymatgen. From v2022.0.3, pymatgen, pymatgen.analysis, pymatgen.ext and
and pymatgen.io are now `namespace packages `_. What
this means is that developers can now write packages that add functionality to pymatgen, such as:* A new type of analysis (pymatgen.analysis);
* A high-level API access to a new external resource (pymatgen.ext); or
* Support for input/output from another code, e.g., a new quantum chemistry software (pymatgen.io).For a real-world example using this template, check out `Materials Virtual Lab's pymatgen-analysis-diffusion
`_.Usage
=====1. Download this template as a zip file.
2. (Optional, Highly recommended) If you plan on using version control, create a Github or any other type of
repository for your code and copy the contents of the zip file into your folder.
3. Rename all the `myaddon` in the template files to a name of your choosing.
4. Write your code. While you have complete freedom to organize your own code, there are a few rules that must be
followed in order for your code to work properly as a pymatgen namespace package.a. The directory structure should be as follows::
pymatgen
# No __init__.py here. This is CRITICAL!
analysis (alternatively, this can be ext or io)
# No __init__.py here. This is CRITICAL!
myaddon
- __init__.py
- other module.py files
b. In setup.py, please name your package with the convention `pymatgen--`. Also make any
modifications to the rest of the file, especially the `find_namespace_packages` call.
c. Your minimum pymatgen dependency must be 2022.0.3. This is set by the line
`install_requires=["pymatgen>=2022.0.3"]` in the setup.py and the requirements.txt file.5. It is highly recommended you use the structure of this template and the included Github Actions workflows
(see `.github `_ folder). These should work out of the box and performs linting and testing of
your code with every push. Note that the testing is only as useful as the tests you write. It is highly recommended
that you write unittests for all functionality.
6. Release your package on PyPi, see `Python Packaging Guide
`_.
7. (Optional) You may submit a pull request to add your package to the `pymatgen add-ons listing page
`_.Afterwards, others will be able to install your package using::
pip install pymatgen--
and all functionality will be available under::
from pymatgen.. import *