Skip to content

Commit

Permalink
Setup repository for pypi package management (#4)
Browse files Browse the repository at this point in the history
* Creating pip package setup

* Updated documentation

* Reconfigure package

* Set python based on sys
  • Loading branch information
charnley authored Mar 29, 2024
1 parent ace87ed commit 84e83e3
Show file tree
Hide file tree
Showing 8 changed files with 85 additions and 43 deletions.
3 changes: 3 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
include *.py
recursive-include src/qmllib *.f90
global-exclude *~ *.py[cod] *.so
15 changes: 9 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ all: env setup

env:
${mamba} env create -f ./environment_dev.yaml -p ./env --quiet
${pip} install -e .
${python} -m pre_commit install
${python} -m pip install -e .

setup: ./.git/hooks/pre-commit

Expand All @@ -35,19 +36,21 @@ compile:
${python} _compile.py

build:
@#${python} -m build .
# ${python} -m pip wheel --no-deps -v .
${python} -m pip wheel -v .
ls *.whl
${python} -m build --sdist --skip-dependency-check .
@# ${python} -m pip wheel --no-deps -v .
@# ${python} -m pip wheel -v .
@#ls *.whl

clean:
find ./src/ -type f \
-name "*.so" \
-name "*.pyc" \
-name ".pyo" \
-delete
rm -rf ./src/*.egg-info/
rm -rf *.whl
rm -fr ./build/ ./__pycache__/
rm -rf ./build/ ./__pycache__/
rm -rf ./dist/

clean-env:
rm -rf ./env/
Expand Down
58 changes: 31 additions & 27 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,75 +9,79 @@ building blocks to carry out efficient and accurate machine learning. As such,
the goal is to provide usable and efficient implementations of concepts such as
representations and kernels.

====
==============
QML or QMLLib?
====
==============

``qmllib`` represents the core library functionality derived from the original
QML package, providing a powerful toolkit for quantum machine learning
applications, but without the high-level abstraction, for example SKLearn.

This package is and should stay free-function design oriented.

Breaking changes from `qml`:
Breaking changes from ``qml``:

- FCHL representations callable interface to be consistent with other representations (e.i. atoms, coordinates)
* FCHL representations callable interface to be consistent with other representations (e.i. atoms, coordinates)


====
==============
How to install
====
==============

A proper pip-package is on the way, for now

.. code-block:: bash
pip install git+https://github.com/qmlcode/qmllib
or if you want a specific feature branch

.. code-block:: bash
pip install git+https://github.com/qmlcode/qmllib@feature_branch
====
How to start developing
====
=================
How to contribute
=================

Know a issue and want to get started developing?

.. code-block:: bash
git clone repo.url qmllib.git
cd qmllib.git
make # setup env
make compile # compile
You know have a conda environment in `./env` and are ready to run

.. code-block:: bash
make test
happy developing

====
==========
How to use
====
==========

.. code-block:: python
raise NotImplementedError
====
===========
How to cite
====
===========

raise NotImplementedError
.. code-block:: python
=====
How to contribute
=====

* Raise issues
* Create pull requests
* Create discussions
raise NotImplementedError
=====
=========
What TODO
=====
=========

* Setup ifort flags
* Setup based on FCC env variable or --global-option flags
* Find MKL from env (for example conda)
* Find what numpy has been linked too (lapack or mkl)
* Setup ifort flags
* Setup based on FCC env variable or --global-option flags
* Find MKL from env (for example conda)
* Find what numpy has been linked too (lapack or mkl)
7 changes: 5 additions & 2 deletions _compile.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import os
import subprocess
import sys
from pathlib import Path

f90_modules = {
Expand Down Expand Up @@ -69,11 +70,13 @@ def main():
for module_name, module_sources in f90_modules.items():

path = Path(module_name)

parent = path.parent
stem = path.stem

cwd = Path("src/qmllib") / parent
cmd = ["python", "-m", "numpy.f2py", "-c"] + flags + module_sources + ["-m", str(stem)]
cmd = (
[sys.executable, "-m", "numpy.f2py", "-c"] + flags + module_sources + ["-m", str(stem)]
)
print(cwd, " ".join(cmd))

proc = subprocess.run(cmd, cwd=cwd, capture_output=True, text=True)
Expand Down
4 changes: 3 additions & 1 deletion environment_dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,14 @@ dependencies:
- monkeytype
- numpy
- pandas
- pyarrow
- pip
- pre-commit
- pyarrow
- pytest
- scikit-learn
- scipy
# build
- build
- meson
- ninja
- twine
19 changes: 17 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,23 @@ build-backend = "setuptools.build_meta"
name = "qmllib"
dynamic = ["version"]
authors = []
requires-python = ">=3.12"
requires-python = ">=3.8"
readme="README.rst"
description="Python/Fortran toolkit for representation of molecules and solids for machine learning of properties of molecules and solids."
classifiers = [
"Intended Audience :: Developers",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3",
"Programming Language :: Python",
"Topic :: Scientific/Engineering :: Artificial Intelligence",
"Topic :: Scientific/Engineering :: Chemistry",
]
keywords = ["qml", "quantum chemistry", "machine learning"]
dependencies=["numpy", "scipy"]

[project.urls]
Homepage = "https://qmlcode.org"

[options.packages.find]
where="src"
Expand All @@ -20,6 +36,5 @@ version = {attr = "qmllib.version.__version__"}
[tool.setuptools.package-data]
"*" = ['*.so']


# [tool.black]
# line-length = 120
20 changes: 16 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,26 @@
import sys
from pathlib import Path

from setuptools import setup

try:
import _compile
except ImportError:
import sys
from pathlib import Path

sys.path.append(str(Path(__file__).resolve().parent))
import _compile

if __name__ == "__main__":
_compile.main()
setup()
setup(
description="Python/Fortran toolkit for representation of molecules and solids for machine learning of properties of molecules and solids.",
classifiers=[
"Intended Audience :: Developers",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3",
"Programming Language :: Python",
"Topic :: Scientific/Engineering :: Artificial Intelligence",
"Topic :: Scientific/Engineering :: Chemistry",
],
keywords=["qml", "quantum chemistry", "machine learning"],
)
2 changes: 1 addition & 1 deletion src/qmllib/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "1.0.0"
__version__ = "1.0.1"

0 comments on commit 84e83e3

Please sign in to comment.