Skip to content

Commit

Permalink
♻️ refactor(copier): added a template folder and extra questions for …
Browse files Browse the repository at this point in the history
…optional tools
  • Loading branch information
jzazo committed May 10, 2024
1 parent 35dd92a commit 2ffcc5e
Show file tree
Hide file tree
Showing 73 changed files with 947 additions and 303 deletions.
2 changes: 1 addition & 1 deletion .apidoc_conf.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# -- Project information -----------------------------------------------------
project = "{{project_name}}"
project = "cookie-doh"
copyright = "microsoft"
author = "microsoft research"

Expand Down
1 change: 0 additions & 1 deletion .apidoc_conf.py.jinja

This file was deleted.

2 changes: 1 addition & 1 deletion .azure-pipelines/cg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ trigger: [main]
pr: [main]
schedules:
- cron: "0 0 * * 1"
displayName: "Weekly: {{project_name}}"
displayName: "Weekly: cookie-doh"
branches:
include:
- main
Expand Down
1 change: 0 additions & 1 deletion .azure-pipelines/cg.yml.jinja

This file was deleted.

19 changes: 19 additions & 0 deletions .azure-pipelines/cg.yml.jinja
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
trigger: [main]
pr: [main]
schedules:
- cron: "0 0 * * 1"
displayName: "Weekly: {{project_name}}"
branches:
include:
- main
pool:
vmImage: ubuntu-latest
variables:
EnableDetectorPoetry: true
steps:
- task: ComponentGovernanceComponentDetection@0
inputs:
showAlertLink: true
failOnAlert: true
failOnStderr: true
logLevel: debug
2 changes: 1 addition & 1 deletion .coveragerc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[run]
branch = True
data_file = .tmp/.coverage
source = src/python/{{module_name}}
source = src
relative_files = true

[report]
Expand Down
1 change: 0 additions & 1 deletion .coveragerc.jinja

This file was deleted.

2 changes: 1 addition & 1 deletion .devcontainer/on-create.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ echo 'eval "$(direnv hook zsh)"' >> ~/.zshrc
echo 'eval "$(direnv hook bash)"' >> ~/.bashrc
eval "$(direnv hook bash)"
mkdir -p ~/.config/direnv/
cp /workspaces/{{project_name}}/.devcontainer/direnvrc ~/.config/direnv/direnvrc
cp /workspaces/cookie-doh/.devcontainer/direnvrc ~/.config/direnv/direnvrc

echo "UPDATE PIP"
pip install --upgrade pip
Expand Down
1 change: 0 additions & 1 deletion .devcontainer/on-create.sh.jinja

This file was deleted.

33 changes: 33 additions & 0 deletions .devcontainer/on-create.sh.jinja
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#! /bin/bash
# this runs ONCE at devcontainer creation time, and it runs during pre-build phase which
# means it does not have access to user context
# ===========================

# finish config of direnv settings (would be nice to improve the devcontainer "feature")
echo "CONFIGURING DIRENV..."
echo 'eval "$(direnv hook zsh)"' >> ~/.zshrc
echo 'eval "$(direnv hook bash)"' >> ~/.bashrc
eval "$(direnv hook bash)"
mkdir -p ~/.config/direnv/
cp /workspaces/{{ project_name }}/.devcontainer/direnvrc ~/.config/direnv/direnvrc

echo "UPDATE PIP"
pip install --upgrade pip

{% if commitizen -%}
echo "INSTALLING COMMITIZEN"
pipx install commitizen
pipx inject commitizen cz-conventional-gitmoji
echo 'eval "$(register-python-argcomplete cz)"' >> ~/.zshrc
echo 'eval "$(register-python-argcomplete cz)"' >> ~/.bashrc
{%- endif %}

echo "POETRY INSTALL"
poetry config virtualenvs.in-project true
direnv allow .
poetry install

{% if precommit -%}
echo "CONFIGURING PRE-COMMIT"
pre-commit install --install-hooks
{%- endif %}
2 changes: 1 addition & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
**/.vscode
**/*.pyc

**/src/python/*.egg-info
**/src/*.egg-info
**/build/
**/dist

Expand Down
5 changes: 1 addition & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,8 @@

# ignore personal workspace files
**/*.code-workspace
!{{project_name}}.code-workspace
{% if false %} # template files are excluded from copied repos
!cookie-doh.code-workspace
!cookie-doh.code-workspace.jinja
{% endif %}

**/.vscode/*
!**/.vscode/launch.json
!**/.vscode/settings.json
Expand Down
1 change: 0 additions & 1 deletion .gitignore.jinja

This file was deleted.

132 changes: 12 additions & 120 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,31 +5,24 @@
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

{{project_name}} info
Cookie-doh info

<p align="center">
:point_right: Short-link: https://aka.ms/cookie-doh
</p>

-----------------------------------------------------------------


## :notebook_with_decorative_cover: Documentation
https://{{organization}}.github.io/{{project_name}}
https://microsoft.github.io/cookie-doh


<!-----------------------[ Getting Started ]--------------<recommended> section below------------------>
## :rocket: Getting Started

