diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 722d157a9bf..57e07e92191 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -10,11 +10,11 @@ For developers interested in expanding `pymatgen` for their own purposes, we rec 1. Create a free GitHub account (if you don't already have one) and perform the necessary setup (e.g., install SSH keys etc.). -1. Fork the `pymatgen` GitHub repo, i.e., go to the main [`pymatgen` GitHub repo](https://github.com/materialsproject/pymatgen) and click fork to create a copy of the `pymatgen` code base on your own GitHub account. +2. Fork the `pymatgen` GitHub repo, i.e., go to the main [`pymatgen` GitHub repo](https://github.com/materialsproject/pymatgen) and click fork to create a copy of the `pymatgen` code base on your own GitHub account. -1. Install `git` on your local machine (if you don't already have it). +3. Install `git` on your local machine (if you don't already have it). -1. Clone *your forked repo* to your local machine. You will work mostly with your local repo and only publish changes when they are ready to be merged: +4. Clone *your forked repo* to your local machine. You will work mostly with your local repo and only publish changes when they are ready to be merged: ```sh git clone https://github.com//pymatgen @@ -22,13 +22,13 @@ For developers interested in expanding `pymatgen` for their own purposes, we rec Note that the entire Github repo is fairly large because of the presence of test files, but these are necessary for rigorous testing. -1. Make a new branch for your contributions +5. Make a new branch for your contributions ```sh git checkout -b my-new-fix-or-feature # should be run from up-to-date master ``` -1. Code (see [Coding Guidelines](#coding-guidelines)). Commit early and commit often. Keep your code up to date. You need to add the main repository to the list of your remotes. +6. Code (see [Coding Guidelines](#coding-guidelines)). Commit early and commit often. Keep your code up to date. You need to add the main repository to the list of your remotes. ```sh git remote add upstream https://github.com/materialsproject/pymatgen @@ -48,19 +48,19 @@ For developers interested in expanding `pymatgen` for their own purposes, we rec Remember, pull is a combination of the commands fetch and merge, so there may be merge conflicts to be manually resolved. -1. Publish your contributions. Assuming that you now have a couple of commits that you would like to contribute to the main repository. Please follow the following steps: +7. Publish your contributions. Assuming that you now have a couple of commits that you would like to contribute to the main repository. Please follow the following steps: 1. If your change is based on a relatively old state of the main repository, then you should probably bring your repository up-to-date first to see if the change is not creating any merge conflicts. - 1. Check that everything compiles cleanly and passes all tests. The `pymatgen` repo comes with a complete set of tests for all modules. If you have written new modules or methods, you must write tests for the new code as well (see [Coding Guidelines](#coding-guidelines)). Install and run `pytest` in your local repo directory and fix all errors before continuing further. + 2. Check that everything compiles cleanly and passes all tests. The `pymatgen` repo comes with a complete set of tests for all modules. If you have written new modules or methods, you must write tests for the new code as well (see [Coding Guidelines](#coding-guidelines)). Install and run `pytest` in your local repo directory and fix all errors before continuing further. - 1. If everything is ok, publish the commits to your GitHub repository. + 3. If everything is ok, publish the commits to your GitHub repository. ```sh git push origin master ``` -1. Now that your commit is published, it doesn't mean that it has already been merged into the main repository. You should issue a merge request to `pymatgen` maintainers. They will pull your commits and run their own tests before releasing. +8. Now that your commit is published, it doesn't mean that it has already been merged into the main repository. You should issue a merge request to `pymatgen` maintainers. They will pull your commits and run their own tests before releasing. "Work-in-progress" pull requests are encouraged, especially if this is your first time contributing to `pymatgen`, and the maintainers will be happy to help or provide code review as necessary. Put "\[WIP\]" in the title of your pull request to indicate it's not ready to be merged. @@ -77,7 +77,7 @@ Given that `pymatgen` is intended to be a long-term code base, we adopt very str PMG_TEST_FILES_DIR=$(pwd)/tests/files pytest tests # run the test suite providing the path for the datafiles ``` -1. **Python PEP 8** [code style](https://python.org/dev/peps/pep-0008). We allow a few exceptions when they are well-justified (e.g., Element's atomic number is given a variable name of capital Z, in line with accepted scientific convention), but generally, PEP 8 must be observed. Code style will be automatically checked for all PRs and must pass before any PR is merged. To aid you, you can install and run the same set of formatters and linters that will run in CI using +2. **Python PEP 8** [code style](https://python.org/dev/peps/pep-0008). We allow a few exceptions when they are well-justified (e.g., Element's atomic number is given a variable name of capital Z, in line with accepted scientific convention), but generally, PEP 8 must be observed. Code style will be automatically checked for all PRs and must pass before any PR is merged. To aid you, you can install and run the same set of formatters and linters that will run in CI using ```sh pre-commit install # ensures linters are run prior to all future commits @@ -86,7 +86,7 @@ Given that `pymatgen` is intended to be a long-term code base, we adopt very str pre-commit run --all-files # ensure your entire codebase passes linters ``` -1. **Python 3**. We only support Python 3.10+. -1. **Documentation** is required for all modules, classes and methods. In particular, the method doc strings should make clear the arguments expected and the return values. For complex algorithms (e.g., an Ewald summation), a summary of the algorithm should be provided and preferably with a link to a publication outlining the method in detail. +3. **Python 3**. We only support Python 3.10+. +4. **Documentation** is required for all modules, classes and methods. We prefer [Google Style Docstrings](https://www.sphinx-doc.org/en/master/usage/extensions/example_google.html). In particular, the method doc strings should make clear the arguments expected and the return values. For complex algorithms (e.g., an Ewald summation), a summary of the algorithm should be provided and preferably with a link to a publication outlining the method in detail. For the above, if in doubt, please refer to the core classes in `pymatgen` for examples of what is expected. diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 00000000000..0612c6ac7f1 --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1,11 @@ +# Exclude entire directories +prune .github/ +prune dev_scripts/ +prune docs/ +prune examples/ +prune tests/ + +# Exclude individual files +exclude .* \ + ADMIN.md CONTRIBUTING.md SECURITY.md \ + CITATION.cff pdm.lock tasks.py diff --git a/pyproject.toml b/pyproject.toml index 529d5126f5e..865bc1bfb3c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,6 +5,7 @@ requires = [ # https://numpy.org/devdocs/dev/depending_on_numpy.html#build-time-dependency "numpy>=2.1.0", "setuptools>=65.0.0", + "setuptools-scm>=8", # include all Git tracked files as package data file ] build-backend = "setuptools.build_meta" @@ -122,37 +123,10 @@ feff_plot_cross_section = "pymatgen.cli.feff_plot_cross_section:main" feff_plot_dos = "pymatgen.cli.feff_plot_dos:main" get_environment = "pymatgen.cli.get_environment:main" -[tool.setuptools] -include-package-data = false - [tool.setuptools.packages.find] where = ["src"] include = ["pymatgen", "pymatgen.*"] -[tool.setuptools.package-data] -"pymatgen.analysis" = ["*.csv", "*.json", "*.yaml"] -"pymatgen.analysis.chemenv" = [ - "coordination_environments/coordination_geometries_files/*.json", - "coordination_environments/coordination_geometries_files/*.txt", - "coordination_environments/strategy_files/ImprovedConfidenceCutoffDefaultParameters.json", -] -"pymatgen.analysis.structure_prediction" = ["*.yaml", "data/*.json"] -"pymatgen.analysis.diffraction" = ["*.json"] -"pymatgen.analysis.magnetism" = ["default_magmoms.yaml"] -"pymatgen.analysis.solar" = ["am1.5G.dat"] -"pymatgen.entries" = ["*.json.gz", "*.yaml", "data/*.json"] -"pymatgen.core" = ["*.json"] -"pymatgen" = ["py.typed"] -"pymatgen.io.vasp" = ["*.json", "*.json.bz2", "*.json.gz", "*.yaml"] -"pymatgen.io.feff" = ["*.yaml"] -"pymatgen.io.cp2k" = ["*.yaml"] -"pymatgen.io.lobster" = ["lobster_basis/*.yaml"] -"pymatgen.command_line" = ["*"] -"pymatgen.util" = ["*.json", "structures/*.json"] -"pymatgen.vis" = ["*.yaml"] -"pymatgen.io.lammps" = ["CoeffsDataType.yaml", "templates/*.template"] -"pymatgen.symmetry" = ["*.json", "*.sqlite", "*.yaml"] - [tool.pdm.dev-dependencies] lint = ["mypy>=1.10.0", "pre-commit>=3.7.1", "ruff>=0.4.9"] test = ["pytest-cov>=5.0.0", "pytest-split>=0.9.0", "pytest>=8.2.2"] diff --git a/src/pymatgen/py.typed b/src/pymatgen/alchemy/py.typed similarity index 100% rename from src/pymatgen/py.typed rename to src/pymatgen/alchemy/py.typed diff --git a/src/pymatgen/analysis/py.typed b/src/pymatgen/analysis/py.typed new file mode 100644 index 00000000000..e69de29bb2d diff --git a/src/pymatgen/apps/py.typed b/src/pymatgen/apps/py.typed new file mode 100644 index 00000000000..e69de29bb2d diff --git a/src/pymatgen/cli/py.typed b/src/pymatgen/cli/py.typed new file mode 100644 index 00000000000..e69de29bb2d diff --git a/src/pymatgen/command_line/py.typed b/src/pymatgen/command_line/py.typed new file mode 100644 index 00000000000..e69de29bb2d diff --git a/src/pymatgen/core/py.typed b/src/pymatgen/core/py.typed new file mode 100644 index 00000000000..e69de29bb2d diff --git a/src/pymatgen/electronic_structure/py.typed b/src/pymatgen/electronic_structure/py.typed new file mode 100644 index 00000000000..e69de29bb2d diff --git a/src/pymatgen/entries/py.typed b/src/pymatgen/entries/py.typed new file mode 100644 index 00000000000..e69de29bb2d diff --git a/src/pymatgen/ext/py.typed b/src/pymatgen/ext/py.typed new file mode 100644 index 00000000000..e69de29bb2d diff --git a/src/pymatgen/io/py.typed b/src/pymatgen/io/py.typed new file mode 100644 index 00000000000..e69de29bb2d diff --git a/src/pymatgen/optimization/py.typed b/src/pymatgen/optimization/py.typed new file mode 100644 index 00000000000..e69de29bb2d diff --git a/src/pymatgen/phonon/py.typed b/src/pymatgen/phonon/py.typed new file mode 100644 index 00000000000..e69de29bb2d diff --git a/src/pymatgen/symmetry/py.typed b/src/pymatgen/symmetry/py.typed new file mode 100644 index 00000000000..e69de29bb2d diff --git a/src/pymatgen/transformations/py.typed b/src/pymatgen/transformations/py.typed new file mode 100644 index 00000000000..e69de29bb2d diff --git a/src/pymatgen/util/py.typed b/src/pymatgen/util/py.typed new file mode 100644 index 00000000000..e69de29bb2d diff --git a/src/pymatgen/vis/py.typed b/src/pymatgen/vis/py.typed new file mode 100644 index 00000000000..e69de29bb2d