Skip to content

Commit

Permalink
create setting dir and file after installing this package
Browse files Browse the repository at this point in the history
  • Loading branch information
OuyangWenyu committed Feb 14, 2024
1 parent 24e2089 commit 30d6926
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.x"
python-version: "3.10"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
Expand Down
8 changes: 6 additions & 2 deletions environment-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ dependencies:
- minio
- s3fs=2023.10
# for dev
- pip
- bump2version
- wheel
- watchdog
Expand All @@ -31,4 +30,9 @@ dependencies:
- twine
- grip
- pytest
- pytest-runner
- pytest-runner

# for pypi package
- pip
- pip:
- appdirs
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ rich
boto3~=1.28.64
minio
s3fs~=2023.10
appdirs
1 change: 1 addition & 0 deletions requirements_dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,4 @@ rich
boto3==1.28.64
minio
s3fs==2023.10
appdirs
29 changes: 23 additions & 6 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,20 @@
"""
Author: Wenyu Ouyang
Date: 2022-12-02 10:42:19
LastEditTime: 2023-07-31 17:11:11
LastEditTime: 2024-02-14 12:12:06
LastEditors: Wenyu Ouyang
Description: The setup script.
FilePath: /hydroutils/setup.py
FilePath: \hydroutils\setup.py
Copyright (c) 2023-2024 Wenyu Ouyang. All rights reserved.
"""


import io
import pathlib
import appdirs
from os import path as op
from setuptools import setup, find_packages
from setuptools.command.install import install

readme = pathlib.Path("README.md").read_text()
here = op.abspath(op.dirname(__file__))
Expand All @@ -35,18 +37,30 @@
"pytest>=3",
]


class PostInstallCommand(install):
def run(self):
install.run(self)
# Define cache and config paths
setting_dir = pathlib.Path.home()
cache_dir = appdirs.user_cache_dir(".hydro")
if not cache_dir.is_dir():
cache_dir.mkdir(parents=True)
setting_file = setting_dir.joinpath("hydro_setting.yml")
if not setting_file.is_file():
setting_file.touch(exist_ok=False)


setup(
author="Wenyu Ouyang",
author_email="[email protected]",
python_requires=">=3.7",
python_requires=">=3.9",
classifiers=[
"Development Status :: 2 - Pre-Alpha",
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Natural Language :: English",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
],
Expand All @@ -69,6 +83,9 @@
test_suite="tests",
tests_require=test_requirements,
url="https://github.com/OuyangWenyu/hydroutils",
version='0.0.7',
version="0.0.7",
zip_safe=False,
cmdclass={
"install": PostInstallCommand,
},
)

0 comments on commit 30d6926

Please sign in to comment.