Skip to content

Commit

Permalink
Published to conda-forge. Improved recipe generation.
Browse files Browse the repository at this point in the history
  • Loading branch information
dmyersturnbull committed Jan 18, 2021
1 parent a9a22bc commit f961b42
Show file tree
Hide file tree
Showing 19 changed files with 300 additions and 129 deletions.
8 changes: 5 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ After v1.0, will follow [Conventional Commits](https://www.conventionalcommits.o
- Stub and shields for scrutinizer
- Source license headers
- Link to license in default readme
- Real conda-forge recipe and shield for it

### Removed
- isort, which conflicted with black anyway
Expand All @@ -40,9 +41,10 @@ After v1.0, will follow [Conventional Commits](https://www.conventionalcommits.o
- Missing 'feature' and 'security' labels in pull request templates
- Added `.mypy_cache` to the trash list
- `ccybync` instead of `ccbync`
- incorrectly recognized license files
- Added `.git` to `.dockerignore`
- Added `*.tgz` and `!.npmignore` to `.gitignore`
- Incorrectly recognized license files
- Added `.git` to `.dockerignore`, and `*.tgz` and `!.npmignore` to `.gitignore`
- Generated recipes, including Poetry, Python version, and URLs
- `tyrannosaurus recipe` won’t fail on a non-empty directory


## [0.8.0] - 2020-08-28
Expand Down
2 changes: 1 addition & 1 deletion CITATION.cff
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
cff-version: 1.1.0
message: Software reference
title: Tyrannosaurus
version: 0.8.8
version: 0.8.9
abstract: Generate elegant, bleeding-edge, ready-to-use Python projects with seamless CI/CD, fit for 2021+.
authors:
-
Expand Down
46 changes: 24 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,38 +1,40 @@
# Tyrannosaurus Reqs
[![Version status](https://img.shields.io/pypi/status/tyrannosaurus)](https://pypi.org/project/tyrannosaurus/)
[![Version status](https://img.shields.io/pypi/status/tyrannosaurus?label=status)](https://pypi.org/project/tyrannosaurus)
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/tyrannosaurus)](https://pypi.org/project/tyrannosaurus/)
[![Docker](https://img.shields.io/docker/v/dmyersturnbull/tyrannosaurus?color=green&label=DockerHub)](https://hub.docker.com/repository/docker/dmyersturnbull/tyrannosaurus)
[![GitHub release (latest SemVer including pre-releases)](https://img.shields.io/github/v/release/dmyersturnbull/tyrannosaurus?include_prereleases&label=GitHub)](https://github.com/dmyersturnbull/tyrannosaurus/releases)
[![Latest version on PyPi](https://badge.fury.io/py/tyrannosaurus.svg)](https://pypi.org/project/tyrannosaurus/)
[![Documentation status](https://readthedocs.org/projects/tyrannosaurus/badge/?version=latest&style=flat-square)](https://tyrannosaurus.readthedocs.io/en/stable/)
[![Build & test](https://github.com/dmyersturnbull/tyrannosaurus/workflows/Build%20&%20test/badge.svg)](https://github.com/dmyersturnbull/tyrannosaurus/actions)
[![Travis](https://img.shields.io/travis/dmyersturnbull/tyrannosaurus?label=Travis)](https://travis-ci.org/dmyersturnbull/tyrannosaurus)
[![Maintainability](https://api.codeclimate.com/v1/badges/5e3b38c9b9c418461dc3/maintainability)](https://codeclimate.com/github/dmyersturnbull/tyrannosaurus/maintainability)
[![Python version compatibility](https://img.shields.io/pypi/pyversions/tyrannosaurus?label=Python)](https://pypi.org/project/tyrannosaurus)
[![Version on Docker Hub](https://img.shields.io/docker/v/dmyersturnbull/tyrannosaurus?color=green&label=Docker%20Hub)](https://hub.docker.com/repository/docker/dmyersturnbull/tyrannosaurus)
[![Version on Github](https://img.shields.io/github/v/release/dmyersturnbull/tyrannosaurus?include_prereleases&label=GitHub)](https://github.com/dmyersturnbull/tyrannosaurus/releases)
[![Version on PyPi](https://img.shields.io/pypi/v/tyrannosaurus?label=PyPi)](https://pypi.org/project/tyrannosaurus)
[![Version on Conda-Forge](https://img.shields.io/conda/vn/conda-forge/tyrannosaurus?label=Conda-Forge)](https://anaconda.org/conda-forge/tyrannosaurus)
[![Build (Actions)](https://img.shields.io/github/workflow/status/dmyersturnbull/tyrannosaurus/Build%20&%20test?label=Tests)](https://github.com/dmyersturnbull/tyrannosaurus/actions)
[![Build (Travis)](https://img.shields.io/travis/dmyersturnbull/tyrannosaurus?label=Travis)](https://travis-ci.org/dmyersturnbull/tyrannosaurus)
[![Documentation status](https://readthedocs.org/projects/tyrannosaurus/badge)](https://tyrannosaurus.readthedocs.io/en/stable/)
[![Coverage (coveralls)](https://coveralls.io/repos/github/dmyersturnbull/tyrannosaurus/badge.svg?branch=master&service=github)](https://coveralls.io/github/dmyersturnbull/tyrannosaurus?branch=master)
[![Coverage (codecov)](https://codecov.io/github/dmyersturnbull/tyrannosaurus/coverage.svg)](https://codecov.io/gh/dmyersturnbull/tyrannosaurus/)
[![Coverage (codecov)](https://codecov.io/github/dmyersturnbull/tyrannosaurus/coverage.svg)](https://codecov.io/gh/dmyersturnbull/tyrannosaurus)
[![Maintainability (Code Climate)](https://api.codeclimate.com/v1/badges/5e3b38c9b9c418461dc3/maintainability)](https://codeclimate.com/github/dmyersturnbull/tyrannosaurus/maintainability)
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/dmyersturnbull/tyrannosaurus/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/dmyersturnbull/tyrannosaurus/?branch=master)


An opinionated, forwards-looking Python template for 2021.
Generate elegant, ready-to-use Python projects that have excellent continuous integration and deployment.
Integrated with Dockerhub, Github Packages, Azure, and Anaconda if you like those.
An opinionated, forwards-looking Python template for 2021.

This is an upgraded, trimmed-down, modern alternative to
[cookiecutter](https://github.com/cookiecutter/cookiecutter) built with [Poetry](https://python-poetry.org/),
[Tox](https://github.com/tox-dev/tox), and [Github Actions](https://github.com/features/actions).
[No legacy files](https://dmyersturnbull.github.io/#-the-python-build-landscape) or tools.
Generate elegant, ready-to-use Python
projects that have excellent continuous integration and deployment (CI/CD). Integrated with
Docker Hub, Github Packages, Azure, Conda-Forge, and an array of linting, static analysis,
security testing, documentation, dependency management, and CI/CD tools, including a custom tool
to keep all duplicate project metadata synchronized to pyproject.toml.

Don’t make 55 commits trying to configure Travis, Docker, or readthedocs. Just use `tyrannosaurus new`
This is a modern alternative to
[cookiecutter](https://github.com/cookiecutter/cookiecutter) built with [Poetry](https://python-poetry.org/),
[Github Actions](https://github.com/features/actions), and [no legacy files](https://dmyersturnbull.github.io/#-the-python-build-landscape) or tools.
Don’t make 55 commits trying to configure CI/CD workflows. Use `tyrannosaurus new`:


```bash
pip install tyrannosaurus
tyrannosaurus new projectname --user gituserororg --track
tyrannosaurus new projectname --track
```

Tyrannosaurus will then list final manual steps like adding API keys.
(`--track` will git track _gituserororg/projectname_.)
After initializing your project, Tyrannosaurus will list some manual steps, such as adding API keys.


#### Main behavior / features:
Expand Down Expand Up @@ -70,7 +72,7 @@ You can swap out, modify, or disable anything as you see fit.
- Nice documentation defaults with
[Sphinx extensions](https://www.sphinx-doc.org/en/master/usage/extensions/index.html)
- Test automation with [Tox](https://tox.readthedocs.io)
- Code quality and coverage [badges](https://github.com/badges/shields) with
- [Shields](https://github.com/badges/shields) with
[Coveralls](https://coveralls.io/),
[codecov](https://about.codecov.io/),
[CodeClimate](https://codeclimate.com/),
Expand Down
2 changes: 1 addition & 1 deletion codemeta.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"codeRepository":"https://github.com/dmyersturnbull/tyrannosaurus",
"issueTracker":"https://github.com/dmyersturnbull/tyrannosaurus/issues",
"license":"https://www.apache.org/licenses/LICENSE-2.0",
"version":"0.8.8",
"version":"0.8.9",
"author":[
{
"@type":"Person",
Expand Down
10 changes: 10 additions & 0 deletions environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# auto-generated by `tyrannosaurus env`
name: tyrannosaurus
channels:
- conda-forge
dependencies:
- python>=3.8,<4
- tomlkit>=0.7,<1
- typer>=0.3,<1
- requests>=2.24,<3
- grayskull>=0.8.4,<1
26 changes: 13 additions & 13 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 9 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ build-backend = "poetry.masonry.api"

[tool.poetry]
name = "tyrannosaurus"
version = "0.8.8"
version = "0.8.9"
description = "Generate elegant, bleeding-edge, ready-to-use Python projects with seamless CI/CD, fit for 2021+."
authors = ["Douglas Myers-Turnbull"]
maintainers = ["Douglas Myers-Turnbull"]
Expand Down Expand Up @@ -78,6 +78,14 @@ authors = [
"Douglas Myers-Turnbull <github:dmyersturnbull,orcid:0000-0003-3610-4808>"
]
maintainers = "tool.tyrannosaurus.sources.authors"
long_description = """'
An opinionated, forwards-looking Python template for 2021. Generate elegant, ready-to-use Python projects that have
excellent continuous integration and deployment (CI/CD). Integrated with Docker Hub, Github Packages, Azure,
Conda-Forge, and an array of linting, static analysis, security testing, documentation, dependency management, and
CI/CD tools, including a custom tool to keep all duplicate project metadata synchronized to a single pyproject.toml.
You only need to interact with your project via git, tyrannosaurus, and Github releases – all other integrations
kick off from there.
'"""
importorderstyle = "'google'"
docstringstyle = "'google'"

Expand Down
39 changes: 27 additions & 12 deletions recipes/tyrannosaurus/meta.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
{% set name = "tyrannosaurus" %}
{% set version = "0.8.2" %}

{% set version = "0.8.8" %}

package:
name: {{ name|lower }}
version: {{ version }}

source:
url: https://pypi.io/packages/source/{{ name[0] }}/{{ name }}/{{ name }}-{{ version }}.tar.gz
sha256: 148010497b39abf595b3dfc53ed9bbddacb750197d6d88cd0c99a68915ba38e9
url: https://pypi.io/packages/source/{{ name[0] }}/{{ name }}/tyrannosaurus-{{ version }}.tar.gz
sha256: 86c31f8e05b9c584e08f5b427e2f31043e540383f474a8dfe530c9ec5d1d3f13

build:
number: 0
Expand All @@ -19,12 +18,15 @@ build:

requirements:
host:
- pip
- python >=3.8,<4.0
- pip >=20
- poetry >=1.1,<2
- python >=3.8,<4
run:
- python >=3.8,<4.0
- tomlkit >=0.7.0,<1.0.0
- typer >=0.3.0,<1.0.0
- grayskull >=0.8.4,<1
- python >=3.8,<4
- requests >=2.24,<3
- tomlkit >=0.7,<1
- typer >=0.3,<1

test:
imports:
Expand All @@ -33,13 +35,26 @@ test:
- pip check
- tyrannosaurus --help
requires:
- pip
- pip >=20
- poetry >=1.1,<2

about:
home: https://pypi.org/project/tyrannosaurus/
summary: Opinionated 2021 Python template and metadata synchronizer.
home: https://github.com/dmyersturnbull/tyrannosaurus
summary: |
Generate elegant, bleeding-edge, ready-to-use Python projects with seamless CI/CD, fit for 2021+.
license_family: Apache
license: Apache-2.0
license_file: LICENSE.txt
description: |
An opinionated, forwards-looking Python template for 2021. Generate elegant, ready-to-use Python
projects that have excellent continuous integration and deployment (CI/CD). Integrated with
Docker Hub, Github Packages, Azure, Conda-Forge, and an array of linting, static analysis,
security testing, documentation, dependency management, and CI/CD tools, including a custom tool
to keep all duplicate project metadata synchronized to a single pyproject.toml. You only need to
interact with your project via git, tyrannosaurus, and Github releases – all other integrations
kick off from there.
doc_url: https://tyrannosaurus.readthedocs.io
dev_url: https://github.com/dmyersturnbull/tyrannosaurus

extra:
recipe-maintainers:
Expand Down
11 changes: 6 additions & 5 deletions tests/resources/fake/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
description-file = "README.md"

[build-system]
requires = ["poetry>=1.0", "coverage[toml]"]
requires = ["poetry>=1.1,<2", "virtualenv==20.0.33", "wheel>=0.36,<1.0"]
build-backend = "poetry.masonry.api"


Expand Down Expand Up @@ -32,10 +32,9 @@ include = [
]

[tool.poetry.urls]
ci = "https://github.com/fakeorg/fake/actions"
issues = "https://github.com/fakeorg/fake/issues"
source = "https://github.com/fakeorg/fake"
download = "https://pypi.org/project/fake/"
CI = "https://github.com/fakeorg/fake/actions"
Issues = "https://github.com/fakeorg/fake/issues"
Download = "https://pypi.org/project/fake/"


#########################################################################################
Expand All @@ -44,6 +43,7 @@ download = "https://pypi.org/project/fake/"

[tool.tyrannosaurus.options]
align = true
sort = false

[tool.tyrannosaurus.sources]
# use a literal value ('') or refer to a pyproject setting
Expand Down Expand Up @@ -139,6 +139,7 @@ target-version = ["py37", "py38"]

[tool.isort]
line_length = 100

[mypy]
check_untyped_defs = true
strict_optional = true
Expand Down
4 changes: 3 additions & 1 deletion tests/test_conda.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@ def test_recipe(self):
# FYI dry run is impossible because of grayskull
context = Context(path, dry_run=True)
lines = Recipe(context).create(path / "recipes")
# TODO totally inadequate coverage
assert len(lines) > 20
assert " - fakeorg" in lines
# assert " - pip >=20" in lines
# assert " - poetry >=1.1,<2.0" in lines


if __name__ == "__main__":
Expand Down
5 changes: 3 additions & 2 deletions tyrannosaurus/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,14 +91,14 @@ def callback(

class CliCommands:

_APACHE2 = typer.Option("apache2")
_APACHE2 = typer.Option(License.apache2)
_ENV_YAML = Path("environment.yml")

@staticmethod
@cli.command()
def new(
name: str,
license: License = _APACHE2,
license: str = _APACHE2,
user: Optional[str] = None,
authors: Optional[str] = None,
description: str = "A Python project",
Expand All @@ -112,6 +112,7 @@ def new(
) -> None: # pragma: no cover
"""
Creates a new project.
Args:
name: The name of the project, including any dashes or capital letters
license: The name of the license. One of: apache2, cc0, ccby, ccbync, gpl3, lgpl3, mit
Expand Down
5 changes: 2 additions & 3 deletions tyrannosaurus/conda.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,10 @@ def create(self, output_dir: Optional[Path]) -> Sequence[str]:
context = self.context
wt = output_dir / context.project
yaml_path = wt / "meta.yaml"
# ex: yaml_path = "tyrannosaurus/meta.yaml"
if yaml_path.exists():
context.delete_exact_path(yaml_path, False)
if wt.exists():
(output_dir / context.project).rmdir()
wt.mkdir(parents=True)
wt.mkdir(parents=True, exist_ok=True)
skull = GrayskullFactory.create_recipe("pypi", context.poetry("name"), "")
skull.generate_recipe(str(output_dir), mantainers=context.source("maintainers").split(","))
logger.debug(f"Generated a new recipe at {output_dir}/meta.yaml")
Expand Down
Loading

0 comments on commit f961b42

Please sign in to comment.