Skip to content

Commit d6d2ca9

Browse files
update README and changelog
1 parent 9a862d9 commit d6d2ca9

File tree

2 files changed

+49
-201
lines changed

2 files changed

+49
-201
lines changed

README.md

Lines changed: 42 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
1-
# MicroPython package template
1+
# MicroPython DS1307
22

3-
[![Downloads](https://pepy.tech/badge/micropython-package-template)](https://pepy.tech/project/micropython-package-template)
4-
![Release](https://img.shields.io/github/v/release/brainelectronics/micropython-package-template?include_prereleases&color=success)
3+
[![Downloads](https://pepy.tech/badge/micropython-ds1307)](https://pepy.tech/project/micropython-ds1307)
4+
![Release](https://img.shields.io/github/v/release/brainelectronics/micropython-ds1307?include_prereleases&color=success)
55
![MicroPython](https://img.shields.io/badge/micropython-Ok-green.svg)
66
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
7-
[![codecov](https://codecov.io/github/brainelectronics/micropython-package-template/branch/main/graph/badge.svg)](https://app.codecov.io/github/brainelectronics/micropython-package-template)
8-
[![CI](https://github.com/brainelectronics/micropython-package-template/actions/workflows/release.yml/badge.svg)](https://github.com/brainelectronics/micropython-package-template/actions/workflows/release.yml)
7+
[![codecov](https://codecov.io/github/brainelectronics/micropython-ds1307/branch/main/graph/badge.svg)](https://app.codecov.io/github/brainelectronics/micropython-ds1307)
8+
[![CI](https://github.com/brainelectronics/micropython-ds1307/actions/workflows/release.yml/badge.svg)](https://github.com/brainelectronics/micropython-ds1307/actions/workflows/release.yml)
99

10-
MicroPython PyPi package template project with auto deploy
10+
MicroPython driver for DS1307 RTC
1111

1212
---------------
1313

1414
## General
1515

16-
MicroPython PyPi package template with GitHub Action based testing and deploy
16+
MicroPython driver for DS1307 RTC
1717

1818
📚 The latest documentation is available at
19-
[MicroPython Package Template ReadTheDocs][ref-rtd-micropython-package-template] 📚
19+
[MicroPython DS1307 ReadTheDocs][ref-rtd-micropython-ds1307] 📚
2020

2121
<!-- MarkdownTOC -->
2222

@@ -30,13 +30,8 @@ MicroPython PyPi package template with GitHub Action based testing and deploy
3030
- [Manually](#manually)
3131
- [Upload files to board](#upload-files-to-board)
3232
- [Usage](#usage)
33-
- [Create a PyPi \(micropython\) package](#create-a-pypi-micropython-package)
34-
- [Setup](#setup-1)
35-
- [Create a distribution](#create-a-distribution)
36-
- [Upload to PyPi](#upload-to-pypi)
3733
- [Contributing](#contributing)
3834
- [Unittests](#unittests)
39-
- [Steps after using this template](#steps-after-using-this-template)
4035
- [Credits](#credits)
4136

4237
<!-- /MarkdownTOC -->
@@ -82,14 +77,14 @@ Install the latest package version of this lib on the MicroPython device
8277

8378
```python
8479
import mip
85-
mip.install("github:brainelectronics/micropython-package-template")
80+
mip.install("github:brainelectronics/micropython-ds1307")
8681
```
8782

8883
For MicroPython versions below 1.19.1 use the `upip` package instead of `mip`
8984

9085
```python
9186
import upip
92-
upip.install('micropython-package-template')
87+
upip.install('micropython-ds1307')
9388
```
9489

9590
#### Specific version
@@ -99,16 +94,16 @@ Install a specific, fixed package version of this lib on the MicroPython device
9994
```python
10095
import mip
10196
# install a verions of a specific branch
102-
mip.install("github:brainelectronics/micropython-package-template", version="feature/initial-implementation")
97+
mip.install("github:brainelectronics/micropython-ds1307", version="feature/initial-implementation")
10398
# install a tag version
104-
mip.install("github:brainelectronics/micropython-package-template", version="0.6.0")
99+
mip.install("github:brainelectronics/micropython-ds1307", version="0.1.0")
105100
```
106101

107102
For MicroPython versions below 1.19.1 use the `upip` package instead of `mip`
108103

109104
```python
110105
import upip
111-
upip.install('micropython-package-template==0.1.1')
106+
upip.install('micropython-ds1307')
112107
```
113108

114109
#### Test version
@@ -120,7 +115,7 @@ will be used.
120115

121116
```python
122117
import mip
123-
mip.install("github:brainelectronics/micropython-package-template", version="0.6.0-rc9.dev13")
118+
mip.install("github:brainelectronics/micropython-ds1307", version="0.1.0-rc1.dev1")
124119
```
125120

126121
For MicroPython versions below 1.19.1 use the `upip` package instead of `mip`
@@ -129,7 +124,7 @@ For MicroPython versions below 1.19.1 use the `upip` package instead of `mip`
129124
import upip
130125
# overwrite index_urls to only take artifacts from test.pypi.org
131126
upip.index_urls = ['https://test.pypi.org/pypi']
132-
upip.install('micropython-package-template==0.2.0rc1.dev6')
127+
upip.install('micropython-ds1307')
133128
```
134129

135130
See also [brainelectronics Test PyPi Server in Docker][ref-brainelectronics-test-pypiserver]
@@ -154,9 +149,9 @@ folders to the device
154149

155150
```bash
156151
mkdir /pyboard/lib
157-
mkdir /pyboard/lib/be_upy_blink
152+
mkdir /pyboard/lib/ds1307
158153

159-
cp be_upy_blink/* /pyboard/lib/be_upy_blink
154+
cp ds1307/* /pyboard/lib/ds1307
160155

161156
cp examples/main.py /pyboard
162157
cp examples/boot.py /pyboard
@@ -165,58 +160,31 @@ cp examples/boot.py /pyboard
165160
## Usage
166161

167162
```python
168-
from be_upy_blink import flash_led
169-
from machine import Pin
163+
from eeprom import DS1307
164+
from machine import I2C, Pin
165+
from time import gmtime
170166

171-
led_pin = Pin(4, Pin.OUT)
167+
I2C_ADDR = 0x68
172168

173-
flash_led(pin=led_pin, amount=3)
174-
# flash_led(pin=led_pin, amount=3, on_time=1, off_time=3)
175-
```
176-
177-
## Create a PyPi (micropython) package
178-
179-
### Setup
180-
181-
Install the required python package with the following command in a virtual
182-
environment to avoid any conflicts with other packages installed on your local
183-
system.
184-
185-
```bash
186-
python3 -m venv .venv
187-
source .venv/bin/activate
169+
# define custom I2C interface, default is 'I2C(0)'
170+
# check the docs of your device for further details and pin infos
171+
# this are the pins for the Raspberry Pi Pico adapter board
172+
i2c = I2C(0, scl=Pin(13), sda=Pin(12), freq=800000)
173+
ds1307 = DS1307(addr=I2C_ADDR, i2c=i2c) # DS1307 on 0x68
188174

189-
pip install twine
190-
```
175+
# get the current RTC time
176+
print("Current RTC time: {}".format(ds1307.datetime))
191177

192-
### Create a distribution
178+
# set the RTC time to the current system time
179+
now = gmtime(time())
180+
ds1307.datetime = now
193181

194-
This module overrides distutils (also compatible with setuptools) `sdist`
195-
command to perform pre- and post-processing as required for MicroPython's
196-
upip package manager. This script is taken from
197-
[pfalcon's picoweb][ref-pfalcon-picoweb-sdist-upip] and updated to be PEP8
198-
conform.
182+
print("Current RTC time: {}".format(ds1307.datetime))
199183

200-
```bash
201-
python setup.py sdist
202-
```
203-
204-
A new folder `dist` will be created. The [`sdist_upip`](sdist_upip.py) will be
205-
used to create everything necessary.
206-
207-
### Upload to PyPi
208-
209-
**Be aware: [pypi.org][ref-pypi] and [test.pypi.org][ref-test-pypi] are different**
210-
211-
You can **NOT** login to [test.pypi.org][ref-test-pypi] with the
212-
[pypi.org][ref-pypi] account unless you created the same on the other. See
213-
[invalid auth help page of **test** pypi][ref-invalid-auth-test-pypi]
214-
215-
For testing purposes add `--repository testpypi` to
216-
upload it to [test.pypi.org][ref-test-pypi]
217-
218-
```bash
219-
twine upload dist/micropython-package-template-*.tar.gz -u PYPI_USERNAME -p PYPI_PASSWORD
184+
# Print the date and time in ISO8601 format: 2023-04-18T21:14:22
185+
print("Today is {:04d}-{:02d}-{:02d}T{:02d}:{:02d}:{:02d}".format(
186+
ds1307.year, ds1307.month, ds1307.day,
187+
ds1307.hour, ds1307.minute, ds1307.second))
220188
```
221189

222190
## Contributing
@@ -231,7 +199,7 @@ package in a virtual environment
231199
nose2 --config tests/unittest.cfg
232200

233201
# run only one specific tests
234-
nose2 tests.test_blink.TestBlink.test_flash_led
202+
nose2 tests.test_ds1307.TestDS1307.test_addr
235203
```
236204

237205
Generate the coverage files with
@@ -243,37 +211,17 @@ coverage html
243211

244212
The coverage report is placed at `reports/coverage/html/index.html`
245213

246-
## Steps after using this template
247-
248-
In order to use this template for a new MicroPython package to following steps
249-
should be done and changes to these file being made
250-
251-
| File | Changes | More details |
252-
| ---- | ------- | -------------|
253-
| `.coveragerc` | Path to `version.py` file | Omit version file from coverage |
254-
| `.coveragerc` | Path to `include` folder | Include the package folder for coverage |
255-
| `.github/workflows/release.yml` | Path to `version.py` file | Use package version file to set changelog based version |
256-
| `.github/workflows/test-release.yml` | Path to `version.py` file | Use package version file to set changelog based version |
257-
| `.github/workflows/test.yml` | Path to `version.py` file | Use package version file to set changelog based version |
258-
| `README.md` | Links in header section and installation instructions | |
259-
| `changelog.md` | Cleanup changelog from informations of template | Keep usage of SemVer |
260-
| `docs/DOCUMENTATION.md` | Kink to ReadTheDocs | |
261-
| `docs/conf.py` | List to modules to be mocked, package import, path to `version.py` file, update `author`, `project` and `linkcheck_ignore` | |
262-
| `docs/index.rst` | Header name and included modules | Replace `be_upy_blink` with new `.rst` file of new package |
263-
| `docs/NEW_MODULE_NAME.rst` | Create a new `.rst` file named as the package | Use `docs/be_upy_blink.rst` as template |
264-
| `package.json` | Files and paths to new package and repo | Used by `mip` |
265-
| `setup.py` | Path to `version.py` file, `name`, `description`, `url`, `author`, `author_email`, `keywords`, `project_urls`, `packages`, `install_requires` | Used to create the package and its informations published at e.g. PyPI |
266-
267214
## Credits
268215

269-
Based on the [PyPa sample project][ref-pypa-sample].
216+
Based on
217+
[Mike Causer's MicroPython TinyRTC I2C module][ref-micropython-tinyrtc-i2c]
218+
and the [PyPa sample project][ref-pypa-sample]
270219

271220
<!-- Links -->
272-
[ref-rtd-micropython-package-template]: https://micropython-package-template.readthedocs.io/en/latest/
221+
[ref-rtd-micropython-ds1307]: https://micropython-ds1307.readthedocs.io/en/latest/
273222
[ref-remote-upy-shell]: https://github.com/dhylands/rshell
274223
[ref-brainelectronics-test-pypiserver]: https://github.com/brainelectronics/test-pypiserver
224+
[ref-micropython-tinyrtc-i2c]: https://github.com/mcauser/micropython-tinyrtc-i2c
275225
[ref-pypa-sample]: https://github.com/pypa/sampleproject
276-
[ref-pfalcon-picoweb-sdist-upip]: https://github.com/pfalcon/picoweb/blob/b74428ebdde97ed1795338c13a3bdf05d71366a0/sdist_upip.py
277226
[ref-test-pypi]: https://test.pypi.org/
278227
[ref-pypi]: https://pypi.org/
279-
[ref-invalid-auth-test-pypi]: https://test.pypi.org/help/#invalid-auth

changelog.md

Lines changed: 7 additions & 107 deletions
Original file line numberDiff line numberDiff line change
@@ -17,118 +17,18 @@ r"^\#\# \[\d{1,}[.]\d{1,}[.]\d{1,}\] \- \d{4}\-\d{2}-\d{2}$"
1717
-->
1818

1919
## Released
20-
## [0.8.0] - 2023-03-29
20+
## [0.1.0] - 2023-05-01
2121
### Added
22-
- Add `MicoPython` as `Implementation` in setup `classifiers`, see [#16](https://github.com/brainelectronics/micropython-package-template/issues/16)
23-
- Verify `package.json` against latest changelog and setup in test workflow, see [#17](https://github.com/brainelectronics/micropython-package-template/issues/17)
24-
25-
## [0.7.0] - 2023-03-17
26-
### Added
27-
- Set settings for JSON files to use an indentation of 4 in `.editorconfig`
28-
- `package.json` for `mip` installation with MicroPython v1.19.1 or newer
29-
- Instructions for installation with `mip` on MicroPython v1.19.1 or newer in `README`
30-
- Instructions to be performed after using this template package in `README`
31-
- Example files for `boot` and `main`
22+
- `ds1307.py` in `ds1307` module
23+
- Examples and documentation
3224

3325
### Changed
34-
- Omit package version file from coverage calculation in `.coveragerc`
35-
- Run test workflow also on pull requests
36-
- Update date of license to 2023
26+
- Several updates on setup and config files different than the template repo
3727

3828
### Removed
39-
- No longer used `update_version.py` file removed from flake8 exclude list
40-
41-
### Fixed
42-
- Path to documentation build output folder is only highlighted to avoid broken links errors
43-
- Mock commonly used MicroPython specific modules in docs config file
44-
45-
## [0.6.0] - 2023-02-22
46-
### Added
47-
- `.editorconfig` for common editor settings, see #12
48-
- `.yamllint` to lint all used YAML files, see #12
49-
- `codecov.yaml` to specify further settings and limits for the coverage
50-
- `yamllint` package to the `requirements-test.txt` file
51-
- Run YAML linter on test workflow
52-
53-
### Changed
54-
- Fixed uncovered YAML syntax issues in all workflow files
55-
- Removed unused files from `.gitignore` file
56-
57-
## [0.5.0] - 2023-02-20
58-
### Added
59-
- `.readthedocs.yaml` definition file for ReadTheDocs, see #10
60-
- `docs` folder containing example files and configurations, see #10
61-
62-
## [0.4.0] - 2023-02-20
63-
### Added
64-
- `test-release` and `release` workflows create changelog based (pre-)releases, see #2
65-
- Documentation for manually creating a package and uploading it to PyPi in root README
66-
67-
### Fixed
68-
- All workflows use checkout v3 instead of v2
69-
70-
## [0.3.0] - 2022-11-03
71-
### Added
72-
- Lint package with `flake8` with [test workflow](.github/workflows/test.yaml)
73-
- CI upload status badge added to [`README`](README.md)
74-
75-
### Fixed
76-
- Remove not required packages `setuptools`, `wheel` and `build` from release
77-
and test-release workflow files
78-
- Show download of this package on badge instead of `be-modbus-wrapper`
79-
- Show `MicroPython Ok` badge instead of `Python3 Ok` in [`README`](README.md)
80-
81-
## [0.2.0] - 2022-10-22
82-
### Added
83-
- Deploy to [Test Python Package Index](https://test.pypi.org/) on every PR
84-
build with a [PEP440][ref-pep440] compliant `-rc<BUILDNUMBER>.dev<PR_NUMBER>`
85-
meta data extension, see [#5][ref-issue-5]
86-
- [Test release workflow](.github/workflows/test-release.yaml) running only on
87-
PRs is archiving and uploading built artifacts to
88-
[Test Python Package Index](https://test.pypi.org/)
89-
90-
### Changed
91-
- Built artifacts are no longer archived by the always running
92-
[test workflow](.github/workflows/test.yaml)
93-
94-
## [0.1.1] - 2022-10-16
95-
### Fixed
96-
- Move `src/be_upy_blink` to `be_upy_blink` to avoid installations into `/lib/src/be_upy_blink` on a uPy board via `upip`, see [#3][ref-issue-3]
97-
- Adjust all paths to `be_upy_blink` folder and contained files
98-
99-
## [0.1.0] - 2022-10-16
100-
### Added
101-
- This changelog file
102-
- [`.coveragerc`](.coveragerc) file
103-
- [`.flake8`](.flake8) file
104-
- [`.gitignore`](.gitignore) file bases on latest
105-
[Python gitignore template][ref-python-gitignore-template]
106-
- Default [workflows](.github/workflows)
107-
- Script to [create report directories](create_report_dirs.py)
108-
- [`unittest.cfg`](tests/unittest.cfg) file
109-
- [`requirements.txt`](requirements.txt) file to interact with the uPy board
110-
- [`requirements-test.txt`](requirements-test.txt) file to install packages for unittests
111-
- [`requirements-deploy.txt`](requirements-deploy.txt) file to install packages to deploy
112-
- Initial [`be_upy_blink`](src/be_upy_blink) package
113-
- Basic [`unittests`](tests) for package source code
114-
- Initial root [`README`](README.md)
115-
- [`setup.py`](setup.py) and [`sdist_upip.py`](sdist_upip.py) file
29+
- Not used files provided with [template repo](https://github.com/brainelectronics/micropython-i2c-lcd)
11630

11731
<!-- Links -->
118-
[Unreleased]: https://github.com/brainelectronics/micropython-package-template/compare/0.8.0...main
119-
120-
[0.8.0]: https://github.com/brainelectronics/micropython-package-template/tree/0.8.0
121-
[0.7.0]: https://github.com/brainelectronics/micropython-package-template/tree/0.7.0
122-
[0.6.0]: https://github.com/brainelectronics/micropython-package-template/tree/0.6.0
123-
[0.5.0]: https://github.com/brainelectronics/micropython-package-template/tree/0.5.0
124-
[0.4.0]: https://github.com/brainelectronics/micropython-package-template/tree/0.4.0
125-
[0.3.0]: https://github.com/brainelectronics/micropython-package-template/tree/0.3.0
126-
[0.2.0]: https://github.com/brainelectronics/micropython-package-template/tree/0.2.0
127-
[0.1.1]: https://github.com/brainelectronics/micropython-package-template/tree/0.1.1
128-
[0.1.0]: https://github.com/brainelectronics/micropython-package-template/tree/0.1.0
129-
130-
[ref-issue-5]: https://github.com/brainelectronics/micropython-package-template/issues/5
131-
[ref-issue-3]: https://github.com/brainelectronics/micropython-package-template/issues/3
32+
[Unreleased]: https://github.com/brainelectronics/micropython-ds1307/compare/0.1.0...main
13233

133-
[ref-pep440]: https://peps.python.org/pep-0440/
134-
[ref-python-gitignore-template]: https://github.com/github/gitignore/blob/e5323759e387ba347a9d50f8b0ddd16502eb71d4/Python.gitignore
34+
[0.1.0]: https://github.com/brainelectronics/micropython-ds1307/tree/0.1.0

0 commit comments

Comments
 (0)