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

Update pyproject.toml to resolve pip install issue #657

Closed
wants to merge 67 commits into from
Closed
Show file tree
Hide file tree
Changes from 23 commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
cb13eee
Update _m3gnet.py
zz11ss11zz Jul 13, 2024
a167441
Update _m3gnet.py
zz11ss11zz Jul 13, 2024
033f318
Merge pull request #1 from zz11ss11zz/zz11ss11zz-patch-1
zz11ss11zz Jul 13, 2024
cda419c
Merge branch 'materialsvirtuallab:master' into master
zz11ss11zz Sep 17, 2024
83c97ec
Update pyproject.toml
zz11ss11zz Sep 17, 2024
e445eca
Merge branch 'master' into master
shyuep Sep 18, 2024
3137592
Merge branch 'materialsvirtuallab:master' into master
zz11ss11zz Sep 18, 2024
56fd836
Update cgcnn_example.ipynb
zz11ss11zz Sep 18, 2024
fe4498b
Update cgcnn_example.ipynb
zz11ss11zz Sep 18, 2024
660d438
Update cgcnn_example.ipynb
zz11ss11zz Sep 18, 2024
b39fc3a
Update cgcnn_example.ipynb
zz11ss11zz Sep 18, 2024
dd00bfb
Update pyproject.toml
zz11ss11zz Sep 18, 2024
14f1c0f
Update pyproject.toml
zz11ss11zz Sep 18, 2024
695f862
Update Example1_MPF2021.2.8.all.ipynb
zz11ss11zz Sep 18, 2024
c165730
Update pyproject.toml
zz11ss11zz Sep 18, 2024
941ea87
Update Example2_Ti-H.ipynb
zz11ss11zz Sep 18, 2024
b0fb265
Update Example2_Ti-H.ipynb
zz11ss11zz Sep 18, 2024
fa9bd7b
Update pyproject.toml
zz11ss11zz Sep 18, 2024
f3d4023
Update process_vasprun_to_mliap.ipynb
zz11ss11zz Sep 18, 2024
c5209d1
Update garnet_formation_energy.ipynb
zz11ss11zz Sep 18, 2024
ab8ebf8
Update GB energy model.ipynb
zz11ss11zz Sep 18, 2024
1b433f8
Update GB energy model.ipynb
zz11ss11zz Sep 18, 2024
1669ac5
Update _gap.py
zz11ss11zz Sep 18, 2024
206469e
Update pca.py
zz11ss11zz Sep 18, 2024
bee8e97
Update pyproject.toml
zz11ss11zz Sep 18, 2024
5068c43
pre-commit auto-fixes
pre-commit-ci[bot] Sep 18, 2024
8c5f549
Update example.ipynb
zz11ss11zz Sep 18, 2024
6d3b16d
Update example.ipynb
zz11ss11zz Sep 18, 2024
d953c67
pre-commit auto-fixes
pre-commit-ci[bot] Sep 18, 2024
748cd9a
Update example.ipynb
zz11ss11zz Sep 18, 2024
75cb1e7
pre-commit auto-fixes
pre-commit-ci[bot] Sep 18, 2024
fa4db5a
Update conf.py
zz11ss11zz Sep 18, 2024
e67fd4d
Add files via upload
zz11ss11zz Sep 18, 2024
291664a
Add files via upload
zz11ss11zz Sep 19, 2024
7a7c6e8
pre-commit auto-fixes
pre-commit-ci[bot] Sep 19, 2024
be3ddfb
Update pyproject.toml
zz11ss11zz Sep 19, 2024
9dbe9e5
pre-commit auto-fixes
pre-commit-ci[bot] Sep 19, 2024
1a50d87
Update requirements.txt
zz11ss11zz Sep 19, 2024
983c63f
Update requirements-ci.txt
zz11ss11zz Sep 19, 2024
15aca59
Update requirements-dl.txt
zz11ss11zz Sep 19, 2024
0dcb221
Update pyproject.toml
zz11ss11zz Sep 19, 2024
9bf4f51
Update testing.yml
zz11ss11zz Sep 19, 2024
39e1ce8
Update _material.py
zz11ss11zz Sep 19, 2024
d29a7fc
Update pyproject.toml
zz11ss11zz Sep 19, 2024
2da756a
Update _material.py
zz11ss11zz Sep 21, 2024
872de13
pre-commit auto-fixes
pre-commit-ci[bot] Sep 21, 2024
fc17348
Update _composition.py
zz11ss11zz Sep 21, 2024
db08783
pre-commit auto-fixes
pre-commit-ci[bot] Sep 21, 2024
df7368b
Update requirements-ci.txt
zz11ss11zz Sep 21, 2024
18b6cbd
Update linting.yml
zz11ss11zz Sep 21, 2024
4a44b67
Update _composition.py
zz11ss11zz Sep 21, 2024
40e2f76
pre-commit auto-fixes
pre-commit-ci[bot] Sep 21, 2024
5d4bd17
Update pyproject.toml
zz11ss11zz Sep 21, 2024
558d8bf
Update pyproject.toml
zz11ss11zz Sep 21, 2024
b105c39
Update _composition.py
zz11ss11zz Sep 21, 2024
37adfc3
Update _stats.py
zz11ss11zz Sep 21, 2024
936e4a4
Update _mixin.py
zz11ss11zz Sep 21, 2024
ec39f56
Update _stats.py
zz11ss11zz Sep 21, 2024
7e6074d
Update _matminer.py
zz11ss11zz Sep 21, 2024
4856415
Update clustering.py
zz11ss11zz Sep 21, 2024
eb2d5b3
Update _lammps.py
zz11ss11zz Sep 21, 2024
228f256
Update optimizer.py
zz11ss11zz Sep 21, 2024
d9b9e1e
Update _describer.py
zz11ss11zz Sep 21, 2024
c6bcb9a
Update _data_conversion.py
zz11ss11zz Sep 21, 2024
4c4f999
Update _preprocessing.py
zz11ss11zz Sep 21, 2024
84fa811
Update _snap.py
zz11ss11zz Sep 21, 2024
db84cb2
Update _rdf.py
zz11ss11zz Sep 21, 2024
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
2 changes: 1 addition & 1 deletion notebooks/direct/Example1_MPF2021.2.8.all.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@
"metadata": {},
"outputs": [],
"source": [
"manual_selection_index = [i for i, l in enumerate(MPF_2021_2_8_All_feature_data[\"relax_label\"]) if l]"
"manual_selection_index = [i for i, j in enumerate(MPF_2021_2_8_All_feature_data[\"relax_label\"]) if j]"
]
},
{
Expand Down
4 changes: 1 addition & 3 deletions notebooks/direct/Example2_Ti-H.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,7 @@
"\n",
"\n",
"def load_ase_MD_traj(filename: str):\n",
" \"\"\"\n",
" Load .traj to pymatgen structures\n",
" \"\"\"\n",
" \"\"\"Load .traj to pymatgen structures.\"\"\"\n",
" traj = Trajectory(filename)\n",
" structures = [AseAtomsAdaptor.get_structure(tra) for tra in traj]\n",
" return structures"
Expand Down
9 changes: 4 additions & 5 deletions notebooks/gbe/GB energy model.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,7 @@
"source": [
"\"\"\"\n",
"Generate features for db entries\n",
"The dataframe containing all features and labels for all 361 data \n",
"is located at maml/apps/gbe/data/features.pickle\n",
"The dataframe containing all features and labels for all 361 data is located at maml/apps/gbe/data/features.pickle\n",
"\"\"\"\n",
"\n",
"describer = GBDescriber()\n",
Expand All @@ -148,13 +147,13 @@
}
],
"source": [
"\n",
"import sklearn\n",
"\n",
"\"\"\"\n",
"Make prediction\n",
"The model is a sklearn(0.24.2) pipeline object\n",
"\"\"\"\n",
"\n",
"import sklearn\n",
"\n",
"if sklearn.__version__ == \"0.24.2\":\n",
" features = [\"d_gb\", \"cos(theta)\", \"mean_delta_bl\", \"mean_bl\"]\n",
" module_dir = os.path.dirname(gbe.__file__)\n",
Expand Down
2 changes: 1 addition & 1 deletion notebooks/model/garnet_formation_energy.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@
"\n",
"structures = []\n",
"targets = []\n",
"for i, j in df.iterrows():\n",
"for _i, j in df.iterrows():\n",
" s = parent.copy()\n",
" for k, indices in mapping.items():\n",
" for index in indices:\n",
Expand Down
2 changes: 1 addition & 1 deletion notebooks/pes/data/process_vasprun_to_mliap.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"\n",
"def get_document(vrun) -> dict:\n",
" \"\"\"\n",
" Parse the vasprun into a dictionary\n",
" Parse the vasprun into a dictionary.\n",
"\n",
" Args:\n",
" vrun (Vasprun object): the vasprun object from pymatgen\n",
Expand Down
6 changes: 5 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,15 @@ where = ["src"]
"apps/pes/params/*.*",
"describers/data/megnet_models/*",
"describers/data/m3gnet_models/matbench_mp_e_form/0/m3gnet/*",
"apps/pes/params/*.json",
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tip

Codebase Verification

Update required: Incorrect path specified in pyproject.toml

The path "apps/pes/params/.json" specified in pyproject.toml doesn't match the actual location of the JSON files in the repository. The correct path appears to be "src/maml/apps/pes/params/.json". Please update the pyproject.toml file with the correct path to ensure that the necessary JSON files are included in the package distribution.

  • Update line 70 in pyproject.toml to:
    "src/maml/apps/pes/params/*.json",
    

On a positive note, no sensitive information was detected in any of the JSON files found in the repository.

Analysis chain

LGTM! This change resolves the reported installation issue.

The addition of "apps/pes/params/*.json" to the package-data section ensures that the necessary JSON files are included in the package distribution when installing with pip install. This should resolve the FileNotFoundError that was occurring.

Please verify that the JSON files in the apps/pes/params directory do not contain any sensitive information that should not be distributed with the package.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify JSON files in apps/pes/params do not contain sensitive information.

# Test: Search for common sensitive information patterns in the JSON files.
# Expect: No matches found.
rg --type json -i -e 'password|secret|token|key|credentials' apps/pes/params

Length of output: 134


Script:

#!/bin/bash
# Description: Locate JSON files and check for sensitive information

# Step 1: Find all JSON files in the repository
echo "Searching for JSON files:"
fd -e json

# Step 2: If JSON files are found, search for sensitive information patterns
echo -e "\nChecking JSON files for sensitive information:"
fd -e json -x rg -i -e 'password|secret|token|key|credentials' {}

# Step 3: Check if the specific directory mentioned in pyproject.toml exists
echo -e "\nChecking for the existence of apps/pes/params directory:"
fd -t d "apps/pes/params"

Length of output: 4518

]

