Skip to content

Commit

Permalink
Devops: Move the source directory into src/ (#329)
Browse files Browse the repository at this point in the history
This package directory structure is fast becoming the standard in the
Python packaging community. Even though the PyPA is not yet officially
recommending it as the standard, there are various articles out there
outlining the advantages of this structure over having the source folder
at the root of the repository.
  • Loading branch information
sphuber authored Feb 26, 2024
1 parent c18ff2e commit f7118b1
Show file tree
Hide file tree
Showing 125 changed files with 9 additions and 18 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/validate_release_tag.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ def get_version_from_module(content: str) -> str:
TAG_PREFIX = 'refs/tags/v'
assert args.GITHUB_REF.startswith(TAG_PREFIX), f'GITHUB_REF should start with "{TAG_PREFIX}": {args.GITHUB_REF}'
tag_version = args.GITHUB_REF[len(TAG_PREFIX) :]
package_version = get_version_from_module(Path('aiida_common_workflows/__init__.py').read_text(encoding='utf-8'))
package_version = get_version_from_module(
Path('src/aiida_common_workflows/__init__.py').read_text(encoding='utf-8')
)
error_message = f'The tag version `{tag_version}` is different from the package version `{package_version}`'
assert tag_version == package_version, error_message
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,9 @@ select = [
[tool.ruff.format]
quote-style = 'single'

[tool.ruff.lint.isort]
known-first-party = ['src']

[tool.pytest.ini_options]
testpaths = [
'tests',
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 0 additions & 1 deletion tests/cli/test_launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

import click
import pytest

from aiida_common_workflows.cli import launch, utils


Expand Down
3 changes: 1 addition & 2 deletions tests/cli/test_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,14 @@
import click
import pytest
from aiida import orm

from aiida_common_workflows.cli import options


@pytest.fixture
def filepath_cif():
"""Return a path to a valid CIF file."""
basepath = pathlib.Path(__file__).parent.parent.parent
filepath = basepath.joinpath('aiida_common_workflows', 'common', 'data', 'Si.cif')
filepath = basepath.joinpath('src', 'aiida_common_workflows', 'common', 'data', 'Si.cif')
return filepath


Expand Down
1 change: 0 additions & 1 deletion tests/cli/test_plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

import matplotlib.pyplot as plt
import pytest

from aiida_common_workflows.cli import plot


Expand Down
1 change: 0 additions & 1 deletion tests/cli/test_utils.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# -*- coding: utf-8 -*-
"""Tests for the :mod:`aiida_common_workflows.cli.utils` module."""
import pytest

from aiida_common_workflows.cli.utils import get_code_from_list_or_database


Expand Down
1 change: 0 additions & 1 deletion tests/generators/test_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import pytest
from aiida import orm
from aiida.plugins import WorkflowFactory

from aiida_common_workflows.generators import InputGenerator


Expand Down
1 change: 0 additions & 1 deletion tests/protocol/test_registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import typing as t

import pytest

from aiida_common_workflows.protocol import ProtocolRegistry


Expand Down
1 change: 0 additions & 1 deletion tests/workflows/bands/test_implementations.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

import pytest
from aiida import engine, orm, plugins

from aiida_common_workflows.generators.ports import InputGeneratorPort
from aiida_common_workflows.plugins import get_workflow_entry_point_names
from aiida_common_workflows.workflows.bands.workchain import CommonBandsWorkChain
Expand Down
1 change: 0 additions & 1 deletion tests/workflows/bands/test_workchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"""Tests for the :mod:`aiida_common_workflows.workflows.bands.workchain` module."""
import pytest
from aiida.plugins import WorkflowFactory

from aiida_common_workflows.plugins import get_workflow_entry_point_names
from aiida_common_workflows.workflows.bands import CommonBandsInputGenerator
from aiida_common_workflows.workflows.bands.workchain import CommonBandsWorkChain
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
from aiida import orm
from aiida.engine import WorkChain
from aiida.plugins import WorkflowFactory

from aiida_common_workflows.plugins import get_workflow_entry_point_names
from aiida_common_workflows.workflows import dissociation
from aiida_common_workflows.workflows.relax.workchain import CommonRelaxWorkChain
Expand Down
1 change: 0 additions & 1 deletion tests/workflows/eos/test_workchain_eos.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
from aiida import orm
from aiida.engine import WorkChain
from aiida.plugins import WorkflowFactory

from aiida_common_workflows.plugins import get_workflow_entry_point_names
from aiida_common_workflows.workflows import eos
from aiida_common_workflows.workflows.relax.generator import RelaxType
Expand Down
3 changes: 1 addition & 2 deletions tests/workflows/relax/test_castep.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
from aiida.orm import StructureData
from aiida.plugins import WorkflowFactory
from aiida_castep.data.otfg import OTFGGroup
from ase.build.bulk import bulk

from aiida_common_workflows.workflows.relax.castep.generator import (
CastepCommonRelaxInputGenerator,
ElectronicType,
Expand All @@ -22,6 +20,7 @@
generate_inputs_relax,
)
from aiida_common_workflows.workflows.relax.castep.workchain import CastepCommonRelaxWorkChain
from ase.build.bulk import bulk

WORKCHAIN = plugins.WorkflowFactory('common_workflows.relax.castep')
GENERATOR = WORKCHAIN.get_input_generator()
Expand Down
1 change: 0 additions & 1 deletion tests/workflows/relax/test_implementations.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

import pytest
from aiida import engine, orm, plugins

from aiida_common_workflows.common.types import ElectronicType, RelaxType, SpinType
from aiida_common_workflows.generators.ports import InputGeneratorPort
from aiida_common_workflows.plugins import get_workflow_entry_point_names
Expand Down
3 changes: 1 addition & 2 deletions tests/workflows/relax/test_quantum_espresso.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@

import pytest
from aiida import engine, plugins
from qe_tools import CONSTANTS

from aiida_common_workflows.workflows.relax.generator import ElectronicType, RelaxType, SpinType
from qe_tools import CONSTANTS

WORKCHAIN = plugins.WorkflowFactory('common_workflows.relax.quantum_espresso')
GENERATOR = WORKCHAIN.get_input_generator()
Expand Down
1 change: 0 additions & 1 deletion tests/workflows/relax/test_workchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"""Tests for the :mod:`aiida_common_workflows.workflows.relax.workchain` module."""
import pytest
from aiida.plugins import WorkflowFactory

from aiida_common_workflows.plugins import get_workflow_entry_point_names
from aiida_common_workflows.workflows.relax import CommonRelaxInputGenerator
from aiida_common_workflows.workflows.relax.workchain import CommonRelaxWorkChain
Expand Down

0 comments on commit f7118b1

Please sign in to comment.