Skip to content

Commit 910a87f

Browse files
authored
Update README (#66)
* Upgrade README * Include joke
1 parent 39303b9 commit 910a87f

File tree

1 file changed

+51
-13
lines changed

1 file changed

+51
-13
lines changed

README.md

+51-13
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ Inspired by [literate programming](http://literateprogramming.com), maintained b
3333
- **notebooks/**
3434
> Placeholder folder for [Jupyter notebooks](https://jupyter.org). Markdown files and Jupyter notebooks can be added to `docs/_toc.yml` (Table of Contents) to compose the *documentation*.
3535
36-
- **.pre-commit-config.yml**
36+
- [**.pre-commit-config.yml**](https://github.com/worldbank/template/blob/main/.pre-commit-config.yaml)
3737
> Using [pre-commit](https://pre-commit.com) offers a significant advantage in streamlining the development process by enforcing code standards and reducing errors before code reaches the review stage or is committed to the repository. It automates the execution of various checks, such as syntax errors, code formatting, and ensuring compliance with coding standards, which saves time and improves code quality.
3838
3939
- [GitHub Actions](https://github.com/features/actions) and [Dependabot](https://docs.github.com/en/code-security/dependabot)
@@ -170,9 +170,16 @@ The <span style="color:#3EACAD">template</span> is licensed under the [**Mozilla
170170

171171
> 🌟 `https://<your-github-username>.github.io/<your-project-name>`
172172
173-
For example, see this <span style="color:#3EACAD">template</span> as a live demo.
173+
````{note}
174+
For example, you can view [this live demo](http://worldbank.github.io/template) using the following link:
174175
175-
> 🌟 [worldbank.github.io/template](http://worldbank.github.io/template) (Live Demo)
176+
> 🌟 [Live Demo - worldbank.github.io/template](http://worldbank.github.io/template)
177+
178+
You can also install the latest version directly from the main branch:
179+
180+
```bash
181+
pip install git+https://github.com/worldbank/template
182+
````
176183

177184
### Add content
178185

@@ -234,18 +241,31 @@ By default, Jupyter notebooks are **not** executed. However, you can configure[J
234241
[Jupyter Book Write executable content](https://jupyterbook.org/en/stable/content/executable/index.html)
235242
```
236243

237-
### Use `pyproject.toml` for Python Package Management
244+
#### Distributing Your Project as a Python Package
245+
246+
If your project uses [Python](https://python.org), it’s highly recommended to distribute it as a [package](https://packaging.python.org/en/latest/tutorials/packaging-projects/). By including a `pyproject.toml` file, the packaging process becomes more streamlined - *trust me [things can get intense](https://imgs.xkcd.com/comics/python_environment.png)*.
247+
248+
Additionally:
249+
250+
```{tip}
251+
- Using `pyproject.toml` future-proofs your setup by aligning with modern packaging standards.
252+
- The `pyproject.toml` file acts as a single source of truth for your Python dependencies and project metadata.
253+
- You can combine Conda for system-level dependencies with `pyproject.toml` for Python dependencies, using Conda for environments and pip/poetry for Python packages.
254+
- Any packages in the `src/` folder will be automatically discovered and installed.
255+
```
256+
257+
##### Use `pyproject.toml` for Python Package Management
238258

239259
While the <span style="color:#3EACAD">template</span> recommends using [Conda](https://conda.io/projects/conda/en/latest/index.html) (or [Mamba](https://github.com/mamba-org/mamba)) as the environment manager and managing dependencies through an `environment.yml` file, there is an alternative approach that leverages `pyproject.toml`. This can be particularly advantageous if your project is a Python package or if you want to simplify and standardize the management of Python-specific dependencies.
240260

241-
#### Why use `pyproject.toml`?
261+
##### Why use `pyproject.toml`?
242262

243263
The next step is ensure your code is maintainable, reliable and reproducible by including
244264
any dependencies and requirements, such as packages, configurations, secrets (template) and additional instructions.
245265

246266
1. **Standardization**: `pyproject.toml` is a modern, standardized format defined by [PEP 518](https://peps.python.org/pep-0518/) and [PEP 621](https://peps.python.org/pep-0621/) that centralizes project configuration in Python projects, including build requirements and dependencies.
247267

248-
2. **Python Packaging**: If your project is to be distributed as a package, `pyproject.toml` is the preferred way to define build tools (like `setuptools` or `poetry`) and metadata for your package (like name, version, dependencies, etc.). It allows tools like `pip` and `build` to install and package your project more effectively.
268+
2. **Python Packaging**: If your project is to be distributed as a package, `pyproject.toml` is the preferred way to define build tools (like [hatch](https://hatch.pypa.io/latest/config/dependency/) or [poetry](https://python-poetry.org)) and metadata for your package (like name, version, dependencies, etc.). It allows tools like `pip` and `build` to install and package your project more effectively.
249269

250270
3. **Compatibility with Tools**: The `pyproject.toml` file is compatible with multiple Python packaging and dependency management tools such as `poetry` and `pip`. This allows for smoother integration with CI/CD pipelines, PyPI, and other environments.
251271

@@ -304,7 +324,7 @@ This `pyproject.toml` file specifies the dependencies and other metadata for you
304324
```
305325

306326
3. **Installation**:
307-
To create an environment, you would first install the Conda dependencies and then use `pip` to install Python-specific dependencies from `pyproject.toml`. Alternatively, you can skip Conda and use `pip` for the entire setup.
327+
To create an environment, you would first install the Conda dependencies and then use `pip` to install Python-specific dependencies from `pyproject.toml`. Alternatively, you can skip Conda and use `pip` for the entire setup.
308328

309329
```shell
310330
# Create Conda environment
@@ -317,20 +337,38 @@ This `pyproject.toml` file specifies the dependencies and other metadata for you
317337
pip install .
318338
```
319339

320-
#### Distributing Your Project as a Python Package
340+
To install a Python package directly from a [GitHub](https://github.com) repository using [pip](https://pip.pypa.io/en/stable/installation/), you can use the command pip install `git+https://github.com/<username>/<repository>.git`. This allows you to install the latest version of the package from the repository. You can also specify a particular branch or release tag by adding `@<branch_or_tag>` at the end of the URL This is particularly useful when you want to access features or fixes that haven’t been published on PyPI yet, or to get the latest updates from the repository.
321341

322-
If your project uses [Python](https://python.org), it’s highly recommended to distribute it as a [package](https://packaging.python.org/en/latest/tutorials/packaging-projects/). By including a `pyproject.toml` file, the packaging process becomes more streamlined. Additionally:
342+
If you want to install the latest release, you should specify the tag associated with that release. For instance:
323343

324-
- The `pyproject.toml` file acts as a single source of truth for your Python dependencies and project metadata.
325-
- Any packages in the `src/` folder will be automatically discovered and installed.
326-
- Using `pyproject.toml` future-proofs your setup by aligning with modern packaging standards.
327-
-You can combine Conda for system-level dependencies with `pyproject.toml` for Python dependencies, using Conda for environments and Pip/Poetry for Python packages.
344+
```shell
345+
pip install git+https://github.com/<username>/<repository>.git@<latest_release_tag>
346+
```
328347

329348
```{seealso}
349+
- [Packaging Python Projects](https://packaging.python.org/en/latest/tutorials/packaging-projects/)
330350
- [Writing your pyproject.toml](https://packaging.python.org/en/latest/guides/writing-pyproject-toml/)
331351
- [Conda Managing Environments](https://conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html)
332352
```
333353

354+
#### Building Documentation Locally
355+
356+
To build the documentation locally, please follow these steps:
357+
358+
- Install the package with documentation dependencies:
359+
360+
```shell
361+
pip install -e .[docs]
362+
```
363+
364+
- Build the documentation:
365+
366+
```shell
367+
jupyter-book build . --config docs/_config.yml --toc docs/_toc.yml
368+
```
369+
370+
The generated documentation will be available in the `_build/html` directory. Open the `index.html` file in a web browser to view it.
371+
334372
## Code of Conduct
335373

336374
The <span style="color:#3EACAD">template</span> maintains a [Code of Conduct](docs/CODE_OF_CONDUCT.md) to ensure an inclusive and respectful environment for everyone. Please adhere to it in all interactions within our community.

0 commit comments

Comments
 (0)