diff --git a/.gitignore b/.gitignore index 65d09cd0..5274b0ab 100644 --- a/.gitignore +++ b/.gitignore @@ -25,6 +25,7 @@ share/python-wheels/ .installed.cfg *.egg MANIFEST +_version.py # PyInstaller # Usually these files are written by a python script from a template diff --git a/README.md b/README.md index 747692cd..ad168a49 100644 --- a/README.md +++ b/README.md @@ -14,9 +14,14 @@ This is a plugin for [NOMAD](https://nomad-lab.eu) which contains the base secti ## Getting started -### Install the dependencies +`nomad-simulations` can be installed as a PyPI package using `pip`. We require features from the `nomad-lab` package which are not publicly available in PyPI, so an extra flag `--index-url` needs to be specified when pip installing this package: +```sh +pip install nomad-simulations --index-url https://gitlab.mpcdf.mpg.de/api/v4/projects/2187/packages/pypi/simple +``` -Clone the project and in the workspace folder, create a virtual environment (note this project uses Python 3.9): +## Development + +If you want to develop locally this package, clone the project and in the workspace folder, create a virtual environment (note this project uses Python 3.9): ```sh git clone https://github.com/nomad-coe/nomad-simulations.git @@ -119,25 +124,6 @@ where `${workspaceFolder}` refers to the NOMAD root. The settings configuration file `.vscode/settings.json` performs automatically applies the linting upon saving the file progress. -### Build the python package - -The `pyproject.toml` file contains everything that is necessary to turn the project -into a pip installable python package. Run the python build tool to create a package distribution: - -``` -uv pip install build -python -m build --sdist -``` - -You can install the package with pip: - -``` -uv pip install dist/nomad-simulations-0.1.0 -``` - -Read more about python packages, `pyproject.toml`, and how to upload packages to PyPI -on the [PyPI documentation](https://packaging.python.org/en/latest/tutorials/packaging-projects/). - ### Documentation on Github pages To deploy documentation on Github pages, make sure to [enable GitHub pages via the repo settings](https://docs.github.com/en/pages/getting-started-with-github-pages/configuring-a-publishing-source-for-your-github-pages-site#publishing-from-a-branch). diff --git a/pyproject.toml b/pyproject.toml index 5c644e84..597f608e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -128,6 +128,9 @@ package-dir = { "" = "src" } [tool.setuptools.packages.find] where = ["src"] +[tool.setuptools_scm] +write_to = "src/nomad_simulations/_version.py" + [project.entry-points.'nomad.plugin'] nomad_simulations_plugin = "nomad_simulations.schema_packages:nomad_simulations_plugin" diff --git a/setup.py b/setup.py deleted file mode 100644 index 6b40b52b..00000000 --- a/setup.py +++ /dev/null @@ -1,4 +0,0 @@ -from setuptools import setup - -if __name__ == '__main__': - setup() diff --git a/src/nomad_simulations/__init__.py b/src/nomad_simulations/__init__.py index e69de29b..ce2e284e 100644 --- a/src/nomad_simulations/__init__.py +++ b/src/nomad_simulations/__init__.py @@ -0,0 +1,4 @@ +try: + from ._version import version as __version__ +except ImportError: + __version__ = ''