https://github.com/rtmigo/tsfile_py
Python package for solving a specific task: reading the date stored in a timestamp.txt.
https://github.com/rtmigo/tsfile_py
Last synced: 13 days ago
JSON representation
Python package for solving a specific task: reading the date stored in a timestamp.txt.
- Host: GitHub
- URL: https://github.com/rtmigo/tsfile_py
- Owner: rtmigo
- License: mit
- Created: 2021-05-07T19:43:33.000Z (over 4 years ago)
- Default Branch: staging
- Last Pushed: 2021-05-07T21:49:09.000Z (over 4 years ago)
- Last Synced: 2025-01-21T15:32:12.447Z (12 months ago)
- Language: Python
- Homepage:
- Size: 24.4 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Python package for solving a specific task: reading the date stored in
a `timestamp.txt`.
# Install
``` bash
$ pip install git+https://github.com/rtmigo/tsfile_py#egg=tsfile
```
## timestamp.txt
Sample content `my_project/timestamp.txt`:
``` text
2021-05-07 22:01:44 +03
```
For example, such file can be created before deploying the project with as command:
``` bash
date +"%Y-%m-%d %H:%M:%S %Z" > /path/to/my_project/timestamp.txt
```
## TimestampFile object
When created, the `TimestampFile` object scans the parent directories. The
search stops when the parent contains a `timestamp.txt`.
That is, you can create a `TimestampFile` in any module located in any
subdirectory of `my_project`. For example, in `my_project/dir/subdir/module.py`:
``` python
from tsfile import TimestampFile
build_timestamp = TimestampFile()
print(build_timestamp.text) # '2021-05-07 22:01:44 +03'
print(build_timestamp.time) # datetime.datetime
print(build_timestamp.version) # '21.253.835' (generated from timestamp)
```