Skip to content

Commit

Permalink
Added ts-workflow examples to the template.
Browse files Browse the repository at this point in the history
  • Loading branch information
kumaranu committed Jul 4, 2024
1 parent 86fb3be commit ae0614a
Show file tree
Hide file tree
Showing 20 changed files with 42 additions and 42 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
uv pip install --system -r tests/requirements.txt .[dev]
- name: Run tests with pytest
run: pytest --cov=template --cov-report=xml
run: pytest --cov=ts-workflow examples --cov-report=xml

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
Expand Down
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1 +1 @@
graft src/template
graft src/ts-workflow examples
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# template
# ts-workflow examples

A simple-to-use resource for creating open-source Python packages.
4 changes: 2 additions & 2 deletions docs/example_docs/code/hints.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Overview

In the sample functions provided with the template repository, you will see something like:
In the sample functions provided with the ts-workflow examples repository, you will see something like:

```
def make_array(val: float, length: int = 3) -> NDArray:
Expand All @@ -12,7 +12,7 @@ If you aren't familiar with [type-hinting](https://docs.python.org/3/library/typ

!!! Tip

If you have to import a given function solely for type-hinting purposes, you should put it within an [`if TYPE_CHECKING` block](https://docs.python.org/3/library/typing.html#typing.TYPE_CHECKING) (as demonstrated in `/src/template/examples/sample.py`). It will then only be imported when using a type-checking utility, reducing the overall import time of your module.
If you have to import a given function solely for type-hinting purposes, you should put it within an [`if TYPE_CHECKING` block](https://docs.python.org/3/library/typing.html#typing.TYPE_CHECKING) (as demonstrated in `/src/ts-workflow examples/examples/sample.py`). It will then only be imported when using a type-checking utility, reducing the overall import time of your module.

!!! Note

Expand Down
2 changes: 1 addition & 1 deletion docs/example_docs/code/source.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ All the code in the `src` directory can be imported now that you have installed

!!! Tip

As an example, you can import and use the demonstration [template.examples.sample][] functions as follows:
As an example, you can import and use the demonstration [ts-workflow examples.examples.sample][] functions as follows:

```python
from MyPackageName.examples.sample import add, make_array
Expand Down
2 changes: 1 addition & 1 deletion docs/example_docs/installation/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ Here, the `-e` means editable mode, the `.` means the current directory, and the

You should generally start from a clean Python environment, such as a new Conda environment if you are using Anaconda or one of its variants.

To make sure you installed your package successfully, open a Python console and run `import <MyPackageName>`. It should return without any errors. If there are errors, it's likely because you forgot to replace a "template" placeholder with the name of your package.
To make sure you installed your package successfully, open a Python console and run `import <MyPackageName>`. It should return without any errors. If there are errors, it's likely because you forgot to replace a "ts-workflow examples" placeholder with the name of your package.
4 changes: 2 additions & 2 deletions docs/example_docs/installation/pyproject.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ The `pyproject.toml` file contains all of the necessary information on how Pytho

## Metadata

There are several metadata-related fields that you will likely want to update. You should have already updated the `name` of the package in a prior step when you replaced "template" everywhere, but you will also want to change the following:
There are several metadata-related fields that you will likely want to update. You should have already updated the `name` of the package in a prior step when you replaced "ts-workflow examples" everywhere, but you will also want to change the following:

- `description`
- `license` (if you changed the default `LICENSE.md` file)
Expand All @@ -17,7 +17,7 @@ Aside from the `name`, none of the above are strictly necessary and can be left

The most important fields to update are related to the dependencies: the Python packages that your own code relies on. This will ensure that they are automatically installed when installing your Python package.

The required dependencies are listed under the `[project]` header in the `dependencies` field. By default, the template repository lists `["numpy"]`. Include any dependencies you want in this list, separated by commas. This should be all the packages you import in your code that are not standard Python libraries.
The required dependencies are listed under the `[project]` header in the `dependencies` field. By default, the ts-workflow examples repository lists `["numpy"]`. Include any dependencies you want in this list, separated by commas. This should be all the packages you import in your code that are not standard Python libraries.

!!! Tip

Expand Down
8 changes: 4 additions & 4 deletions docs/example_docs/intro/why.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Purpose

