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

Conda/Python Package Process Creation and CI #2

Merged
merged 32 commits into from
Sep 16, 2024
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
daab13a
environment added
mpatrou Aug 26, 2024
87130e9
clea the environment
mpatrou Aug 27, 2024
0e990af
python package folder restructure, python package creation
mpatrou Aug 28, 2024
47a5241
environment updates and gitingor
mpatrou Aug 28, 2024
eb00ecc
conda package creation
mpatrou Aug 30, 2024
db3a0bb
folder reorganization and gitignore updates
mpatrou Aug 30, 2024
a3bafc4
conda build github actions
mpatrou Aug 30, 2024
76d564b
channels added
mpatrou Aug 30, 2024
4bf87d8
moved in directory
mpatrou Aug 30, 2024
fba2120
toml added
mpatrou Aug 30, 2024
4ec7801
version update
mpatrou Aug 30, 2024
9a8af47
check wheels added
mpatrou Aug 30, 2024
7af9aaa
python added
mpatrou Aug 30, 2024
88d6855
version number fixed, missing files added in wheel
mpatrou Aug 30, 2024
ff6b6d4
include late version of h5py to be compatible with late versions of n…
mpatrou Aug 30, 2024
b819c4e
python version update
mpatrou Aug 30, 2024
94204f9
put python version back, remove caching
mpatrou Sep 5, 2024
95c27b8
pyqt5 added
mpatrou Sep 5, 2024
19b03ed
pyqt specific version
mpatrou Sep 5, 2024
df0a04a
h5py
mpatrou Sep 5, 2024
d99261a
remove extra package
mpatrou Sep 5, 2024
3a7f57b
extra package removed
mpatrou Sep 5, 2024
4bf7435
VERSON removed, cleanup
mpatrou Sep 5, 2024
d80d95b
renamed
mpatrou Sep 5, 2024
7768ac1
database default paths updated,config added in the package
mpatrou Sep 10, 2024
1bed8fe
channel specified for pytorch
mpatrou Sep 13, 2024
fcb40dc
space removed
mpatrou Sep 13, 2024
6a9d498
installation instruction updated
mpatrou Sep 13, 2024
70ab159
instructions reording
mpatrou Sep 13, 2024
8999b17
install folder removed
mpatrou Sep 13, 2024
ba41b1c
extra step removed
mpatrou Sep 13, 2024
b1bb901
Update README.md
cyqjh Sep 13, 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
54 changes: 54 additions & 0 deletions .github/workflows/actions.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: CI

on:
workflow_dispatch:
pull_request:
push:
branches: [next]
tags: ['v*']