[tool.black]
line-length = 120

[tool.ruff]
target-version = "py311"
line-length = 120
line-length = 160
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider adhering to the PEP 8 recommended line length limit.

The change increases the maximum allowed line length for the ruff linter from 120 to 160 characters. However, the Python style guide PEP 8 recommends a maximum line length of 79 characters for better code readability and maintainability.

Allowing longer lines can make the code harder to read, maintain, and may lead to inconsistencies in code formatting across the project.

Please consider reverting the change and adhering to the PEP 8 recommended line length limit of 79 characters:

-line-length = 160
+line-length = 79
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
line-length = 160
line-length = 79

lint.select = [
"B", # flake8-bugbear
"C4", # flake8-comprehensions
Expand Down Expand Up @@ -112,6 +113,7 @@ lint.ignore = [
"B028", # No explicit stacklevel keyword argument found
"B904", # Within an except clause, raise exceptions with ...
"C408", # unnecessary-collection-call
"D103", # docstring is missing
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ensure all public functions have proper docstrings.

The change ignores the pydocstyle error "D103" for missing docstrings in public functions. However, docstrings provide important documentation for functions and help in understanding their purpose and usage.

Ignoring the missing docstring error may lead to undocumented or poorly documented code, making it harder for other developers to understand and maintain the codebase. It may also lead to confusion and errors when using the functions without proper documentation.

Please consider removing "D103" from the lint.ignore list and ensure that all public functions have proper docstrings:

-  "D103",    # docstring is missing
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"D103", # docstring is missing

"D105", # Missing docstring in magic method
"D205", # 1 blank line required between summary line and description
"D212", # Multi-line docstring summary should start at the first line
Expand All @@ -121,8 +123,10 @@ lint.ignore = [
"PLR", # pylint refactor
"PLW2901", # Outer for loop variable overwritten by inner assignment target
"PT013", # pytest-incorrect-pytest-import
"RET504", # assignment before `return` statement
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Avoid assignments before return statements.

The change ignores the ruff rule "RET504" that checks for assignments before return statements. However, assignments before return statements can be confusing and may indicate a potential bug or unintended behavior.

Ignoring this rule may lead to less readable and maintainable code. It can make the code harder to understand and reason about, and may introduce subtle bugs or unintended behavior that can be difficult to detect and debug.

Please consider removing "RET504" from the lint.ignore list and refactor any code that violates this rule for better code quality and maintainability:

-  "RET504",  # assignment before `return` statement
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"RET504", # assignment before `return` statement

"RUF012", # Disable checks for mutable class args. This is a non-problem.
"SIM105", # Use contextlib.suppress(OSError) instead of try-except-pass
"SIM108", # Use ternary operator instead of `if`-`else`-block
]
lint.pydocstyle.convention = "google"
lint.isort.required-imports = ["from __future__ import annotations"]
Expand Down
3 changes: 1 addition & 2 deletions src/maml/apps/pes/_gap.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,7 @@ def _line_up(structure, energy, forces, virial_stress):
virial_stress (list): stress should has 6 distinct
elements arranged in order [xx, yy, zz, xy, yz, xz].

Returns:
outputs: a proper format storing structure, energy, forces, virial_stress.
Returns: a proper format storing structure, energy, forces, virial_stress.
"""
full_virial_stress = [
virial_stress[0],
Expand Down
2 changes: 1 addition & 1 deletion src/maml/describers/_m3gnet.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,6 @@ def transform_one(self, structure: Structure | Molecule):
g = self.describer_model.graph_layers[i](g)
atom_fea[f"gc_{i + 1}"] = g[Index.ATOMS]
atom_fea_dict = {k: v for k, v in atom_fea.items() if k in self.output_layers}
if isinstance(self.return_type, dict):
if self.return_type is dict:
return atom_fea_dict
return pd.DataFrame(np.concatenate(list(atom_fea_dict.values()), axis=1))
Loading