Skip to content

Commit cf056fa

Browse files
authored
Merge pull request #2 from dclong/dev
merge
2 parents 676a3fa + e4d7924 commit cf056fa

File tree

5 files changed

+29
-5
lines changed

5 files changed

+29
-5
lines changed

.gitpod.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
image: dclong/gitpod-py3
2+
ports:
3+
- port: 8000
4+
tasks:
5+
- command: nvim --headless +"call dein#install()" +qall

dsutil/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@
99
from . import text
1010
from . import url
1111

12-
__version__ = "0.9.1"
12+
__version__ = "0.9.2"

dsutil/poetry.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,17 @@
1515
TOML = 'pyproject.toml'
1616

1717

18+
def _project_dir():
19+
path = Path.cwd()
20+
while path.parent != path:
21+
if (path / TOML).is_file():
22+
return path
23+
path = path.parent
24+
raise RuntimeError(
25+
f'The current work directory {Path.cwd()} is not a (subdirectory of a) Python Poetry project.'
26+
)
27+
28+
1829
def _update_version_readme(ver: str, pkg: str):
1930
"""Update the version information in readme.
2031
:param ver: The new version.
@@ -63,6 +74,7 @@ def version(
6374
If empty, then the current version of the package is printed.
6475
:param pkg: The name of the package.
6576
"""
77+
os.chdir(_project_dir())
6678
if not pkg:
6779
pkg = Path.cwd().name
6880
if ver:
@@ -95,6 +107,7 @@ def build_package(dst_dir: str = '', pkg: str = '') -> None:
95107
:param dst_dir: The root directory of the project.
96108
:param pkg: The name of the package.
97109
"""
110+
os.chdir(_project_dir())
98111
if not pkg:
99112
pkg = Path.cwd().name
100113
if os.path.exists(DIST):
@@ -122,6 +135,7 @@ def install_package(options: List[str] = ()):
122135
"""Install the built package.
123136
:param options: A list of options to pass to pip3.
124137
"""
138+
os.chdir(_project_dir())
125139
pkg = glob.glob('dist/*.whl')
126140
if not pkg:
127141
logger.error('No built package is found!')

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "dsutil"
3-
version = "0.9.1"
3+
version = "0.9.2"
44
description = "A utils Python package for data scientists."
55
authors = ["Benjamin Du <[email protected]>"]
66

readme.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,16 @@ This is a Python pacakage that contains misc utils for Data Science.
1616
- html
1717
- misc
1818
19+
## Requirements
20+
`dsutil` requires Python 3.6+.
1921
2022
## Installation
2123
22-
`dsutil` requires Python 3.6+. Download the latest
23-
[release of dsutil](https://github.com/dclong/dsutil/releases) and use the following command to install it.
24+
You can download a copy of the latest release and install it using pip.
2425
```
25-
pip3 install --user --upgrade dsutil-0.9.1-py3-none-any.whl
26+
pip3 install --user -U dsutil-0.9.2-py3-none-any.whl
27+
```
28+
Or you can use the following script to download and install the latest version automatically.
29+
```
30+
curl -sSL www.legendu.net/media/install_py_github.py | python3 - https://github.com/dclong/dsutil
2631
```

0 commit comments

Comments
 (0)