jobs:
conda-build:
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}
steps:
- uses: actions/checkout@v4
- uses: mamba-org/setup-micromamba@v1
with:
environment-file: environment.yml
cache-environment-key: ${{ runner.os }}-env-${{ hashFiles('**/environment.yml') }}
cache-downloads-key: ${{ runner.os }}-downloads-${{ hashFiles('**/environment.yml') }}
condarc: |
channels:
- conda-forge
- pytorch
- pyg
- name: building python wheel
shell: bash -l {0}
run: |
python -m build --wheel --no-isolation
check-wheel-contents dist/inspired-*.whl
- name: build conda package
shell: bash -l {0}
run: |
# set up environment
cd conda.recipe
echo "versioningit $(versioningit ../)"
# build the package
CHANNELS="--channel conda-forge --channel pytorch --channel pyg"
VERSION=$(versioningit ../) conda mambabuild $CHANNELS --output-folder . .
conda verify noarch/inspired*.tar.bz2
- name: upload conda package to anaconda
shell: bash -l {0}
if: startsWith(github.ref, 'refs/tags/v')
env:
ANACONDA_API_TOKEN: ${{ secrets.ANACONDA_TOKEN }}
IS_RC: ${{ contains(github.ref, 'rc') }}
run: |
# label is main or rc depending on the tag-name
CONDA_LABEL="main"
if [ "${IS_RC}" = "true" ]; then CONDA_LABEL="rc"; fi
echo pushing ${{ github.ref }} with label $CONDA_LABEL
anaconda upload --label $CONDA_LABEL conda.recipe/noarch/inspired*.tar.bz2
163 changes: 163 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST
_version.py
conda.recipe/*
!conda.recipe/meta.yaml
# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock

# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm.fming.dev/#use-with-ide
.pdm.toml

# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/

# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/
.envrc
64 changes: 64 additions & 0 deletions conda.recipe/meta.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# load information from pyproject.toml
{% set pyproject = load_file_data('pyproject.toml') %}
{% set project = pyproject.get('project', {}) %}
{% set license = project.get('license').get('text') %}
{% set description = project.get('description') %}
{% set project_url = pyproject.get('project', {}).get('urls') %}
{% set url = project_url.get('homepage') %}
# this will get the version set by environment variable
{% set version = environ.get('VERSION') %}
{% set version_number = version.split('+')[0] %}
{% set git_describe_number = environ.get('GIT_DESCRIBE_NUMBER', '0') | string %}

package:
name: inspired
version: {{ version_number }}

source:
path: ..

build:
noarch: python
number: {{ git_describe_number }}
string: py{{py}}
script: {{ PYTHON }} -m pip install . --no-deps --ignore-installed -vvv

requirements:
host:
- versioningit
- setuptools>=42
- wheel
- python

build:
- setuptools>=42
- versioningit

run:
- python
- h5py>=3.9
- qtpy
- pyqt==5
- pytorch
- phonopy
- pandas
- seekpath
- matgl
- chgnet
- pymatgen==2024.5.1
- spglib==2.4.0
- mkl==2024.0
- pytorch-sparse
- pytorch-cluster
- pytorch-scatter

test:
imports:
- inspired

about:
home: {{ url }}
license: {{ license }}
license_family: MIT
license_file: ../LICENSE
summary: {{ description }}
34 changes: 34 additions & 0 deletions environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: inspired-dev
channels:
- conda-forge
- pytorch
- pyg
dependencies:
- anaconda-client
- boa
- check-wheel-contents
- conda-build
- conda-verify
- h5py >= 3.9
- toml
- setuptools
- pre-commit
- python >= 3.9
- python-build
- pymatgen==2024.5.1
- spglib==2.4.0
- versioningit
- pandas
- pyqt==5.*
- qtpy
- phonopy
- seekpath
- matgl
- chgnet
- mkl==2024.0 # solves the pytorch error
- pytorch
- pymace
- pyg
- pytorch-sparse
- pytorch-cluster
- pytorch-scatter
68 changes: 68 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
[project]
name = "inspired"
description = "Inelastic Neutron Scattering Prediction for Instantaneous Results and Experimental Design"
dynamic = ["version"]
requires-python = ">=3.9"
dependencies = [
"pytorch",
"h5py >= 3.9",
"phonopy",
"pandas",
"seekpath",
"matgl",
"chgnet",
"qtpy",
"pyqt5==5.*",
"pymatgen==2024.5.1",
"spglib==2.4.0",
"pytorch-sparse",
"pytorch-cluster",
"pytorch-scatter"
]
license = { text = "GPL3.0" }

[project.urls]
homepage = "https://github.com/neutrons/inspired/"

[build-system]
requires = [
"setuptools",
"wheel",
"toml",
"versioningit"
]
build-backend = "setuptools.build_meta"

[tool.versioningit.vcs]
method = "git"
default-tag = "0.2.0"

[tool.versioningit.next-version]
method = "minor"

[tool.versioningit.format]
distance = "{next_version}.dev{distance}"
dirty = "{version}+d{build_date:%Y%m%d}"
distance-dirty = "{next_version}.dev{distance}+d{build_date:%Y%m%d%H%M}"

[tool.versioningit.write]
file = "src/inspired/_version.py"

[tool.setuptools.packages.find]
where = ["src"]

[tool.setuptools.package-data]
"*" = ["*.yml","*.yaml","*.ini","*.json","*.pt","*.model","oclimax*","*.ui","M3GNet-MP-2021.2.8-PES/*"]

[project.gui-scripts]
inspired = "inspired.inspired:gui"

[tool.pylint]
max-line-length = 120
disable = ["too-many-locals",
"too-many-statements",
"too-many-instance-attributes",
"too-many-arguments",
"duplicate-code"
]
extension-pkg-whitelist = ["PyQt5"]
Empty file added src/inspired/gui/__init__.py
Empty file.
Loading