diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 00000000..1a247031 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,54 @@ +See the [Scikit-HEP Developer introduction][skhep-dev-intro] for a detailed description of best practices for developing Scikit-HEP packages. + +[skhep-dev-intro]: https://scikit-hep.org/developer/intro + +# Installing pylhe + +First create a fork of the `pylhe` repository on GitHub, then clone your fork locally and change into the `pylhe` directory: + +```bash +# fork scikit-hep/pylhe +git clone https://github.com//pylhe.git +cd pylhe +``` + +# Setting up a development environment + +First you need `hatch`. +Install it via your package manager, `pipx`, `uvx` or `pixi`. +Then, you can set up a development environment by running: + +```bash +hatch env create dev +hatch shell dev +``` + +# Post setup activate of pre-commit + +You should prepare pre-commit, which will help you by checking that commits pass required checks: + +```bash +prek install # Will install a pre-commit hook into the git repo +``` + +You can also/alternatively run `prek run` (changes only) or `prek run --all-files` to check even without installing the hook. + +# Testing + +Use PyTest to run the unit checks: + +```bash +pytest +``` + +# Documentation + +In order to produce the documentation webpage locally, you can run the following commands: + +```bash +cd docs +hatch run docs:make html +``` + +Now find the generated documentation in `docs/build/html/index.html`. +You can also run `hatch run docs:make clean` to remove the generated files. diff --git a/developer.md b/developer.md new file mode 100644 index 00000000..d4dfa67d --- /dev/null +++ b/developer.md @@ -0,0 +1,27 @@ +# Release a new version of the software + +## PyPI + +For a step-by-step video guide check out the [release video](https://www.youtube.com/watch?v=tsAWDumpcW8) + +1. Check that the publishing action creating the wheels and source distribution appear correctly. +2. Go to Actions tab and workflow "Bump version". +3. Run the workflow manually by clicking the "Run workflow" button and adjusting the parameters. + - Set version bump level (i.e. "patch") + - Set new version "X.Y.Z" w/o "v" prefix + - Disable dry run, after you are confident that the workflow is working correctly (i.e. running dry run once). +4. Optionally, check the publishing action again for the new version. +5. Manually, run the publishing action by clicking the "Run workflow" button in order to publish to Test-PyPI. +6. Optionally, inspect the URL returned after Test-PyPI uploading to check the package. + Check that sdist and wheel are available for the new version. +7. Go to the Releases page. + Select "Draft a new release". +8. Pick the tag created by the "Bump version" workflow (here with a "v" prefix) and click "Generate release notes". + Tick "Set as the latest release" if this is the latest release and "Create a discussion" in the Category "Announcements". +9. Click "Publish release". +10. A build and publish to (Test)-PyPI workflow will be triggered automatically it should again upload sdist and wheel to PyPI. + +## Conda + +1. Wait a few hours for automatic PR https://github.com/conda-forge/pylhe-feedstock following the PyPI release. +2. Review that there are no dependency changes and merge the PR. diff --git a/pyproject.toml b/pyproject.toml index 67c273e7..5269954d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -60,7 +60,7 @@ test = [ ] develop = [ "pylhe[lint,test]", - "pre-commit", + "prek", "tbump>=6.7.0", ] docs = [ @@ -85,6 +85,16 @@ Homepage = "https://github.com/scikit-hep/pylhe" "Issue Tracker" = "https://github.com/scikit-hep/pylhe/issues" "Releases" = "https://github.com/scikit-hep/pylhe/releases" +[tool.hatch.envs.dev] +features = [ + "develop", +] + +[tool.hatch.envs.docs] +features = [ + "docs", +] + [tool.hatch.version] source = "vcs"