Skip to content

Commit

Permalink
First commit with mep_tests replacements in the template
Browse files Browse the repository at this point in the history
  • Loading branch information
kumaranu committed Mar 11, 2024
1 parent 48aee6a commit 871845b
Show file tree
Hide file tree
Showing 20 changed files with 35 additions and 35 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
pip install .[dev]
- name: Run tests with pytest
run: pytest --cov=template --cov-report=xml
run: pytest --cov=mep_tests --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/mep_tests
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# template
# mep_tests

A simple-to-use resource for generating 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 mep_tests 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/mep_tests/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 [mep_tests.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 "mep_tests" 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 "mep_tests" 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 mep_tests 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 mep_tests 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 mep_tests 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-mep_tests](https://github.com/microsoft/python-package-mep_tests)

... 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 mep_tests repository exists because we are all opinionated people, and this mep_tests 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 mep_tests 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 mep_tests 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 mep_tests 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 mep_tests 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 "mep_tests" 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/mep_tests` 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 "mep_tests" 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?mep_tests_name=mep_tests&mep_tests_owner=Quantum-Accelerators) using this mep_tests. 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
# mep_tests

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 `mep_tests` 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: mep_tests
site_author: YourName
site_description: >-
This is the template package!
This is the mep_tests 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/mep_tests/
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 = "mep_tests"
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/mep_tests"
documentation = "https://quantum-accelerators.github.io/mep_tests/"
changelog = "https://github.com/Quantum-Accelerators/mep_tests/blob/main/CHANGELOG.md"

[tool.setuptools.package-data]
template = ["py.typed"]
mep_tests = ["py.typed"]

[tool.pyright]
include = ["template"]
include = ["mep_tests"]
exclude = ["**/__pycache__"]

[tool.pytest.ini_options]
Expand Down Expand Up @@ -125,7 +125,7 @@ lint.unfixable = [
lint.flake8-unused-arguments.ignore-variadic-names = true
lint.pydocstyle.convention = "numpy"
lint.isort.required-imports = ["from __future__ import annotations"]
lint.isort.known-first-party = ["template"]
lint.isort.known-first-party = ["mep_tests"]
src = ["src"]
exclude = []
extend-exclude = ["tests"]
Expand Down
2 changes: 1 addition & 1 deletion src/template/__init__.py → src/mep_tests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
from importlib.metadata import version

# Load the version
__version__ = version("template")
__version__ = version("mep_tests")
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 @@ -2,7 +2,7 @@
import pytest
from numpy.testing import assert_allclose, assert_array_equal

from template.examples.sample import add, divide, make_array
from mep_tests.examples.sample import add, divide, make_array


def test_add():
Expand Down

0 comments on commit 871845b

Please sign in to comment.