Skip to content

Commit

Permalink
Merge pull request #1 from pyiron/update_module_name
Browse files Browse the repository at this point in the history
First setup transferring everything in from pyiron_contrib
  • Loading branch information
liamhuber authored Oct 6, 2023
2 parents c362b74 + 6075c5b commit 3f6c5af
Show file tree
Hide file tree
Showing 63 changed files with 9,878 additions and 200 deletions.
15 changes: 14 additions & 1 deletion .binder/environment.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,17 @@
channels:
- conda-forge
dependencies:
- pyiron_base
- coveralls
- coverage
- bidict =0.22.1
- cloudpickle =2.2.1
- graphviz =8.1.0
- maggma =0.57.1
- matplotlib =3.8.0
- numpy =1.26.0
- pyiron_atomistics =0.3.4
- pyiron_base =0.6.7
- python-graphviz =0.20.1
- toposort =1.10
- typeguard =4.1.5
- lammps
8 changes: 4 additions & 4 deletions .binder/postBuild
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
# pip install master
pip install --no-deps .
# Note: This produces build and pyiron_module_template.egg-info directories
# Note: This produces build and pyiron_workflow.egg-info directories

# clean up
if [ -d "notebooks" ]; then
mv notebooks/* .
fi
if [ -d "${HOME}/pyiron_module_template" ]; then
if [ -d "${HOME}/pyiron_workflow" ]; then
rm -r ${HOME}/.binder \
${HOME}/.ci_support \
${HOME}/.github \
${HOME}/build \
${HOME}/docs \
${HOME}/notebooks \
${HOME}/pyiron_module_template \
${HOME}/pyiron_module_template.egg-info \
${HOME}/pyiron_workflow \
${HOME}/pyiron_workflow.egg-info \
${HOME}/tests \
${HOME}/.gitattributes \
${HOME}/.gitignore \
Expand Down
4 changes: 4 additions & 0 deletions .ci_support/environment-notebooks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
channels:
- conda-forge
dependencies:
- lammps
15 changes: 13 additions & 2 deletions .ci_support/environment.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
channels:
- conda-forge
dependencies:
- pyiron_base

- coveralls
- coverage
- bidict =0.22.1
- cloudpickle =2.2.1
- graphviz =8.1.0
- maggma =0.57.1
- matplotlib =3.8.0
- numpy =1.26.0
- pyiron_atomistics =0.3.4
- pyiron_base =0.6.7
- python-graphviz =0.20.1
- toposort =1.10
- typeguard =4.1.5
4 changes: 2 additions & 2 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# .coveragerc to control coverage.py
[run]
source = pyiron_module_template
omit = pyiron_module_template/_version.py
source = pyiron_workflow
omit = pyiron_workflow/_version.py
concurrency = multiprocessing
2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1 +1 @@
pyiron_module_template/_version.py export-subst
pyiron_workflow/_version.py export-subst
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
name: Bug report
about: Create a bug report to help us eliminate issues and improve pyiron_module_template
about: Create a bug report to help us eliminate issues and improve pyiron_workflow
title: ''
labels: bug
assignees: ''
Expand Down
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
name: Feature request
about: Make a suggestion for a new feature or a change to pyiron_module_template
about: Make a suggestion for a new feature or a change to pyiron_workflow
title: ''
labels: enhancement
assignees: ''
Expand All @@ -13,7 +13,7 @@ assignees: ''

**Detailed Description**

<!--Please explain how you would like to see pyiron_module_template enhanced, what feature(s) you are looking for, what specific problems this will solve.-->
<!--Please explain how you would like to see pyiron_workflow enhanced, what feature(s) you are looking for, what specific problems this will solve.-->

**Further Information, Files, and Links**

Expand Down
2 changes: 1 addition & 1 deletion .github/delete-merged-branch-config.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
exclude:
- master
- main
delete_closed_pr: false
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
# This runs jobs which pyiron modules should run on pushes or PRs to main

name: Push-Pull-main
name: Push-main-Pull-all

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
pyiron:
uses: pyiron/actions/.github/workflows/push-pull-main.yml@main
secrets: inherit
secrets: inherit
with:
notebooks-env-files: .ci_support/environment.yml .ci_support/environment-notebooks.yml
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
include versioneer.py
include pyiron_module_template/_version.py
include pyiron_workflow/_version.py
include LICENSE
95 changes: 19 additions & 76 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,88 +1,31 @@
# pyiron_module_template
# pyiron_workflow

## Overview

This repository is a template for new pyiron modules similar to the existing modules of the
pyiron framework, e.g.
[pyiron_base](https://github.com/pyiron/pyiron_base),
[pyiron_atomistics](https://github.com/pyiron/pyiron_atomistics),
and
[pyiron_contrib](https://github.com/pyiron/pyiron_contrib).

Within this repository, the new module is called `pyiron_module_template` which should be renamed to `pyiron_IntendedModuleName`.
This can be easily achieved by modifying and running the update_module_name.sh script.

The licence is free to choose, but as a default the BSD3 licence packed here.

## Continuous Integration
## Overview

We collect all files relevant for the continuous integration (CI) pipelines in `.ci_support`,
while the actual CI workflows are handled by GitHub and stored in `.github`.
If you are cloning this template *inside* the pyiron GitHub organization, the full CI should work out-of-the-box by calling reusable workflows from [pyiron/actions](github.com/pyiron/actions) and inheriting organization-wide secrets.
Otherwise, you will either need to modify the CI workflow files, or give your repository the following secrets:
- `DEPENDABOT_WORKFLOW_TOKEN` (GitHub token for an account that has permissions to your repository -- needs to differ from the default `github_token` already available though! In pyiron we have a special [@pyiron_runner account](https://github.com/pyiron-runner) for this purpose.)
- `PYPI_PASSWORD` (Token generated on PyPi to give access to your account there)
- `CODACY_PROJECT_TOKEN` (Token generated on Codacy to give access to your account there)
This repository is home to the pyiron code for structuring workflows as graph objects, with different computational elements as nodes and data and execution signals travelling along edges. It is currently in an alpha state, changing quickly, and not yet feature-complete.

The default CI setup from [pyiron/actions](github.com/pyiron/actions) makes some assumptions about your directory structure.
The most important one is that your environment should be specified in `.ci_support/environment.yml`.
There is a base environment there already, giving dependence on `pyiron_base`.
The CI will automatically keep environment files read by readthedocs (which will look at `.readthedocs.yml`) and MyBinder (which looks in `.binder`) up-to-date based on this environment file.
## The absolute basics

In case you need extra environment files for some setups, you can modify the workflows in `.github/workflows`, which accept input variables for the docs, tests, and notebooks environments.
For example, it's typically good to not make your project depend on the `lammps` package, since this is not available for windows.
However, you might want to give some demo notebooks that run on MyBinder (a linux environment) and use LAMMPS calculations.
In this case, you could add a new file `.ci_support/environment-notebooks.yml`, and then edit `.github/workflows/push-pull-main.yml` so that instead of reading
`pyiron_workflow` offers a single-point-of-entry in the form of the `Workflow` object, and uses decorators to make it easy to turn regular python functions into "nodes" that can be put in a computation graph:

```yaml
jobs:
pyiron:
uses: pyiron/actions/.github/workflows/push-pull-main.yml@main
secrets: inherit
# All the environment files variables point to .ci_support/environment.yml by default
```
```python
from pyiron_workflow import Workflow

It instead reads
@Workflow.wrap_as.function_node("sum")
def x_plus_y(x: int = 0, y: int = 0) -> int:
return x + y

```yaml
jobs:
pyiron:
uses: pyiron/actions/.github/workflows/push-pull-main.yml@main
secrets: inherit
with:
notebooks-env-files: .ci_support/environment.yml .ci_support/environment-notebooks.yml
```
wf = Workflow("my_workflow")
wf.a1 = x_plus_y()
wf.a2 = x_plus_y()
wf.b = x_plus_y(x=wf.a1.outputs.sum, y=wf.a2.outputs.sum)

Where `.ci_support/environment-notebooks.yml` looks like:
out = wf(a1__x=0, a1__y=1, a2__x=2, a2__y=3)
out.b__sum
>>> 6

```yaml
channels:
- conda-forge
dependencies:
- lammps
wf.draw()
```

### Label-based CI

Some CI triggers when labels get applied to a PR.
In a new repository, you will need to define these labels:
- `format_black`: Runs black analyis and creates a bot-generated commit to fix any format violations
- `run_CodeQL`: Runs the external CodeQL analysis (expensive, only do at the end)
- `run_coverage`: Run all the tests in `tests` and use coveralls to generate a coverage report (also expensive, only run near the end of your PR)

## Documentation

You should modify this README to reflect the purpose of your new package.
You can look at the other pyiron modules to get a hint for what sort of information to include, and how to link badges at the head of your README file.

At a minimum, we suggest creating a meaningful example notebook in the `notebooks/` directory and creating a MyBinder badge so that people can quickly and easily explore your work.

You can also edit the docs for your package by modifying `docs/index.rst`.
By default, only a simple API section is included.

## Publishing your package

If you are inside the pyiron organization or have your own `PYPI_PASSWORD` secret configured, your package will be published on PyPI automatically when you make a new "release" on GitHub -- *as long as* that tag matches the pattern specified in `setup.cfg`; by default any tag that `pyiron_module_template-`, where `pyiron_module_template` is replaced with the name of your module. We recommend using semantic versioning so that your first release looks like `pyiron_module_template-0.0.1`.

Releasing your package on Conda-Forge is slightly more involved, but not too hard (at least for pure python packages).
See [conda-forge/staged-recipes](https://github.com/conda-forge/staged-recipes) for how to publish it there.
![](docs/_static/demo.png)
Binary file added docs/_static/demo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,10 +275,10 @@
# dir menu entry, description, category)
texinfo_documents = [
('index',
'pyiron_module_template',
'pyiron_workflow',
u'pyiron Documentation',
u'Max-Planck-Institut für Eisenforschung GmbH - Computational Materials Design (CM) Department',
'pyiron_module_template',
'pyiron_workflow',
'One line description of project.',
'Miscellaneous'),
]
Expand All @@ -295,7 +295,7 @@
# If true, do not generate a @detailmenu in the "Top" node's menu.
# texinfo_no_detailmenu = False

main(['-e', '-o', 'apidoc', '../pyiron_module_template', '--force'])
main(['-e', '-o', 'apidoc', '../pyiron_workflow', '--force'])

curdir = os.path.dirname(os.path.abspath(__file__))
if os.path.exists(os.path.join(curdir, 'source/notebooks')):
Expand Down
14 changes: 13 additions & 1 deletion docs/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,16 @@ channels:
dependencies:
- ipykernel
- nbsphinx
- pyiron_base
- coveralls
- coverage
- bidict =0.22.1
- cloudpickle =2.2.1
- graphviz =8.1.0
- maggma =0.57.1
- matplotlib =3.8.0
- numpy =1.26.0
- pyiron_atomistics =0.3.4
- pyiron_base =0.6.7
- python-graphviz =0.20.1
- toposort =1.10
- typeguard =4.1.5
8 changes: 4 additions & 4 deletions docs/index.rst
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
.. pyiron_module_template documentation master file
.. pyiron_workflow documentation master file
.. _index:


======================
pyiron_module_template
======================
===============
pyiron_workflow
===============

.. toctree::
:hidden:
Expand Down
36 changes: 0 additions & 36 deletions notebooks/version.ipynb

This file was deleted.

Loading

0 comments on commit 3f6c5af

Please sign in to comment.