mirror of
https://github.com/shouptech/synthale.git
synced 2026-02-03 15:39:45 +00:00
Compare commits
10 commits
| Author | SHA1 | Date | |
|---|---|---|---|
| cbd2619f90 | |||
| 0214065276 | |||
| dae353ce72 | |||
| 9e1ad56ae7 | |||
| 96205a625d | |||
| db33d908a3 | |||
| b46901407a | |||
| 6c23be1ab9 | |||
| 944d29aa96 | |||
| 3c092a6900 |
13 changed files with 227 additions and 31 deletions
15
CHANGELOG.rst
Normal file
15
CHANGELOG.rst
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
Changelog
|
||||||
|
=========
|
||||||
|
|
||||||
|
0.1.1 - 2018-01-04
|
||||||
|
------------------
|
||||||
|
|
||||||
|
* Fix `Issue 1`_, dry hop times are now in days.
|
||||||
|
* Added a Changelog
|
||||||
|
|
||||||
|
.. _`Issue 1`: https://github.com/shouptech/synthale/issues/1
|
||||||
|
|
||||||
|
0.1.0 - 2018-01-03
|
||||||
|
------------------
|
||||||
|
|
||||||
|
* Initial release
|
||||||
147
CONTRIBUTING.rst
Normal file
147
CONTRIBUTING.rst
Normal file
|
|
@ -0,0 +1,147 @@
|
||||||
|
Contributing
|
||||||
|
============
|
||||||
|
|
||||||
|
Synthale is a little project of mine that I hope others will use. As a user and
|
||||||
|
fan of open source software, I welcome any contributions you have!
|
||||||
|
|
||||||
|
This guide is intended to help you contribute to this project.
|
||||||
|
|
||||||
|
Issues
|
||||||
|
------
|
||||||
|
|
||||||
|
Please open a `GitHub Issue`_ for any bugs, support requests, or feature
|
||||||
|
requests you have. For bugs and support requests, please describe what you were
|
||||||
|
doing when you encountered the issue, and include any sample BeerXML recipes.
|
||||||
|
|
||||||
|
If you wish to contribute a feature, or have a request for a feature, pleasea
|
||||||
|
also open a new `GitHub Issue`_.
|
||||||
|
|
||||||
|
.. _`GitHub Issue`: https://github.com/shouptech/synthale/issues
|
||||||
|
|
||||||
|
Pull Requests
|
||||||
|
-------------
|
||||||
|
|
||||||
|
I welcome all pull requests! Expect a back and forth conversation while we make
|
||||||
|
sure your contribution is the best it can be. If you plan to spend significant
|
||||||
|
time contributing a new feature, pelase open a `GitHub Issue`_ first to ensure
|
||||||
|
it is something that will be accepted.
|
||||||
|
|
||||||
|
I ask the following of all pull requests:
|
||||||
|
|
||||||
|
1. Your code must be written for the versions of Python supported. Currently,
|
||||||
|
Synthale supports Python 3.5 and newer.
|
||||||
|
2. Your code should pass all the `unit tests`_.
|
||||||
|
3. New code should not decrease the coverage of the `unit tests`_. This means
|
||||||
|
may need to write new `unit tests`_ before your pull request can be merged.
|
||||||
|
4. Your code should follow the same `style guidelines`_ as the rest of the
|
||||||
|
project.
|
||||||
|
5. You agree to release your code under the `GNU GPLv3`_ license. You do not
|
||||||
|
transfer your copyright to me, and you own your code. Please add your
|
||||||
|
copyright statement to the top of the file. (If more people than just me
|
||||||
|
contribute, I may move the copyright notices to a separate file.)
|
||||||
|
|
||||||
|
.. _`GNU GPLv3`: https://www.gnu.org/licenses/gpl-3.0.en.html
|
||||||
|
|
||||||
|
Developing
|
||||||
|
----------
|
||||||
|
|
||||||
|
Create a virtual environment with Python 3.5 or newer. Clone the `GitHub
|
||||||
|
Repository`_ and install synthale w/ `pip`, and install the required tools for
|
||||||
|
testing:
|
||||||
|
|
||||||
|
::
|
||||||
|
|
||||||
|
pip install -e .
|
||||||
|
pip install -r test-requirements.txt
|
||||||
|
|
||||||
|
.. _`GitHub Repository`: https://github.com/shouptech/synthale
|
||||||
|
|
||||||
|
Unit Tests
|
||||||
|
----------
|
||||||
|
|
||||||
|
All code should be covered by automated unit tests. The tools `pytest` and
|
||||||
|
`coverage` are used, and tests are located in the `tests/` folder.
|
||||||
|
|
||||||
|
Before submitting your code, run the unit tests. You can do it one of two ways:
|
||||||
|
|
||||||
|
**On your computer**
|
||||||
|
|
||||||
|
See `Developing`_ for setting up your development environment. Run the tests:
|
||||||
|
|
||||||
|
::
|
||||||
|
|
||||||
|
coverage run -m pytest
|
||||||
|
coverage report -m
|
||||||
|
|
||||||
|
Ensure your new code is included in the tests.
|
||||||
|
|
||||||
|
**Using cirlceci**
|
||||||
|
|
||||||
|
You can add your forked repo to CircleCI_ and run the tests when you push to
|
||||||
|
your repo.
|
||||||
|
|
||||||
|
.. _CircleCI: https://circleci.com/
|
||||||
|
|
||||||
|
Style Guidelines
|
||||||
|
----------------
|
||||||
|
|
||||||
|
In general, code should conform to `PEP 8`_.
|
||||||
|
|
||||||
|
You can confirm that your code generally follows my preferred style by running
|
||||||
|
the `flake8` command, after you've installed the test requirements.
|
||||||
|
|
||||||
|
The following are things that PEP 8 either doesn't talk about, or are
|
||||||
|
ambiguous:
|
||||||
|
|
||||||
|
**Indentation**
|
||||||
|
|
||||||
|
Indent with 4 spaces. Don't use tabs.
|
||||||
|
|
||||||
|
**Line length**
|
||||||
|
|
||||||
|
Lines should not be longer than 79 characters. I frequently like to put two
|
||||||
|
code files side by side on one monitor, and 79 characters is the perfect
|
||||||
|
cutoff.
|
||||||
|
|
||||||
|
**String formatting**
|
||||||
|
|
||||||
|
I prefer to wrap strings in 'single quotes' instead of "double quotes". The
|
||||||
|
exception is if a string will have an apostrophe or single quote inside, and
|
||||||
|
it will look better to use double quotes.
|
||||||
|
|
||||||
|
*Do this*:
|
||||||
|
|
||||||
|
::
|
||||||
|
|
||||||
|
'Just a plain old string.'
|
||||||
|
"You're an aweomse contributor."
|
||||||
|
|
||||||
|
*Don't do this*:
|
||||||
|
|
||||||
|
::
|
||||||
|
|
||||||
|
"Double quotes for plain strings."
|
||||||
|
'Single quotes where you\'ll use an apostrophe.'
|
||||||
|
|
||||||
|
I prefer `str.format` over formatting strings with the `%` operator.
|
||||||
|
|
||||||
|
*Do this*:
|
||||||
|
|
||||||
|
::
|
||||||
|
|
||||||
|
"{} is the loneliest number that you'll ever do.".format(1)
|
||||||
|
|
||||||
|
*Don't do this*:
|
||||||
|
|
||||||
|
::
|
||||||
|
|
||||||
|
'%d can be as bad as %d' % (2, 1)
|
||||||
|
|
||||||
|
**Docstrings**
|
||||||
|
|
||||||
|
Everything should have a docstring, and the `flake8-docstrings` package will
|
||||||
|
help make sure the docstring is well-formatted. The docstrings should describe
|
||||||
|
the class/method/function/whatever. Docstrings should explain the parameters,
|
||||||
|
and what is returned.
|
||||||
|
|
||||||
|
.. _`PEP 8`: https://www.python.org/dev/peps/pep-0008/
|
||||||
45
README.rst
45
README.rst
|
|
@ -4,6 +4,12 @@
|
||||||
.. image:: https://codecov.io/gh/shouptech/synthale/branch/master/graph/badge.svg
|
.. image:: https://codecov.io/gh/shouptech/synthale/branch/master/graph/badge.svg
|
||||||
:target: https://codecov.io/gh/shouptech/synthale
|
:target: https://codecov.io/gh/shouptech/synthale
|
||||||
|
|
||||||
|
.. image:: https://badge.fury.io/py/synthale.svg
|
||||||
|
:target: https://pypi.org/project/synthale/
|
||||||
|
|
||||||
|
.. image:: https://img.shields.io/badge/License-GPLv3-blue.svg
|
||||||
|
:target: https://www.gnu.org/licenses/gpl-3.0
|
||||||
|
|
||||||
|
|
||||||
Synthale
|
Synthale
|
||||||
========
|
========
|
||||||
|
|
@ -17,31 +23,34 @@ can then use those Markdown files in your favorite static website generator.
|
||||||
Installation and Usage
|
Installation and Usage
|
||||||
----------------------
|
----------------------
|
||||||
|
|
||||||
Please visit `the documentation`_ for installation and usage instructions.
|
If you have Python 3.5 or newer installed, install via pip:
|
||||||
|
|
||||||
|
::
|
||||||
|
|
||||||
|
pip install synthale
|
||||||
|
|
||||||
|
To actually use the thing, use the `generate` command:
|
||||||
|
|
||||||
|
::
|
||||||
|
|
||||||
|
synthale generate --help
|
||||||
|
|
||||||
|
More thorough instructions can be found at `the documentation`_.
|
||||||
|
|
||||||
.. _`the documentation`: https://synthale.readthedocs.io/en/latest/index.html
|
.. _`the documentation`: https://synthale.readthedocs.io/en/latest/index.html
|
||||||
|
|
||||||
|
|
||||||
|
Developing
|
||||||
|
----------
|
||||||
|
|
||||||
|
Please see the documentation on `contributing`_ for information on how to
|
||||||
|
develop Synthale.
|
||||||
|
|
||||||
|
.. _`contributing`: https://synthale.readthedocs.io/en/latest/contributing.html
|
||||||
|
|
||||||
License
|
License
|
||||||
-------
|
-------
|
||||||
|
|
||||||
Synthale is released under the GPLv3_ license.
|
Synthale is released under the GPLv3_ license.
|
||||||
|
|
||||||
.. _GPLv3: LICENSE
|
.. _GPLv3: LICENSE
|
||||||
|
|
||||||
::
|
|
||||||
|
|
||||||
Copyright (C) 2019 Mike Shoup
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
|
|
|
||||||
|
|
@ -55,9 +55,9 @@ author = 'Mike Shoup'
|
||||||
# built documents.
|
# built documents.
|
||||||
#
|
#
|
||||||
# The short X.Y version.
|
# The short X.Y version.
|
||||||
version = '0.0.4'
|
version = '0.1.1'
|
||||||
# The full version, including alpha/beta/rc tags.
|
# The full version, including alpha/beta/rc tags.
|
||||||
release = '0.0.4'
|
release = '0.1.1'
|
||||||
|
|
||||||
# The language for content autogenerated by Sphinx. Refer to documentation
|
# The language for content autogenerated by Sphinx. Refer to documentation
|
||||||
# for a list of supported languages.
|
# for a list of supported languages.
|
||||||
|
|
|
||||||
1
docs/contributing.rst
Normal file
1
docs/contributing.rst
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
.. include :: ../CONTRIBUTING.rst
|
||||||
|
|
@ -13,6 +13,7 @@ can then use those Markdown files in your favorite static website generator.
|
||||||
installing
|
installing
|
||||||
usage
|
usage
|
||||||
modules
|
modules
|
||||||
|
contributing
|
||||||
license
|
license
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
[bumpversion]
|
[bumpversion]
|
||||||
current_version = 0.0.4
|
current_version = 0.1.1
|
||||||
commit = True
|
commit = True
|
||||||
tag = True
|
tag = True
|
||||||
tag_name = {new_version}
|
tag_name = {new_version}
|
||||||
|
|
|
||||||
2
setup.py
2
setup.py
|
|
@ -28,7 +28,7 @@ install_requires = [
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
name='synthale',
|
name='synthale',
|
||||||
version='0.0.4',
|
version='0.1.1',
|
||||||
url='https://github.com/shouptech/synthale',
|
url='https://github.com/shouptech/synthale',
|
||||||
author='Mike Shoup',
|
author='Mike Shoup',
|
||||||
author_email='mike@shoup.io',
|
author_email='mike@shoup.io',
|
||||||
|
|
|
||||||
|
|
@ -15,4 +15,4 @@
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
VERSION = '0.0.4'
|
VERSION = '0.1.1'
|
||||||
|
|
|
||||||
|
|
@ -25,10 +25,7 @@ from synthale.recipes import load_file, load_all_files, write_recipes
|
||||||
|
|
||||||
@click.group()
|
@click.group()
|
||||||
def cli():
|
def cli():
|
||||||
"""Synthale converts BeerXML files to markdown.
|
"""Synthale converts BeerXML files to markdown."""
|
||||||
|
|
||||||
Copyright (C) 2019 Mike Shoup
|
|
||||||
"""
|
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -185,6 +185,7 @@ class MarkdownRecipe:
|
||||||
headers = ('Name', 'Origin', 'Alpha', 'Amount', 'Time', 'Use')
|
headers = ('Name', 'Origin', 'Alpha', 'Amount', 'Time', 'Use')
|
||||||
rows = []
|
rows = []
|
||||||
for hop in self.recipe.hops:
|
for hop in self.recipe.hops:
|
||||||
|
# Determine hop unit
|
||||||
if self.hop_unit == 'pounds':
|
if self.hop_unit == 'pounds':
|
||||||
amt = convert.pounds(hop.amount, '.2f')
|
amt = convert.pounds(hop.amount, '.2f')
|
||||||
elif self.hop_unit == 'grams':
|
elif self.hop_unit == 'grams':
|
||||||
|
|
@ -193,12 +194,19 @@ class MarkdownRecipe:
|
||||||
amt = convert.kilograms(hop.amount, '.2f')
|
amt = convert.kilograms(hop.amount, '.2f')
|
||||||
else:
|
else:
|
||||||
amt = convert.ounces(hop.amount, '.1f')
|
amt = convert.ounces(hop.amount, '.1f')
|
||||||
|
|
||||||
|
# Determine hop timing
|
||||||
|
if hop.use == 'Dry Hop':
|
||||||
|
# 1 day = 1440 minutes
|
||||||
|
time = '{:.1f} days'.format(hop.time / 1440.0)
|
||||||
|
else:
|
||||||
|
time = '{} min'.format(int(round(hop.time)))
|
||||||
rows.append((
|
rows.append((
|
||||||
hop.name,
|
hop.name,
|
||||||
hop.origin,
|
hop.origin,
|
||||||
'{:.1f} %'.format(hop.alpha),
|
'{:.1f} %'.format(hop.alpha),
|
||||||
amt,
|
amt,
|
||||||
'{}'.format(int(round(hop.time))),
|
time,
|
||||||
hop.use,
|
hop.use,
|
||||||
))
|
))
|
||||||
return (
|
return (
|
||||||
|
|
|
||||||
|
|
@ -76,6 +76,19 @@
|
||||||
<DISPLAY_TIME>60.0 min</DISPLAY_TIME>
|
<DISPLAY_TIME>60.0 min</DISPLAY_TIME>
|
||||||
<NOTES></NOTES>
|
<NOTES></NOTES>
|
||||||
</HOP>
|
</HOP>
|
||||||
|
<HOP>
|
||||||
|
<NAME>Cascade</NAME>
|
||||||
|
<ORIGIN>U.S.</ORIGIN>
|
||||||
|
<ALPHA>5.5</ALPHA>
|
||||||
|
<BETA></BETA>
|
||||||
|
<AMOUNT>0.0141747</AMOUNT>
|
||||||
|
<DISPLAY_AMOUNT>0.5 oz</DISPLAY_AMOUNT>
|
||||||
|
<USE>Dry Hop</USE>
|
||||||
|
<FORM>Pellet</FORM>
|
||||||
|
<TIME>7200</TIME>
|
||||||
|
<DISPLAY_TIME>5 days</DISPLAY_TIME>
|
||||||
|
<NOTES></NOTES>
|
||||||
|
</HOP>
|
||||||
</HOPS>
|
</HOPS>
|
||||||
<YEASTS>
|
<YEASTS>
|
||||||
<YEAST>
|
<YEAST>
|
||||||
|
|
|
||||||
|
|
@ -128,9 +128,14 @@ def test_recipe_hops(md_weizen):
|
||||||
assert md_weizen.hops == (
|
assert md_weizen.hops == (
|
||||||
'Hops\n'
|
'Hops\n'
|
||||||
'----\n'
|
'----\n'
|
||||||
'| Name | Origin | Alpha | Amount | Time | Use |\n'
|
'| Name | Origin | Alpha | Amount | Time |'
|
||||||
'| -------------------- | ------- | ----- | ------ | ---- | ---- |\n'
|
' Use |\n'
|
||||||
'| Northern Brewer (DE) | Germany | 4.9 % | 1.0 oz | 60 | Boil |'
|
'| -------------------- | ------- | ----- | ------ | -------- |'
|
||||||
|
' ------- |\n'
|
||||||
|
'| Northern Brewer (DE) | Germany | 4.9 % | 1.0 oz | 60 min |'
|
||||||
|
' Boil |\n'
|
||||||
|
'| Cascade | U.S. | 5.5 % | 0.5 oz | 5.0 days |'
|
||||||
|
' Dry Hop |'
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue