Skip to content

Commit

Permalink
Use new uv package manager to install deps in CI (#133)
Browse files Browse the repository at this point in the history
* use new uv package manager to install deps in CI

* use torch.linalg.cross to silence UserWarning about missing dim kwarg

#132 (comment)

* fix Failed to parse `git+https://gitlab.com/ase/ase`
  Caused by: URL requirement must be preceded by a package name. Add the name of the package before the URL (e.g., `package_name @ https://...`).

* use windows-compat uv install command

* drop git+ from ase install URL

* quotes maybe?

* restore git+

* try ase source install with --upgrade

* generate constraints.txt in CI to prevent uv from downgrading ase installed from git to pypi version

* install ase from git last to prevent uv downgrade
  • Loading branch information
janosh authored Mar 5, 2024
1 parent 3719f70 commit 7fedf53
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 10 deletions.
11 changes: 7 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,17 @@ jobs:
cache: pip
cache-dependency-path: pyproject.toml

- name: Install uv
run: pip install uv

- name: Install dependencies
run: |
pip install cython
uv pip install cython --system
# install ase from main branch until FrechetCellFilter is released
# TODO remove pip install git+https://gitlab.com/ase/ase
pip install git+https://gitlab.com/ase/ase
# TODO remove uv pip install git+https://gitlab.com/ase/ase
python setup.py build_ext --inplace
pip install -e .[test]
uv pip install -e .[test] --system
uv pip install --upgrade 'ase@git+https://gitlab.com/ase/ase' --system
- name: Run Tests
run: pytest --capture=no --cov --cov-report=xml .
Expand Down
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ default_install_hook_types: [pre-commit, commit-msg]

repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.2.2
rev: v0.3.0
hooks:
- id: ruff
args: [--fix]
Expand Down Expand Up @@ -46,7 +46,7 @@ repos:
- svelte

- repo: https://github.com/pre-commit/mirrors-eslint
rev: v9.0.0-beta.0
rev: v9.0.0-beta.1
hooks:
- id: eslint
types: [file]
Expand Down
6 changes: 3 additions & 3 deletions chgnet/graph/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,9 +186,9 @@ def add_edge(self, center_index, neighbor_index, image, distance) -> None:
# is the reverse of our DE
if added_DE == this_directed_edge:
# Add UDE index to this DE
this_directed_edge.info[
"undirected_edge_index"
] = added_DE.info["undirected_edge_index"]
this_directed_edge.info["undirected_edge_index"] = (
added_DE.info["undirected_edge_index"]
)

# At the center node, draw edge with this DE
self.nodes[center_index].add_neighbor(
Expand Down
4 changes: 3 additions & 1 deletion chgnet/model/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -807,7 +807,9 @@ def from_graphs(
else:
strain = None
lattice = graph.lattice
volumes.append(torch.dot(lattice[0], torch.cross(lattice[1], lattice[2])))
volumes.append(
torch.dot(lattice[0], torch.linalg.cross(lattice[1], lattice[2]))
)
strains.append(strain)

# Bonds
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ ignore = [
"EM",
"ERA001", # found commented out code
"FBT001", # Boolean positional argument in function
"ISC001",
"FBT002", # Boolean keyword argument in function
"NPY002", # TODO replace legacy np.random.seed
"PLR", # pylint refactor
Expand Down
1 change: 1 addition & 0 deletions site/make_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
- prettier badges linking to source code on GitHub
- remove bold tags since they break inline code.
"""

from __future__ import annotations

import json
Expand Down

0 comments on commit 7fedf53

Please sign in to comment.