<!--
INSTRUCTIONS:
- Write instructions such that any new user can get the project up & running on their machine.
- This section has subsections described further down of "Prerequisites", "Installing", and "Deployment".
## :octocat: Source Code
https://microsoft.github.io/cookie-doh

How to Evaluate & Examples:
- https://aka.ms/StartRight/README-Template/Instructions#getting-started
-->

<!---- [TODO] CONTENT GOES BELOW ------->
*Description of how to install and use the code or content goes here*
<!------====-- CONTENT GOES ABOVE ------->
## :rocket: Getting Started


### Optional system dependencies
Expand All @@ -39,9 +32,13 @@ We use the following optional dependencies for development:
* [direnv](https://direnv.net/): To manage environment variables and load python virtual environments automatically.
* [pyenv](https://github.com/pyenv/pyenv): To manage python versions.
* [pipx](https://pipxproject.github.io/pipx/): To install python packages in isolated environments.
{% if commitizen -%}
* [commitizen](https://commitizen-tools.github.io/commitizen/): To help with [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/).
* [cz-conventional-gitmoji](https://github.com/ljnsn/cz-conventional-gitmoji): A commitizen plugin that combines gitmoji and conventional commits.
{%- endif %}
{% if precommit -%}
* [pre-commit](https://pre-commit.com/): To run code formatting and linting before committing.
{%- endif %}

### Required system dependencies

Expand Down Expand Up @@ -73,111 +70,9 @@ Learn about [GitHub Codespaces](https://docs.github.com/en/codespaces) and/or [D

[![Open in DevPod!](https://devpod.sh/assets/open-in-devpod.svg)](https://devpod.sh/open#https://github.com/{{organization}}/{{project_name}})

<!------====-- CONTENT GOES ABOVE ------->


<!-----------------------[ Installing ]-------------------<optional> section below------------------>
### Installing

<!--
INSTRUCTIONS:
- A step by step series of examples that tell you how to get a development environment and your code running.
- Best practice is to include examples that can be copy and pasted directly from the README into a terminal.
How to Evaluate & Examples:
- https://aka.ms/StartRight/README-Template/Instructions#installing
<!---- [TODO] CONTENT GOES BELOW ------->
This repository does not hold installable content.
<!------====-- CONTENT GOES ABOVE ------->


<!-----------------------[ Tests ]------------------------<optional> section below--------------------->
<!--
## Tests
-->

<!--
INSTRUCTIONS:
- Explain how to run the tests for this project. You may want to link here from Deployment (CI/CD) or Contributing sections.
How to Evaluate & Examples:
- https://aka.ms/StartRight/README-Template/Instructions#tests
-->

<!---- [TODO] CONTENT GOES BELOW ------->
<!--
*Explain what these tests test and why*
```
Give an example
```
-->
<!------====-- CONTENT GOES ABOVE ------->


<!-----------------------[ Deployment (CI/CD) ]-----------<optional> section below--------------------->
### Deployment (CI/CD)

<!--
INSTRUCTIONS:
- Describe how to deploy if applicable. Deployment includes website deployment, packages, or artifacts.
- Avoid potential new contributor frustrations by making it easy to know about all compliance and continuous integration
that will be run before pull request approval.
- NOTE: Setting up an Azure DevOps pipeline gets you all 1ES compliance and build tooling such as component governance.
- More info: https://aka.ms/StartRight/README-Template/integrate-ado
How to Evaluate & Examples:
- https://aka.ms/StartRight/README-Template/Instructions#deployment-and-continuous-integration
-->

<!---- [TODO] CONTENT GOES BELOW ------->
_At this time, the repository does not use continuous integration or produce a website, artifact, or anything deployed._
<!------====-- CONTENT GOES ABOVE ------->


<!-----------------------[ Versioning and Changelog ]-----<optional> section below--------------------->

<!-- ### Versioning and Changelog -->

<!--
INSTRUCTIONS:
- If there is any information on a changelog, history, versioning style, roadmap or any related content tied to the
history and/or future of your project, this is a section for it.
How to Evaluate & Examples:
- https://aka.ms/StartRight/README-Template/Instructions#versioning-and-changelog
-->

<!---- [TODO] CONTENT GOES BELOW ------->
<!-- We use [SemVer](https://aka.ms/StartRight/README-Template/semver) for versioning. -->
<!------====-- CONTENT GOES ABOVE ------->

--------------------------------------------


## :memo: Guide to using GitHub inside Microsoft

You can find information on using GitHub inside Microsoft at [aka.ms/gim](https://aka.ms/gim).

<details>
<summary>Expand for links to common tasks</summary>

- [Switching between EMU GitHub and normal GitHub without logging out and back in constantly](https://aka.ms/StartRight/README-Template/maintainingMultipleAccount)
- [Creating a repository](https://aka.ms/StartRight)
- [Changing repository visibility](https://aka.ms/StartRight/README-Template/policies/jit)
- [Gaining repository permissions, access, and roles](https://aka.ms/StartRight/README-TEmplates/gim/policies/access)
- [Enabling easy access to your low sensitivity and widely applicable repository by setting it to Internal Visibility and having any FTE who wants to see it join the 1ES Enterprise Visibility MyAccess Group](https://aka.ms/StartRight/README-Template/gim/innersource-access)
- [Migrating repositories](https://aka.ms/StartRight/README-Template/troubleshoot/migration)
- [Setting branch protection](https://aka.ms/StartRight/README-Template/gim/policies/branch-protection)
- [Setting up GitHubActions](https://aka.ms/StartRight/README-Template/policies/actions)
- [and other actions](https://aka.ms/StartRight/README-Template/gim/policies)

</details>


## :mountain: Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a
Expand All @@ -200,6 +95,3 @@ trademarks or logos is subject to and must follow
[Microsoft's Trademark & Brand Guidelines](https://www.microsoft.com/en-us/legal/intellectualproperty/trademarks/usage/general).
Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship.
Any use of third-party trademarks or logos are subject to those third-party's policies.


<!-- version: 2023-04-07 [Do not delete this line, it is used for analytics that drive template improvements] -->
1 change: 0 additions & 1 deletion README.md.jinja

This file was deleted.

48 changes: 23 additions & 25 deletions SUPPORT.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,23 @@
# TODO: The maintainer of this repo has not yet edited this file

**REPO OWNER**: Do you want Customer Service & Support (CSS) support for this product/project?

- **No CSS support:** Fill out this template with information about how to file issues and get help.
- **Yes CSS support:** Fill out an intake form at [aka.ms/onboardsupport](https://aka.ms/onboardsupport). CSS will work with/help you to determine next steps.
- **Not sure?** Fill out an intake as though the answer were "Yes". CSS will help you decide.

*Then remove this first heading from this SUPPORT.MD file before publishing your repo.*

# Support

## How to file issues and get help

This project uses GitHub Issues to track bugs and feature requests. Please search the existing
issues before filing new issues to avoid duplicates. For new issues, file your bug or
feature request as a new Issue.

For help and questions about using this project, please **REPO MAINTAINER: INSERT INSTRUCTIONS HERE
FOR HOW TO ENGAGE REPO OWNERS OR COMMUNITY FOR HELP. COULD BE A STACK OVERFLOW TAG OR OTHER
CHANNEL. WHERE WILL YOU HELP PEOPLE?**.

## Microsoft Support Policy

Support for this **PROJECT or PRODUCT** is limited to the resources listed above.
# TODO: The maintainer of this repo has not yet edited this file

**REPO OWNER**: Do you want Customer Service & Support (CSS) support for this product/project?

- **No CSS support:** Fill out this template with information about how to file issues and get help.
- **Yes CSS support:** Fill out an intake form at [aka.ms/onboardsupport](https://aka.ms/onboardsupport). CSS will work with/help you to determine next steps.
- **Not sure?** Fill out an intake as though the answer were "Yes". CSS will help you decide.

*Then remove this first heading from this SUPPORT.MD file before publishing your repo.*

# Support

## How to file issues and get help

This project uses GitHub Issues to track bugs and feature requests. Please search the existing
issues before filing new issues to avoid duplicates. For new issues, file your bug or
feature request as a new Issue.

For help and questions about using this project, please use the "Discussions" tab in the repository.

## Microsoft Support Policy

Support for this **PROJECT or PRODUCT** is limited to the resources listed above.
2 changes: 1 addition & 1 deletion bin/docs-api
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ set -e
rm -rf dist/sphinx-apidoc
mkdir -p dist/sphinx-apidoc
cp .apidoc_conf.py dist/sphinx-apidoc/conf.py
poetry run sphinx-apidoc --doc-project="{{project_name}}" --tocfile=index --implicit-namespaces --module-first --output-dir=dist/sphinx-apidoc --templatedir=dist/sphinx-apidoc-templates "src/python/{{module_name}}"
poetry run sphinx-apidoc --doc-project="cookie-doh" --tocfile=index --implicit-namespaces --module-first --output-dir=dist/sphinx-apidoc --templatedir=dist/sphinx-apidoc-templates "src/cookie"

rm -rf dist/sphinx-markdown docs/api
poetry run sphinx-build -M markdown dist/sphinx-apidoc dist/sphinx-markdown
Expand Down
1 change: 0 additions & 1 deletion bin/docs-api.jinja

This file was deleted.

4 changes: 2 additions & 2 deletions cookie-doh.code-workspace
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@
"python.analysis.typeCheckingMode": "basic",
"python.analysis.autoImportCompletions": true,
"python.analysis.extraPaths": [
"${workspaceFolder}/src/python"
"${workspaceFolder}/src"
],
"python.autoComplete.extraPaths": [
"${workspaceFolder}/src/python"
"${workspaceFolder}/src"
],
"python.analysis.inlayHints.pytestParameters": true,
"python.defaultInterpreterPath": ".venv/bin/python",
Expand Down
Loading

0 comments on commit 2ffcc5e

Please sign in to comment.