From 2c2f2fd4a41caf6b95619dd2587928d92edf5eb0 Mon Sep 17 00:00:00 2001 From: "Jose M. Pizarro" <112697669+JosePizarro3@users.noreply.github.com> Date: Tue, 25 Jun 2024 15:42:08 +0200 Subject: [PATCH] Version tag (#90) * Added version from pyproject * Improved README * Deleted setup.py --- .gitignore | 1 + README.md | 28 +++++++--------------------- pyproject.toml | 3 +++ setup.py | 4 ---- src/nomad_simulations/__init__.py | 4 ++++ 5 files changed, 15 insertions(+), 25 deletions(-) delete mode 100644 setup.py 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__ = ''