-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into regression-tests
- Loading branch information
Showing
28 changed files
with
217 additions
and
185 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
--- | ||
MD013: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
<!-- markdownlint-disable MD033 MD041 --> | ||
<div style="text-align: center;" align="center"> | ||
<img src="https://raw.githubusercontent.com/UCL-ARC/python-tooling/main/images/logo.svg" alt="UCL ARC Python tooling logo" width="120"/> | ||
<h1> UCL ARC Python Recommendations</h1> | ||
</div> | ||
<!-- markdownlint-restore --> | ||
|
||
This repository collects the [UCL ARC] recommendations for a research software | ||
project in Python. It contains a template for new Python packages and a | ||
|
@@ -73,80 +75,86 @@ We also have a detailed [tutorial](tutorial.md) that has been given in a couple | |
The tutorial goes into much more pedagogical detail, it both describes using the template to create a package | ||
and how to use the newly created package with some of the tools included. | ||
|
||
1. Install [cookiecutter] in a Conda or `venv` environment (commented lines for | ||
Conda example). | ||
|
||
``` | ||
# conda create --channel conda-forge --name new-env-name | ||
# conda activate new-env-name | ||
# conda install pip | ||
pip install cookiecutter | ||
``` | ||
|
||
2. Run cookiecutter in the desired directory | ||
``` | ||
cookiecutter gh:ucl-arc/python-tooling | ||
``` | ||
If you have this repo locally (this may be the case if you are developing), | ||
you can run the following: | ||
``` | ||
cookiecutter /path/to/your/checkout/of/python-tooling | ||
``` | ||
3. A series of questions will pop up to configure the project. Type the answer | ||
or hit return to use the default option (shown in parenthesis). | ||
|
||
Note that these project variables are defined in the `cookiecutter.json` | ||
file. | ||
|
||
4. This will create a specific directory structure. | ||
|
||
For example, for a project with the following variables: | ||
|
||
``` | ||
project_name [Python Template]: PROJECT_NAME | ||
project_slug [python-template]: PROJECT_SLUG | ||
package_name [python_template]: PACKAGE_NAME | ||
``` | ||
|
||
we will get a project folder named `PROJECT_SLUG`, structured like this: | ||
|
||
``` | ||
PROJECT_SLUG | ||
├── ... | ||
├── README.md | ||
├── pyproject.toml | ||
├── src | ||
│ └── PACKAGE_NAME | ||
│ └── __init__.py | ||
└── tests | ||
└── test_dummy.py | ||
``` | ||
|
||
And the `PROJECT_NAME` will appear in the README.md as the human-readable | ||
name of the project. | ||
|
||
``` | ||
cat PROJECT_SLUG/README.md | ||
# PROJECT_NAME | ||
... | ||
``` | ||
|
||
5. To work on your project, initialise a Git repository and _install_ it in | ||
editable mode. | ||
``` | ||
cd PROJECT_SLUG | ||
git init | ||
python -m pip install -e ".[dev]" | ||
``` | ||
6. Build your package | ||
``` | ||
python -m build | ||
``` | ||
1. Install [cookiecutter] in a Conda or `venv` environment (commented lines for | ||
Conda example). | ||
|
||
```sh | ||
# conda create --channel conda-forge --name new-env-name | ||
# conda activate new-env-name | ||
# conda install pip | ||
pip install cookiecutter | ||
``` | ||
|
||
2. Run cookiecutter in the desired directory | ||
|
||
```sh | ||
cookiecutter gh:ucl-arc/python-tooling | ||
``` | ||
|
||
If you have this repo locally (this may be the case if you are developing), | ||
you can run the following: | ||
|
||
```sh | ||
cookiecutter /path/to/your/checkout/of/python-tooling | ||
``` | ||
|
||
3. A series of questions will pop up to configure the project. Type the answer | ||
or hit return to use the default option (shown in parenthesis). | ||
|
||
Note that these project variables are defined in the `cookiecutter.json` | ||
file. | ||
|
||
4. This will create a specific directory structure. | ||
|
||
For example, for a project with the following variables: | ||
|
||
```yaml | ||
project_name [Python Template]: PROJECT_NAME | ||
project_slug [python-template]: PROJECT_SLUG | ||
package_name [python_template]: PACKAGE_NAME | ||
``` | ||
|
||
we will get a project folder named `PROJECT_SLUG`, structured like this: | ||
|
||
```sh | ||
PROJECT_SLUG | ||
├── ... | ||
├── README.md | ||
├── pyproject.toml | ||
├── src | ||
│ └── PACKAGE_NAME | ||
│ └── __init__.py | ||
└── tests | ||
└── test_dummy.py | ||
``` | ||
|
||
And the `PROJECT_NAME` will appear in the README.md as the human-readable | ||
name of the project. | ||
|
||
```sh | ||
cat PROJECT_SLUG/README.md | ||
# PROJECT_NAME | ||
... | ||
``` | ||
|
||
5. To work on your project, initialise a Git repository and _install_ it in | ||
editable mode. | ||
|
||
```sh | ||
cd PROJECT_SLUG | ||
git init | ||
python -m pip install -e ".[dev]" | ||
``` | ||
|
||
6. Build your package | ||
|
||
```sh | ||
python -m build | ||
``` | ||
|
||
## Notes for developers | ||
|
||
<details> | ||
<summary>Click to expand...</summary> | ||
<details><summary>Click to expand...</summary> <!-- markdownlint-disable-line MD033 --> | ||
|
||
First, clone repository | ||
|
||
|
@@ -157,7 +165,7 @@ First, clone repository | |
- Clone the repository by typing (or copying) the following line in a terminal | ||
at your selected path in your machine: | ||
|
||
``` | ||
```sh | ||
git clone [email protected]:UCL-ARC/python-tooling.git | ||
cd python-tooling | ||
``` | ||
|
@@ -166,7 +174,7 @@ cd python-tooling | |
|
||
- To create and remove your virtual environment | ||
|
||
``` | ||
```sh | ||
conda create -n ptoolingVE pip -c conda-forge | ||
conda activate ptoolingVE | ||
conda deactivate ptoolingVE | ||
|
@@ -176,7 +184,7 @@ cd python-tooling | |
- To run template in the same path of this repo. We do a test cookiecut of a | ||
dummy package and install it to ensure the template setup works. | ||
|
||
``` | ||
```sh | ||
cookiecutter . | ||
cd python-template | ||
git init | ||
|
@@ -185,13 +193,13 @@ cd python-tooling | |
|
||
- To run cookiecutter using a specific branch of the template: | ||
|
||
``` | ||
```sh | ||
cookiecutter https://github.com/UCL-ARC/python-tooling --checkout <branch-name> | ||
``` | ||
|
||
- To run the tests locally: | ||
|
||
``` | ||
```sh | ||
pytest -s | ||
``` | ||
|
||
|
@@ -203,13 +211,13 @@ sub-directory, and are written in markdown. | |
|
||
To build the webpage locally (for testing) | ||
|
||
1. [Install jekyll](https://jekyllrb.com/docs/installation) | ||
2. Run `bundle install` from the `docs/` directory of this repository to | ||
install dependencies. | ||
3. Run `bundle exec jekyll serve` from the root directory of this repository. | ||
This should fire up a local web server and tell you its address. By default | ||
the server will automatically refresh the HTML pages if any changes are made | ||
to the markdown sources. | ||
1. [Install jekyll](https://jekyllrb.com/docs/installation) | ||
2. Run `bundle install` from the `docs/` directory of this repository to | ||
install dependencies. | ||
3. Run `bundle exec jekyll serve` from the root directory of this repository. | ||
This should fire up a local web server and tell you its address. By default | ||
the server will automatically refresh the HTML pages if any changes are made | ||
to the markdown sources. | ||
|
||
See the [jekyll docs](https://jekyllrb.com/docs) for more info. | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.