Skip to content

Commit 444f77c

Browse files
Dídac Colldidix21
authored andcommitted
GH-80: Support poetry build system
- Add pyproject.toml. - Update README.rst with poetry steps for installing mdutils. - Update README.md with poetry steps for installing mdutils. - Update CONTRIBUTION.md file.
1 parent 0151e75 commit 444f77c

File tree

6 files changed

+76
-11
lines changed

6 files changed

+76
-11
lines changed

.vscode/settings.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@
44
],
55
"python.testing.unittestEnabled": false,
66
"python.testing.pytestEnabled": true,
7-
"python.formatting.provider": "black"
7+
"python.formatting.provider": "black",
8+
"esbonio.sphinx.confDir": ""
89
}

CONTRIBUTING.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,10 @@ Please note we have a code of conduct, please follow it in all your interactions
1313
## Deployment
1414

1515
1. The versioning scheme we use is [SemVer](http://semver.org/).
16-
2. Increase the version number in `mdutils/doc/source/config.py` file.
17-
3. Increase the version number in `mdutils/setup.py` file.
18-
4. Increate the version number to `.github_changelog_generator` file.
16+
2. Increase the version number in the `mdutils/doc/source/config.py` file.
17+
3. Increase the version number in the `mdutils/setup.py` file.
18+
3. Increase the version number in the `mdutils/pyproject.toml` file.
19+
4. Increate the version number in the `.github_changelog_generator` file.
1920
5. Run `github_changelog_generator -u didix21 -p mdutils`.
2021
6. Run `python setup.py sdist --formats=gztar,zip`.
2122
7. Upload package to pypi: `twine upload dist/*`.

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,21 @@ Markdown
5151

5252
Installation
5353
============
54+
55+
Pip
56+
---
5457
Use pip to install mdutils:
5558
```bash
5659
$ pip install mdutils
5760
```
5861

62+
Poetry
63+
------
64+
Use poetry to install mdutils:
65+
```bash
66+
$ poetry add mdutils
67+
```
68+
5969
Markdown File Example
6070
=====================
6171

doc/source/README.rst

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,22 +47,32 @@ Markdown
4747

4848
Installation
4949
============
50+
51+
Pip
52+
---
5053
Use pip to install mdutils:
5154

5255
.. code:: bash
5356
5457
$ pip install mdutils
5558
59+
Poetry
60+
------
61+
Use poetry to install mdutils:
62+
63+
.. code:: bash
64+
65+
$ poetry add mdutils
5666
5767
58-
.. |build-status| image:: https://travis-ci.org/didix21/mdutils.svg?branch=master
59-
:target: https://travis-ci.org/didix21/mdutils
68+
.. |build-status| image:: https://github.com/didix21/mdutils/actions/workflows/main.yml/badge.svg
69+
:target: https://github.com/didix21/mdutils
6070
:alt: Build Status
6171

6272
.. |documentation-status| image:: https://readthedocs.org/projects/mdutils/badge/?version=latest
6373
:target: http://mdutils.readthedocs.io/en/latest/?badge=latest
6474
:alt: Documentation Status
6575

66-
.. |coverage-status| image:: https://coveralls.io/repos/github/didix21/mdutils/badge.svg?branch=add-coveralls
67-
:target: https://coveralls.io/github/didix21/mdutils?branch=add-coveralls
76+
.. |coverage-status| image:: https://codecov.io/gh/didix21/mdutils/branch/master/graph/badge.svg?token=0DN72Z1B6V
77+
:target: https://codecov.io/gh/didix21/mdutils
6878
:alt: Coverage Status

pyproject.toml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
[build-system]
2+
requires = ["setuptools", "wheel"]
3+
4+
[tool.poetry]
5+
name = "mdutils"
6+
version = "1.5.1"
7+
description = "Useful package for creating Markdown files while executing python code."
8+
authors = ["Didac Coll <[email protected]>"]
9+
maintainers = ["Didac Coll <[email protected]>"]
10+
license = "MIT"
11+
readme = "./doc/source/README.rst"
12+
homepage = "https://github.com/didix21/mdutils"
13+
repository = "https://github.com/didix21/mdutils"
14+
documentation = "http://mdutils.readthedocs.io"
15+
keywords = ["Markdown"]
16+
include = ["mdutils/**"]
17+
classifiers = [
18+
"Development Status :: 5 - Production/Stable",
19+
"Operating System :: OS Independent",
20+
"Programming Language :: Python",
21+
"Programming Language :: Python :: 3.6",
22+
"Programming Language :: Python :: 3.7",
23+
"Programming Language :: Python :: 3.8",
24+
"Topic :: Utilities",
25+
"Topic :: Software Development :: Documentation",
26+
"Topic :: Text Processing :: Markup",
27+
"License :: OSI Approved :: MIT License",
28+
]
29+
exclude = ["*.pyc", "*.pyo", "*.pyd", "Pyrex/*", "pyx/*", ".git/*", ".hg/*", ".bzr/*", "_darcs/*", "*.egg-info/*", ".svn/*", ".github/*", ".DS_Store", ".vscode"]
30+
31+
[tool.poetry.dependencies]
32+
python = "^3.6"
33+

scripts/update-release.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import getopt, sys
44
import re
5+
import subprocess
56

67

78
def usage():
@@ -21,23 +22,31 @@ def replace_on(file, pattern, new_value):
2122
file.write(new_content)
2223

2324

24-
def replace_version_on_config_py(version):
25+
def replace_version_on_config_py(version: str):
2526
file_name = "doc/source/conf.py"
2627
replace_on(file_name, r"release = '(\d+).(\d+).(\d+)'", f"release = '{version}'")
2728

2829

29-
def replace_version_on_setup_py(version):
30+
def replace_version_on_setup_py(version: str):
3031
file_name = "setup.py"
3132
replace_on(file_name, r"version='(\d+).(\d+).(\d+)'", f"version='{version}'")
3233

3334

34-
def replace_version_on_changelog_gen(version):
35+
def replace_version_on_changelog_gen(version: str):
3536
file_name = ".github_changelog_generator"
3637
replace_on(
3738
file_name, r"future-release=v(\d+).(\d+).(\d+)", f"future-release={version}"
3839
)
3940

4041

42+
def update_versiono_pyproject_toml(version: str):
43+
shell(["poetry", "version", version])
44+
45+
46+
def shell(command):
47+
return subprocess.run(command, text=True)
48+
49+
4150
def main():
4251
version = None
4352
try:
@@ -58,6 +67,7 @@ def main():
5867
replace_version_on_setup_py(version_number)
5968
replace_version_on_config_py(version_number)
6069
replace_version_on_changelog_gen(version)
70+
update_versiono_pyproject_toml(version_number)
6171

6272

6373
if __name__ == "__main__":

0 commit comments

Comments
 (0)