Skip to content

Commit

Permalink
Use pyproject.toml to install utilix (#126)
Browse files Browse the repository at this point in the history
* Use `pyproject.toml` to install utilix

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Remove usage of setup.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Minor change

* Add utilix authors

* To include all files in `utilix` folder

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
dachengx and pre-commit-ci[bot] authored Sep 21, 2024
1 parent f2a9956 commit 9d87d87
Show file tree
Hide file tree
Showing 7 changed files with 65 additions and 32 deletions.
6 changes: 5 additions & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
[bumpversion]
current_version = 0.8.5
files = setup.py utilix/__init__.py
files = utilix/__init__.py
commit = True
tag = True

[bumpversion:file:pyproject.toml]
search = version = "{current_version}"
replace = version = "{new_version}"
4 changes: 2 additions & 2 deletions .github/workflows/pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ jobs:
- name: Checkout repo
uses: actions/checkout@v2
- name: Install dependencies
run: pip install wheel
run: pip install build
- name: Build package
run: python setup.py sdist bdist_wheel
run: python -m build
# Do the publish
- name: Publish a Python distribution to PyPI
# Might want to add but does not work on workflow_dispatch :
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/test_package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ jobs:
- name: Install python dependencies
uses: py-actions/py-dependency-install@v2
- name: Install utilix
run: python setup.py install
run: |
pip install pytest hypothesis coverage coveralls
pip install . --force-reinstall
- name: Install pytest and hypothesis
run: pip install pytest hypothesis flake8 pytest-cov
- name: Test package
Expand Down
2 changes: 2 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ repos:
rev: v1.7.5
hooks:
- id: docformatter
additional_dependencies: [tomli]
args: [--config, pyproject.toml]

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.11.2
Expand Down
48 changes: 48 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
[tool]
[tool.poetry]
name = "utilix"
version = "0.8.5"
description = "User-friendly interface to various utilities for XENON users"
readme = "README.md"
authors = [
"utilix developers",
]
classifiers = [
"Development Status :: 5 - Production/Stable",
"License :: OSI Approved :: BSD License",
"Natural Language :: English",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Intended Audience :: Science/Research",
"Programming Language :: Python :: Implementation :: CPython",
"Topic :: Scientific/Engineering :: Physics",
]
repository = "https://github.com/XENONnT/utilix"
packages = [
{ include = "utilix" }
]

[tool.poetry.dependencies]
python = ">=3.8,<3.13"
pymongo = "*"
requests = "*"
tqdm = "*"
pandas = "*"
commentjson = "*"
simple_slurm = "*"
pydantic = ">=1.10,<2.0"

[build-system]
requires = ["poetry-core>=1.0.8", "setuptools>=61.0"]
build-backend = "poetry.core.masonry.api"

[tool.black]
line-length = 100
preview = true

[tool.docformatter]
recursive = true
in-place = true
wrap-summaries = 100
wrap-descriptions = 100
blank = true
23 changes: 0 additions & 23 deletions setup.py

This file was deleted.

10 changes: 5 additions & 5 deletions utilix/mongo_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def __init__(self, config_identifier="config_name", **kwargs):
def get_query_config(self, config):
"""Generate identifier to query against. This is just the configs name.
:param config: str, name of the file of interest
:param config: str, name of the file of interest
:return: dict, that can be used in queries
"""
Expand All @@ -55,7 +55,7 @@ def get_query_config(self, config):
def document_format(self, config):
"""Format of the document to upload.
:param config: str, name of the file of interest
:param config: str, name of the file of interest
:return: dict, that will be used to add the document
"""
Expand Down Expand Up @@ -142,7 +142,7 @@ def _check_store_files_at(cache_folder_alternatives):
Order does matter as we iterate until we find one folder that is willing.
:param cache_folder_alternatives: tuple, this tuple must be a list of paths one can try to
store the downloaded data
store the downloaded data.
:return: str, the folder that we can write to.
"""
Expand Down Expand Up @@ -232,7 +232,7 @@ def __init__(
def config_exists(self, config):
"""Quick check if this config is already saved in the collection.
:param config: str, name of the file of interest
:param config: str, name of the file of interest
:return: bool, is this config name stored in the database
"""
Expand Down Expand Up @@ -431,7 +431,7 @@ def __init__(self, config_identifier="config_name"):
def config_exists(self, config):
"""Quick check if this config is already saved in the collection.
:param config: str, name of the file of interest
:param config: str, name of the file of interest
:return: bool, is this config name stored in the database
"""
Expand Down

0 comments on commit 9d87d87

Please sign in to comment.