Skip to content

Commit

Permalink
✅ Ready to clone and code.
Browse files Browse the repository at this point in the history
  • Loading branch information
poing authored and github-actions[bot] committed Jan 10, 2024
1 parent 0a2019b commit 5f83797
Show file tree
Hide file tree
Showing 17 changed files with 55 additions and 56 deletions.
10 changes: 5 additions & 5 deletions .github/rename_project.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ echo "Description: $description";

echo "Renaming project..."

original_author="author_name"
original_name="project_name"
original_urlname="project_urlname"
original_description="project_description"
original_author="poing"
original_name="js2pysecrets"
original_urlname="JS2PySecrets"
original_description="Awesome js2pysecrets created by poing"
# for filename in $(find . -name "*.*")
for filename in $(git ls-files)
do
Expand All @@ -30,7 +30,7 @@ do
echo "Renamed $filename"
done

mv project_name $name
mv js2pysecrets $name

# This command runs only once on GHA!
rm -rf .github/template.yml
1 change: 0 additions & 1 deletion .github/template.yml

This file was deleted.

4 changes: 2 additions & 2 deletions ABOUT_THIS_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Lets take a look at the structure of this template:
├── Makefile # A collection of utilities to manage the project
├── MANIFEST.in # A list of files to include in a package
├── mkdocs.yml # Configuration for documentation site
├── project_name # The main python package for the project
├── js2pysecrets # The main python package for the project
│   ├── base.py # The base module for the project
│   ├── __init__.py # This tells Python that this is a package
│   ├── __main__.py # The entry point for the project
Expand Down Expand Up @@ -109,7 +109,7 @@ I had to do some tricks to read that version variable inside the setuptools
I decided to keep the version in a static file because it is easier to read from
wherever I want without the need to install the package.

e.g: `cat project_name/VERSION` will get the project version without harming
e.g: `cat js2pysecrets/VERSION` will get the project version without harming
with module imports or anything else, it is useful for CI, logs and debugging.

### Why to include `tests`, `history` and `Containerfile` as part of the release?
Expand Down
8 changes: 4 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
# How to develop on this project

project_name welcomes contributions from the community.
js2pysecrets welcomes contributions from the community.

**You need PYTHON3!**

This instructions are for linux base systems. (Linux, MacOS, BSD, etc.)
## Setting up your own fork of this repo.

- On github interface click on `Fork` button.
- Clone your fork of this repo. `git clone git@github.com:YOUR_GIT_USERNAME/project_urlname.git`
- Enter the directory `cd project_urlname`
- Add upstream repo `git remote add upstream https://github.com/author_name/project_urlname`
- Clone your fork of this repo. `git clone git@github.com:YOUR_GIT_USERNAME/JS2PySecrets.git`
- Enter the directory `cd JS2PySecrets`
- Add upstream repo `git remote add upstream https://github.com/poing/JS2PySecrets`

## Setting up your own virtual environment

Expand Down
2 changes: 1 addition & 1 deletion Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ FROM python:3.7-slim
COPY . /app
WORKDIR /app
RUN pip install .
CMD ["project_name"]
CMD ["js2pysecrets"]
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ include LICENSE
include HISTORY.md
include Containerfile
graft tests
graft project_name
graft js2pysecrets
20 changes: 10 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,20 +26,20 @@ install: ## Install the project in dev mode.

.PHONY: fmt
fmt: ## Format code using black & isort.
$(ENV_PREFIX)isort project_name/
$(ENV_PREFIX)black -l 79 project_name/
$(ENV_PREFIX)isort js2pysecrets/
$(ENV_PREFIX)black -l 79 js2pysecrets/
$(ENV_PREFIX)black -l 79 tests/

