Skip to content

Commit c2aa12d

Browse files
authored
Merge pull request #204 from simphony/dev
Merge release 2.5.0
2 parents 8e4d914 + db01dac commit c2aa12d

12 files changed

+518
-211
lines changed

docs/source/api_ref.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,4 +84,10 @@ This document is for developers and/or advanced users of OSP-core, it contains a
8484
.. automodule:: osp.core.utils
8585
:imported-members:
8686
:members:
87-
```
87+
```
88+
89+
### pico
90+
```{eval-rst}
91+
.. automodule:: osp.core.pico
92+
:members: install, uninstall, packages, namespaces
93+
```

docs/source/contribute.md

Lines changed: 84 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -6,25 +6,31 @@ in order to help those that want to contribute to SimPhoNy.
66
### Tools
77
The following are some of the technologies and concepts we use regularly.
88
It might be useful to become familiar with them:
9-
- Version control: Git, GitHub and GitLab
10-
- Python virtual environments/conda
11-
- Docker
12-
- Unittesting
13-
- Benchmarks
9+
- Version control: [Git](https://git-scm.com/),
10+
[GitHub](https://github.com/about) and
11+
[GitLab](https://about.gitlab.com/)
12+
- [Unittest](https://docs.python.org/3/library/unittest.html)
1413
- Continuous integration
14+
- Python virtual environments/[conda](https://docs.conda.io)
15+
- [Docker](https://www.docker.com/resources/what-container/)
16+
- Benchmarks
1517

1618
### Code Organisation
1719
There are 3 main categories of repos:
18-
- [_OSP-core_](https://github.com/simphony/osp-core) contains the nucleus of SimPhoNy, the base on which the wrappers build.
20+
- [_OSP-core_](https://github.com/simphony/osp-core) contains the nucleus of
21+
SimPhoNy, the base on which the wrappers build.
1922
- Each _wrapper_ will be in its own repository on GitHub or GitLab,
20-
mimicking [wrapper_development](https://github.com/simphony/wrapper-development).
21-
- [_docs_](https://github.com/simphony/docs) holds the source for this documentation.
23+
mimicking
24+
[wrapper_development](https://github.com/simphony/wrapper-development).
25+
- [_docs_](https://github.com/simphony/docs)
26+
holds the source for this documentation.
2227

2328
There are also 4 types of branches:
2429
- `master/main` contains all the releases, and should always be stable.
2530
- `dev` holds the code for the newest release that is being developed.
2631
- `issue branch` is where an specific issue is being solved.
27-
- `hotfix branch` is where a critical software bug detected on the stable release (more on this later) is being solved.
32+
- `hotfix branch` is where a critical software bug detected on the stable
33+
release (more on this later) is being solved.
2834

2935
All wrappers and OSP-core are part of a common directory structure:
3036
- _`osp/`_: contains all the SimPhoNy source code.
@@ -38,10 +44,12 @@ All wrappers and OSP-core are part of a common directory structure:
3844
- Every new feature or bug is defined in an issue and labelled accordingly.
3945
If there is something that is missing or needs improving,
4046
make an issue in the appropriate project.
41-
- Generally, the issues are fixed by creating a new `issue branch` from the `dev` branch, committing to that branch and making a new Pull/Merge Request when done.
42-
An owner of the project should be tagged for review.
43-
They will review and merge the PR if the fix is correct, deleting the `issue branch` afterwards.
44-
The changes should be clearly explained in the issue/Pull Request.
47+
- Generally, the issues are fixed by creating a new `issue branch` from the
48+
`dev` branch, committing to that branch and making a new Pull/Merge
49+
Request when done. An owner of the project should be tagged for review.
50+
They will review and merge the PR if the fix is correct, deleting the
51+
`issue branch` afterwards. The changes should be clearly explained in the
52+
issue/Pull Request.
4553
```{warning}
4654
If the issue is a critical software bug detected in the stable release, a
4755
`hotfix branch` should be created from the `master/main` branch
@@ -54,15 +62,17 @@ All wrappers and OSP-core are part of a common directory structure:
5462
`hotfix branch`.
5563
```
5664
- Once the features for a release have been reached, `dev` will be merged to
57-
`master/main`. Every new commit in the `master/main` branch generally corresponds
58-
to a new release, which is labelled with a
65+
`master/main`. Every new commit in the `master/main` branch generally
66+
corresponds to a new release, which is labelled with a
5967
[git tag](https://git-scm.com/book/en/v2/Git-Basics-Tagging) matching its
60-
version number. An exception to this rule may apply, for example when several
61-
critical hotfixes are applied in a row, as it would then be better to just to
62-
publish a single release afterwards. In regard to version numbering, we adhere to the
68+
version number. An exception to this rule may apply, for example when
69+
several critical hotfixes are applied in a row, as it would then be
70+
better to just to publish a single release afterwards. In regard to
71+
version numbering, we adhere to the
6372
[_Semantic versioning_](https://semver.org/) rules.
6473

65-
In the next image it can be seen how the branches usually look during this workflow, and the different commits used to synchronise them:
74+
In the next image it can be seen how the branches usually look during this
75+
workflow, and the different commits used to synchronise them:
6676

6777
<figure style="display: table; text-align:center; margin-left: auto; margin-right:auto">
6878

@@ -73,32 +83,71 @@ In the next image it can be seen how the branches usually look during this workf
7383
## Coding
7484
### Documenting
7585
- All code must be properly documented with meaningful comments.
76-
- For readability, we now follow the [Google docstring format](https://google.github.io/styleguide/pyguide.html#s3.8-comments-and-docstrings).
86+
- For readability, we now follow the
87+
[Google docstring format](https://google.github.io/styleguide/pyguide.html#s3.8-comments-and-docstrings).
7788
- If some behaviour is very complex, in-line comments can be used.
7889
However, proper naming and clear operations are always preferred.
7990

91+
### Code style
92+
- Code should follow
93+
[PEP8 code style conventions](https://peps.python.org/pep-0008/).
94+
- All Python code should be validated by the
95+
[Flake8](https://github.com/pycqa/flake8) tool. The validation is also
96+
enforced on the repository by the
97+
[continuous integration](contribute.md#continuous-integration). Click
98+
[here](https://github.com/simphony/osp-core/blob/master/.github/workflows/ci.yml#L12)
99+
to see the specific options with which Flake8 is launched.
100+
- All Python code should be reformatted with
101+
[black](https://github.com/psf/black) and
102+
[isort](https://github.com/PyCQA/isort). The use of said tools is
103+
enforced by the
104+
[continuous integration](contribute.md#continuous-integration). Therefore,
105+
we strongly recommend that you use the
106+
[configuration file](https://github.com/simphony/osp-core/blob/master/.pre-commit-config.yaml)
107+
bundled with the repository to
108+
[install](https://pre-commit.com/#installation) the
109+
[pre-commit framework](https://pre-commit.com/), that automates the task
110+
using git pre-commit hooks.
111+
- A few
112+
[other style conventions](https://github.com/simphony/osp-core/blob/master/.pre-commit-config.yaml)
113+
are also enforced by the continuous integration through
114+
[pre-commit](https://pre-commit.com/) (such as empty lines at the end of
115+
text files). If you decide not to use it, the CI will let you know what
116+
to correct.
117+
80118
### Testing
81-
- All Python code should pass Flake8 tests.
82119
- All complex functionality must be tested.
83-
- If some implementation can not be checked through unittest, it should be at least manually run in different systems to assure an expected behaviour.
120+
- If some implementation can not be checked through unittest, it should be
121+
at least manually run in different systems to assure an expected behaviour.
84122

85123
### Continuous Integration
86124
- We currently run the CI through Github Actions/GitLab CI.
87-
- Flake8 and unittests are automatically run for all PR.
88-
- For the OSP-core code, benchmarks are run after every merge to `dev`. Benchmark results are
89-
available [here](https://simphony.github.io/osp-core/dev/bench/index.html).
90-
The CI will report a failure when a benchmark is 50% slower than in the previous run, in addition to automatically commenting on the commit.
125+
- Code style conventions are enforced through the use of Flake8, black, isort,
126+
and various
127+
[pre-commit](https://pre-commit.com/)
128+
[hooks](https://github.com/simphony/osp-core/blob/master/.pre-commit-config.yaml).
129+
- Tests are automatically run for all pull requests.
130+
- For the OSP-core code, benchmarks are run after every merge to `dev`.
131+
Benchmark results are available
132+
[here](https://simphony.github.io/osp-core/dev/bench/index.html). The CI
133+
will report a failure when a benchmark is 50% slower than in the previous
134+
run, in addition to automatically commenting on the commit.
91135

92136
### Naming conventions
93-
- Use `cuds_object` as the argument name of your methods (not `entity`, `cuds`, `cuds_instance`...).
94-
- The official spelling is `OSP-core` (as opposed to _osp core_, _OSP-Core_ or similar).
137+
- Use `cuds_object` as the argument name of your methods (not `entity`,
138+
`cuds`, `cuds_instance`...).
139+
- The official spelling is `OSP-core` (as opposed to _osp core_, _OSP-Core_
140+
or similar).
95141

96142
## Contribute to OSP-core
97-
If you are not a member of the [SimPhoNy organisation](https://github.com/simphony), rather than creating a branch
98-
from `dev`, you will have to fork the repository and create the Pull Request.
143+
If you are not a member of the
144+
[SimPhoNy organisation](https://github.com/simphony), rather than creating
145+
a branch from `dev`, you will have to fork the repository and create the
146+
Pull Request.
99147

100148
## Contribute to wrapper development
101-
For a sample wrapper, visit the [wrapper_development](https://github.com/simphony/wrapper-development) repo.
149+
For a sample wrapper, visit the
150+
[wrapper_development](https://github.com/simphony/wrapper-development) repo.
102151

103152
README files should include:
104153
- Information regarding the purpose of the wrapper and the backend used.
@@ -108,6 +157,7 @@ README files should include:
108157
- Any other necessary information for users and other developers.
109158

110159
## Contribute to the docs
111-
If you have any suggestion for this documentation, whether it is something that needs more explanation, is inaccurate or simply a note on anything that could be improved, you can open an issue [here](https://github.com/simphony/docs/issues), and we will look into it!.
112-
113-
160+
If you have any suggestion for this documentation, whether it is something
161+
that needs more explanation, is inaccurate or simply a note on anything
162+
that could be improved, you can open an issue
163+
[here](https://github.com/simphony/docs/issues), and we will look into it!.

docs/source/general_architecture.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,8 @@ It is independent of any backend and provides the basic ontology based data stru
133133
### Ontology file
134134
OSP-core requires an ontology file to create the appropriate CUDS classes.
135135

136-
Said ontology must be either in a YAML format as defined by [our specification](yaml.md)
137-
or [one of the supported owl ontologies](owl.md).
136+
Said ontology must be either in a YAML format as defined by [our specification](working_with_ontologies.md#osp-core-yaml-ontology-format)
137+
or [one of the supported owl ontologies](working_with_ontologies.md#owl-ontologies-and-rdfs-vocabularies).
138138

139139
<details>
140140
<summary>YAML Ontology sample</summary>

docs/source/index.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,9 @@ installation
7777
:caption: Usage Guide
7878
:maxdepth: 2
7979
80+
utils
8081
jupyter/cuds_api
8182
jupyter/sessions_and_vars
82-
utils
8383
jupyter/multiple_wrappers
8484
jupyter/import_export
8585
jupyter/simlammps
@@ -92,9 +92,8 @@ jupyter/quantum_espresso
9292
:maxdepth: 2
9393
9494
ontology_intro
95+
working_with_ontologies
9596
ontologies_included
96-
yaml
97-
owl
9897
jupyter/ontology_interface
9998
```
10099

docs/source/jupyter/cuds_api.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
"\n",
6464
"- `attributes`: The values of the ontology attributes of an individual (also known as [data properties](https://www.w3.org/TR/owl2-syntax/#Data_Properties) in [OWL](https://en.wikipedia.org/wiki/Web_Ontology_Language)) may also be accessed and modified as python properties of the CUDS objects. For example: `cuds_object.name = \"Bob\"`.\n",
6565
"\n",
66-
"There are some advanced functionalities NOT covered in this tutorial. Among them, we highlight the `update` method, which is covered in the [wrapper tutorial](multiple-wrappers.ipynb), where it can be seen in action. For a complete list of available methods and properties, check the API reference. That whole set of methods and attributes constitutes the CUDS [API](https://en.wikipedia.org/wiki/API).\n",
66+
"There are some advanced functionalities NOT covered in this tutorial. Among them, we highlight the `update` method, which is covered in the [wrapper tutorial](multiple_wrappers.ipynb), where it can be seen in action. For a complete list of available methods and properties, check the API reference. That whole set of methods and attributes constitutes the CUDS [API](https://en.wikipedia.org/wiki/API).\n",
6767
"\n",
6868
"[//]: # (TODO: Link to API reference.)"
6969
]
@@ -88,7 +88,7 @@
8888
}
8989
},
9090
"source": [
91-
"The first step is to install the city ontology. Use the tool pico for this. If you want to know more about ontology installation, check the documentation on the [pico ontology installation tool](https://simphony.readthedocs.io/en/latest/utils.html#pico-installs-cuds-ontologies), [YAML ontology installation files](https://simphony.readthedocs.io/en/latest/yaml.html), and [installing OWL ontologies](https://simphony.readthedocs.io/en/latest/owl.html)."
91+
"The first step is to install the city ontology. Use the tool pico for this. If you want to know more about ontology installation, check the documentation on the [pico ontology installation tool](https://simphony.readthedocs.io/en/latest/utils.html#pico-installs-cuds-ontologies), [YAML ontology installation files](https://simphony.readthedocs.io/en/latest/working_with_ontologies.html#osp-core-yaml-ontology-format), and [installing OWL ontologies](https://simphony.readthedocs.io/en/latest/working_with_ontologies.html#owl-ontologies-and-rdfs-vocabularies)."
9292
]
9393
},
9494
{

docs/source/jupyter/ontology_interface.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
"source": [
2929
"In an ontological framework, ontology entities are used as a knowledge representation form. Those can be further categorized in two groups: ontology individuals ([assertional knowledge](https://en.wikipedia.org/wiki/Abox)), and ontology classes, relationships and attributes ([terminological knowledge](https://en.wikipedia.org/wiki/Tbox)).\n",
3030
"\n",
31-
"In a [previous tutorial](./cuds_api.html), we have discussed how to work with CUDS objects, which represent ontology individuals. In this tutorial, we present the API of all the other entities instead: ontology classes, relationships and attributes. These are defined in an ontology installation file in [YAML](../yaml.md) or [OWL](../owl.md) format. The presented API enables you to access the entities and navigate within an ontology."
31+
"In a [previous tutorial](./cuds_api.html), we have discussed how to work with CUDS objects, which represent ontology individuals. In this tutorial, we present the API of all the other entities instead: ontology classes, relationships and attributes. These are defined in an ontology installation file in [YAML](../working_with_ontologies.md#osp-core-yaml-ontology-format) or [OWL](../working_with_ontologies.md#owl-ontologies-and-rdfs-vocabularies) format. The presented API enables you to access the entities and navigate within an ontology."
3232
],
3333
"metadata": {}
3434
},
@@ -195,7 +195,7 @@
195195
"source": [
196196
"The **most convenient way** to access an ontology entity is using the **dot notation** in python. For example, `city.Citizen`. This method is a shorthand for fetching by suffix or label: \n",
197197
"\n",
198-
"- When the keyword `reference_by_label` is set to `True` (enabled) in the [ontology YAML installation file](../owl.md), the dot notation is a shorthand for fetching by label. This keyword is **enabled** in the `math` namespace.\n",
198+
"- When the keyword `reference_by_label` is set to `True` (enabled) in the [ontology YAML installation file](../working_with_ontologies.md), the dot notation is a shorthand for fetching by label. This keyword is **enabled** in the `math` namespace.\n",
199199
"\n",
200200
"- When the keyword `reference_by_label` is set to `False` (disabled) or not set, the dot notation is a shorthand for fetching by suffix instead. This keyword is **disabled** in the `city` namespace."
201201
],

0 commit comments

Comments
 (0)