Skip to content

Commit

Permalink
refactor project directory
Browse files Browse the repository at this point in the history
  • Loading branch information
Ken Kundert authored and Ken Kundert committed Sep 6, 2022
1 parent 5e21812 commit f6c997a
Show file tree
Hide file tree
Showing 7 changed files with 69 additions and 69 deletions.
8 changes: 4 additions & 4 deletions doc/user.rst
Original file line number Diff line number Diff line change
Expand Up @@ -677,10 +677,10 @@ the new value to create a new Quantity. For example:
8.9247 GHz
>>> type(h_line)
<class 'quantiphy.Quantity'>
<class 'quantiphy.quantiphy.Quantity'>
>>> type(sagan)
<class 'quantiphy.Quantity'>
<class 'quantiphy.quantiphy.Quantity'>
Any value that can be passed to the *scale* argument for :class:`Quantity` or
:meth:`Quantity.render` can be passed to the *scale* method. Specifically, the
Expand Down Expand Up @@ -773,13 +773,13 @@ numeric value:
8.9247 GHz
>>> type(h_line)
<class 'quantiphy.Quantity'>
<class 'quantiphy.quantiphy.Quantity'>
>>> type(second_sagan_freq)
<class 'float'>
>>> type(sagan2)
<class 'quantiphy.Quantity'>
<class 'quantiphy.quantiphy.Quantity'>
Notice that when performing arithmetic operations on quantities the units
are completely ignored and do not propagate in any way to the newly computed
Expand Down
41 changes: 41 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
[project]
name = "quantiphy"
version = "2.18.0"
description = "physical quantities (numbers with units)"
readme = "README.rst"
license = {file = "LICENSE"}
keywords = [
"quantities",
"physical quantity",
"units",
"SI scale factors",
"engineering notation",
"mks",
"cgs"
]
authors = [
{name = "Ken Kundert"},
{email = "quantiphy@nurdletech.com"}
]
classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: MIT License",
"Natural Language :: English",
"Operating System :: POSIX :: Linux",
"Programming Language :: Python :: 3",
"Topic :: Utilities",
"Topic :: Scientific/Engineering",
]
requires-python = ">=3.6"

[project.urls]
homepage = "https://quantiphy.readthedocs.io"
documentation = "quantiphy.readthedocs.io"
repository = "https://github.com/kenkundert/quantiphy"
changelog = "https://github.com/kenkundert/quantiphy/doc/releases.html"

[build-system]
requires = ["flit_core >=2,<4"]
build-backend = "flit_core.buildapi"
42 changes: 0 additions & 42 deletions setup.py

This file was deleted.

20 changes: 20 additions & 0 deletions src/quantiphy/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
from .quantiphy import (
QuantiPhyError, # exceptions
ExpectedQuantity,
IncompatibleUnits,
InvalidNumber,
InvalidRecognizer,
MissingName,
UnknownConversion,
UnknownFormatKey,
UnknownPreference,
UnknownScaleFactor,
UnknownUnitSystem,
IncompatiblePreferences,
UnitConversion, # unit conversions
set_unit_system,
add_constant, # constants
Quantity, # quantities
__version__, # version
__released__,
)
18 changes: 0 additions & 18 deletions quantiphy.py → src/quantiphy/quantiphy.py
Original file line number Diff line number Diff line change
Expand Up @@ -365,24 +365,6 @@ def add_constant(value, alias=None, unit_systems=None):
# Globals {{{1
__version__ = '2.18.0'
__released__ = '2022-08-31'
__all__ = '''
QuantiPhyError
ExpectedQuantity
IncompatibleUnits
InvalidNumber
InvalidRecognizer
MissingName
UnknownConversion
UnknownFormatKey
UnknownPreference
UnknownScaleFactor
UnknownUnitSystem
IncompatiblePreferences
UnitConversion
set_unit_system
add_constant
Quantity
'''.split()

# These mappings are only used when reading numbers
# The key for these mappings must be a single character
Expand Down
2 changes: 1 addition & 1 deletion tests/test_doctests.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def test_quantiphy():
# code used in doctests assumes python3.6
return
Quantity.reset_prefs()
rv = doctest.testfile('../quantiphy.py', optionflags=doctest.ELLIPSIS)
rv = doctest.testfile('../src/quantiphy/quantiphy.py', optionflags=doctest.ELLIPSIS)
assert rv.failed == 0
assert rv.attempted == 119
# this target should be updated when the number of doctests change
Expand Down
7 changes: 3 additions & 4 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
[tox]
envlist = lint,pytest

isolated_build = True

[testenv:lint]
deps = pylama
skip_install = true
commands = pylama quantiphy.py --ignore E226,E501,C901,E116,E251,E203

commands = pylama --ignore E226,E501,C901,E116,E251,E203 src/quantiphy/*.py

# Test environment
[testenv:pytest]
[testenv]
deps =
pytest
pytest-cov
Expand Down

0 comments on commit f6c997a

Please sign in to comment.