.PHONY: lint
lint: ## Run pep8, black, mypy linters.
$(ENV_PREFIX)flake8 project_name/
$(ENV_PREFIX)black -l 79 --check project_name/
$(ENV_PREFIX)flake8 js2pysecrets/
$(ENV_PREFIX)black -l 79 --check js2pysecrets/
$(ENV_PREFIX)black -l 79 --check tests/
$(ENV_PREFIX)mypy --ignore-missing-imports project_name/
$(ENV_PREFIX)mypy --ignore-missing-imports js2pysecrets/

.PHONY: test
test: lint ## Run tests and generate coverage report.
$(ENV_PREFIX)pytest -v --cov-config .coveragerc --cov=project_name -l --tb=short --maxfail=1 tests/
$(ENV_PREFIX)pytest -v --cov-config .coveragerc --cov=js2pysecrets -l --tb=short --maxfail=1 tests/
$(ENV_PREFIX)coverage xml
$(ENV_PREFIX)coverage html

Expand Down Expand Up @@ -78,9 +78,9 @@ virtualenv: ## Create a virtual environment.
release: ## Create a new tag for release.
@echo "WARNING: This operation will create s version tag and push to github"
@read -p "Version? (provide the next x.y.z semver) : " TAG
@echo "$${TAG}" > project_name/VERSION
@echo "$${TAG}" > js2pysecrets/VERSION
@$(ENV_PREFIX)gitchangelog > HISTORY.md
@git add project_name/VERSION HISTORY.md
@git add js2pysecrets/VERSION HISTORY.md
@git commit -m "release: version $${TAG} 🚀"
@echo "creating git tag : $${TAG}"
@git tag $${TAG}
Expand All @@ -101,15 +101,15 @@ switch-to-poetry: ## Switch to poetry package manager.
@poetry init --no-interaction --name=a_flask_test --author=rochacbruno
@echo "" >> pyproject.toml
@echo "[tool.poetry.scripts]" >> pyproject.toml
@echo "project_name = 'project_name.__main__:main'" >> pyproject.toml
@echo "js2pysecrets = 'js2pysecrets.__main__:main'" >> pyproject.toml
@cat requirements.txt | while read in; do poetry add --no-interaction "$${in}"; done
@cat requirements-test.txt | while read in; do poetry add --no-interaction "$${in}" --dev; done
@poetry install --no-interaction
@mkdir -p .github/backup
@mv requirements* .github/backup
@mv setup.py .github/backup
@echo "You have switched to https://python-poetry.org/ package manager."
@echo "Please run 'poetry shell' or 'poetry run project_name'"
@echo "Please run 'poetry shell' or 'poetry run js2pysecrets'"