The first question to address is: why? Why use a template repository like this? Why make a Python package at all, as opposed to writing custom scripts or Jupyter Notebooks?
The first question to address is: why? Why use a ts-workflow examples repository like this? Why make a Python package at all, as opposed to writing custom scripts or Jupyter Notebooks?

The answer, in short, is _sustainable and reproducible_ software development. Here are some of the benefits:

Expand All @@ -15,12 +15,12 @@ Of course, there are many more reasons, but hopefully that's convincing enough!

## Alternatives

This is by no means the only template of its kind. Some alternatives include:
This is by no means the only ts-workflow examples of its kind. Some alternatives include:

- [cookiecutter](https://github.com/cookiecutter/cookiecutter)
- [pyscaffold](https://github.com/pyscaffold/pyscaffold)
- [python-package-template](https://github.com/microsoft/python-package-template)
- [python-package-ts-workflow examples](https://github.com/microsoft/python-package-ts-workflow examples)

... and many more.

Feel free to use them if you wish! This template repository exists because we are all opinionated people, and this template focuses on things that I value most. But the point is to just use something that works well for you.
Feel free to use them if you wish! This ts-workflow examples repository exists because we are all opinionated people, and this ts-workflow examples focuses on things that I value most. But the point is to just use something that works well for you.
2 changes: 1 addition & 1 deletion docs/example_docs/mkdocs/docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Now it's time to write some documentation! This isn't very difficult, and of cou

Check out the [Markdown Guide](https://www.markdownguide.org/basic-syntax/) for an overview of the basic syntax.

This template repository uses a documentation format called mkdocs, specifically a useful theme called [Material for Mkdocs](https://squidfunk.github.io/mkdocs-material/). This enables many wonderful goodies like the "tip" callout you see above and much more.
This ts-workflow examples repository uses a documentation format called mkdocs, specifically a useful theme called [Material for Mkdocs](https://squidfunk.github.io/mkdocs-material/). This enables many wonderful goodies like the "tip" callout you see above and much more.

## Adding Markdown Files

Expand Down
6 changes: 3 additions & 3 deletions docs/example_docs/setup/basics.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
# Initial Changes

At this point, you now have your template repository on GitHub and locally on your machine. Now it's time to start making some modifications.
At this point, you now have your ts-workflow examples repository on GitHub and locally on your machine. Now it's time to start making some modifications.

### README

The first thing to do is update the README (`/README.md`), which should contain a user-friendly summary of what your package is all about. This can be whatever you want. Feel free to be creative!

### License

The template repository comes premade with a sample license (`/LICENSE.md`), in this case the very popular and permissive [BSD 3-Clause license](https://opensource.org/license/bsd-3-clause/). Feel free to change this for your own project or keep it as-is if you don't quite know yet.
The ts-workflow examples repository comes premade with a sample license (`/LICENSE.md`), in this case the very popular and permissive [BSD 3-Clause license](https://opensource.org/license/bsd-3-clause/). Feel free to change this for your own project or keep it as-is if you don't quite know yet.

!!! Tip

There are *many* licenses that one can consider. A comprehensive list can be found on the [Open Source Initiative](https://opensource.org/licenses/?categories=popular-strong-community) website, but a less overwhelming route is to use [choosealicense.com](https://choosealicense.com/).

### Code of Conduct

The template repository ships with a premade Code of Conduct (`/CODE_OF_CONDUCT.md`) that is obtained from the [Contributor Covenant](https://www.contributor-covenant.org/). Of course, you can feel free to keep or change this as you see fit, but it is often a good idea to have a code of conduct for public repositories.
The ts-workflow examples repository ships with a premade Code of Conduct (`/CODE_OF_CONDUCT.md`) that is obtained from the [Contributor Covenant](https://www.contributor-covenant.org/). Of course, you can feel free to keep or change this as you see fit, but it is often a good idea to have a code of conduct for public repositories.
6 changes: 3 additions & 3 deletions docs/example_docs/setup/name.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# Updating the Name

Now for your first major task: **replace all instances of the word "template" with your desired package name**.
Now for your first major task: **replace all instances of the word "ts-workflow examples" with your desired package name**.

!!! Note

Don't forget to update the name of the `/src/template` folder, e.g. so that it is of the form `src/<MyPackageName>`.
Don't forget to update the name of the `/src/ts-workflow examples` folder, e.g. so that it is of the form `src/<MyPackageName>`.

!!! Tip

If you're using [Visual Studio Code](https://code.visualstudio.com/) as your editor, you can do `ctrl+shift+H` to find-and-replace all instances of "template" with your own package name.
If you're using [Visual Studio Code](https://code.visualstudio.com/) as your editor, you can do `ctrl+shift+H` to find-and-replace all instances of "ts-workflow examples" with your own package name.

![](../media/find_replace.png)
2 changes: 1 addition & 1 deletion docs/example_docs/setup/prep.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ So, you have an idea for your own Python package. The first thing you'll need to

## Making a Repository

With a nice name in mind, [create a new repository](https://github.com/new?template_name=template&template_owner=Quantum-Accelerators) using this template. Give it a name, a description, and decide if you want it to be public or private.
With a nice name in mind, [create a new repository](https://github.com/new?ts-workflow examples_name=ts-workflow examples&ts-workflow examples_owner=Quantum-Accelerators) using this ts-workflow examples. Give it a name, a description, and decide if you want it to be public or private.

![](../media/create_a_repo.png)

Expand Down
4 changes: 2 additions & 2 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# template
# ts-workflow examples

Welcome to the documentation for the `template` code! Here you will find everything you need to get started with your own Python package.
Welcome to the documentation for the `ts-workflow examples` code! Here you will find everything you need to get started with your own Python package.

**Check out the corresponding ⭐[YouTube tutorial](https://www.youtube.com/watch?v=th2CqJ6oBuM)⭐ for a video overview!**
6 changes: 3 additions & 3 deletions mkdocs.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
site_name: template
site_name: ts-workflow examples
site_author: YourName
site_description: >-
This is the template package!
This is the ts-workflow examples package!
nav:
- Home: index.md
- Overview:
Expand Down Expand Up @@ -33,7 +33,7 @@ nav:
- example_docs/about/conduct.md
- example_docs/about/license.md

repo_url: https://github.com/Quantum-Accelerators/template/
repo_url: https://github.com/Quantum-Accelerators/ts-workflow examples/
edit_uri: blob/main/docs/

theme:
Expand Down
14 changes: 7 additions & 7 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ requires = ["setuptools"]
build-backend = "setuptools.build_meta"

[project]
name = "template"
name = "ts-workflow examples"
description="A Python package description goes here."
version = "0.0.1"
readme = "README.md"
Expand Down Expand Up @@ -39,15 +39,15 @@ docs = [
]

[project.urls]
repository = "https://github.com/Quantum-Accelerators/template"
documentation = "https://quantum-accelerators.github.io/template/"
changelog = "https://github.com/Quantum-Accelerators/template/blob/main/CHANGELOG.md"
repository = "https://github.com/Quantum-Accelerators/ts-workflow examples"
documentation = "https://quantum-accelerators.github.io/ts-workflow examples/"
changelog = "https://github.com/Quantum-Accelerators/ts-workflow examples/blob/main/CHANGELOG.md"

[tool.setuptools.package-data]
template = ["py.typed"]
ts-workflow examples = ["py.typed"]

[tool.pyright]
include = ["template"]
include = ["ts-workflow examples"]
exclude = ["**/__pycache__"]

[tool.pytest.ini_options]
Expand Down Expand Up @@ -137,7 +137,7 @@ lint.unfixable = [
"F841", # Removes unused variables
]
lint.pydocstyle.convention = "numpy"
lint.isort.known-first-party = ["template"]
lint.isort.known-first-party = ["ts-workflow examples"]
lint.isort.required-imports = ["from __future__ import annotations"]
extend-include = ["*.ipynb"]

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
"""Init data"""

from __future__ import annotations

from importlib.metadata import version

# Load the version
__version__ = version("template")
"""Init data"""

from __future__ import annotations

from importlib.metadata import version

# Load the version
__version__ = version("ts-workflow examples")
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion tests/examples/test_sample.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import pytest
from numpy.testing import assert_allclose, assert_array_equal

from template.examples.sample import add, divide, make_array
from ts-workflow examples.examples.sample import add, divide, make_array


def test_add():
Expand Down

0 comments on commit ae0614a

Please sign in to comment.