.PHONY: init
init: ## Initialize the project based on an application template.
Expand Down
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ See also
- ✅ Code linting using [flake8](https://flake8.pycqa.org/en/latest/)
- 📊 Code coverage reports using [codecov](https://about.codecov.io/sign-up/)
- 🛳️ Automatic release to [PyPI](https://pypi.org) using [twine](https://twine.readthedocs.io/en/latest/) and github actions.
- 🎯 Entry points to execute your program using `python -m <project_name>` or `$ project_name` with basic CLI argument parsing.
- 🎯 Entry points to execute your program using `python -m <js2pysecrets>` or `$ js2pysecrets` with basic CLI argument parsing.
- 🔄 Continuous integration using [Github Actions](.github/workflows/) with jobs to lint, test and release your project on Linux, Mac and Windows environments.

> Curious about architectural decisions on this template? read [ABOUT_THIS_TEMPLATE.md](ABOUT_THIS_TEMPLATE.md)
Expand All @@ -51,33 +51,33 @@ See also
<!-- DELETE THE LINES ABOVE THIS AND WRITE YOUR PROJECT README BELOW -->

---
# project_name
# js2pysecrets

[![codecov](https://codecov.io/gh/author_name/project_urlname/branch/main/graph/badge.svg?token=project_urlname_token_here)](https://codecov.io/gh/author_name/project_urlname)
[![CI](https://github.com/author_name/project_urlname/actions/workflows/main.yml/badge.svg)](https://github.com/author_name/project_urlname/actions/workflows/main.yml)
[![codecov](https://codecov.io/gh/poing/JS2PySecrets/branch/main/graph/badge.svg?token=JS2PySecrets_token_here)](https://codecov.io/gh/poing/JS2PySecrets)
[![CI](https://github.com/poing/JS2PySecrets/actions/workflows/main.yml/badge.svg)](https://github.com/poing/JS2PySecrets/actions/workflows/main.yml)

project_description
Awesome js2pysecrets created by poing

## Install it from PyPI

```bash
pip install project_name
pip install js2pysecrets
```

## Usage

```py
from project_name import BaseClass
from project_name import base_function
from js2pysecrets import BaseClass
from js2pysecrets import base_function

BaseClass().base_method()
base_function()
```

```bash
$ python -m project_name
$ python -m js2pysecrets
#or
$ project_name
$ js2pysecrets
```

## Development
Expand Down
File renamed without changes.
File renamed without changes.
6 changes: 6 additions & 0 deletions js2pysecrets/__main__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
"""Entry point for js2pysecrets."""

from js2pysecrets.cli import main # pragma: no cover

if __name__ == "__main__": # pragma: no cover
main()
6 changes: 3 additions & 3 deletions project_name/base.py → js2pysecrets/base.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""
project_name base module.
js2pysecrets base module.
This is the principal module of the project_name project.
This is the principal module of the js2pysecrets project.
here you put your main classes and objects.
Be creative! do whatever you want!
Expand All @@ -14,4 +14,4 @@
"""

# example constant variable
NAME = "project_name"
NAME = "js2pysecrets"
4 changes: 2 additions & 2 deletions project_name/cli.py → js2pysecrets/cli.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""CLI interface for project_name project.
"""CLI interface for js2pysecrets project.
Be creative! do whatever you want!
Expand All @@ -12,7 +12,7 @@
def main(): # pragma: no cover
"""
The main function executes on commands:
`python -m project_name` and `$ project_name `.
`python -m js2pysecrets` and `$ js2pysecrets `.
This is your program's entry point.
Expand Down
2 changes: 1 addition & 1 deletion mkdocs.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
site_name: project_name
site_name: js2pysecrets
theme: readthedocs
6 changes: 0 additions & 6 deletions project_name/__main__.py

This file was deleted.

16 changes: 8 additions & 8 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
"""Python setup.py for project_name package"""
"""Python setup.py for js2pysecrets package"""
import io
import os
from setuptools import find_packages, setup


def read(*paths, **kwargs):
"""Read the contents of a text file safely.
>>> read("project_name", "VERSION")
>>> read("js2pysecrets", "VERSION")
'0.1.0'
>>> read("README.md")
...
Expand All @@ -30,17 +30,17 @@ def read_requirements(path):


setup(
name="project_name",
version=read("project_name", "VERSION"),
description="project_description",
url="https://github.com/author_name/project_urlname/",
name="js2pysecrets",
version=read("js2pysecrets", "VERSION"),
description="Awesome js2pysecrets created by poing",
url="https://github.com/poing/JS2PySecrets/",
long_description=read("README.md"),
long_description_content_type="text/markdown",
author="author_name",
author="poing",
packages=find_packages(exclude=["tests", ".github"]),
install_requires=read_requirements("requirements.txt"),
entry_points={
"console_scripts": ["project_name = project_name.__main__:main"]
"console_scripts": ["js2pysecrets = js2pysecrets.__main__:main"]
},
extras_require={"test": read_requirements("requirements-test.txt")},
)
4 changes: 2 additions & 2 deletions tests/test_base.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from project_name.base import NAME
from js2pysecrets.base import NAME


def test_base():
assert NAME == "project_name"
assert NAME == "js2pysecrets"

0 comments on commit 5f83797

Please sign in to comment.