Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: adapt package organisation #1059

Draft
wants to merge 9 commits into
base: fix-build
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
- run:
name: Install dependencies
command: |
make install-deps
make clean install-deps
# pip install --editable git+https://github.com/openfisca/country-template.git@BRANCH_NAME#egg=OpenFisca-Country-Template # use a specific branch of OpenFisca-Country-Template
# pip install --editable git+https://github.com/openfisca/extension-template.git@BRANCH_NAME#egg=OpenFisca-Extension-Template # use a specific branch of OpenFisca-Extension-Template

Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

### 35.5.4 [#1059](https://github.com/openfisca/openfisca-core/pull/1059)

#### Non-technical changes

- Move published code to `src`.
- Use `setup.cfg` for metadata.

### 35.5.3 [#1058](https://github.com/openfisca/openfisca-core/pull/1058)

#### Non-technical changes
Expand Down
4 changes: 2 additions & 2 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
recursive-include openfisca_core/scripts *
include openfisca_web_api/openAPI.yml
recursive-include src *
global-exclude *.py[cod]
52 changes: 44 additions & 8 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,20 +1,56 @@
; E128/133: We prefer hang-closing visual indents
; E251: We prefer `function(x = 1)` over `function(x=1)`
; E501: We do not enforce a maximum line length
; F403/405: We ignore * imports
; W503/504: We break lines before binary operators (Knuth's style)
[metadata]
name = OpenFisca-Core
version = 35.5.4
author = OpenFisca Team
author_email = [email protected]
license = https://www.fsf.org/licensing/licenses/agpl-3.0.html
license_files = file: LICENSE
url = https://github.com/openfisca/openfisca-core
keywords = benefit, microsimulation, social, tax
description = A versatile microsimulation free software
long_description = file: README.md, CONTRIBUTING.md, STYLEGUIDE.md, CHANGELOG.md
classifiers =
Development Status :: 5 - Production/Stable
License :: OSI Approved :: GNU Affero General Public License v3
Operating System :: POSIX
Programming Language :: Python
Programming Language :: Python :: 3.6
Programming Language :: Python :: 3.7
Topic :: Scientific/Engineering :: Information Analysis

[options]
packages = find:
package_dir = = src
include_package_data = True
python_requires = >= 3.6

[options.packages.find]
where = src

[options.entry_points]
console_scripts =
openfisca = openfisca_core.scripts.openfisca_command:main
openfisca-run-test = openfisca_core.scripts.openfisca_command:main

[coverage:run]
disable_warnings = module-not-measured

[flake8]
# E128/133: We prefer hang-closing visual indents.
# E251: We prefer `function(x = 1)` over `function(x=1)`.
# E501: We do not enforce a maximum line length.
# F403/405: We ignore * imports.
# W503/504: We break lines before binary operators (Knuth's style).
hang-closing = true
ignore = E128,E251,F403,F405,E501,W503,W504
in-place = true
rst-roles = any, class, exc, meth, obj
rst-directives = attribute

[tool:pytest]
addopts = --showlocals --doctest-modules --disable-pytest-warnings
testpaths = tests
python_files = **/*.py
addopts = --showlocals --doctest-modules --disable-pytest-warnings
testpaths = tests
python_files = **/*.py

[mypy]
ignore_missing_imports = True
Expand Down
35 changes: 2 additions & 33 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#! /usr/bin/env python

from setuptools import setup, find_packages
from setuptools import setup

# Please make sure to cap all dependency versions, in order to avoid unwanted
# functional and integration breaks caused by external code updates.
Expand Down Expand Up @@ -36,43 +36,12 @@

setup(
name = 'OpenFisca-Core',
version = '35.5.3',
author = 'OpenFisca Team',
author_email = '[email protected]',
classifiers = [
'Development Status :: 5 - Production/Stable',
'License :: OSI Approved :: GNU Affero General Public License v3',
'Operating System :: POSIX',
'Programming Language :: Python',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Topic :: Scientific/Engineering :: Information Analysis',
],
description = 'A versatile microsimulation free software',
keywords = 'benefit microsimulation social tax',
license = 'https://www.fsf.org/licensing/licenses/agpl-3.0.html',
url = 'https://github.com/openfisca/openfisca-core',

data_files = [
(
'share/openfisca/openfisca-core',
['CHANGELOG.md', 'LICENSE', 'README.md'],
),
],
entry_points = {
'console_scripts': [
'openfisca=openfisca_core.scripts.openfisca_command:main',
'openfisca-run-test=openfisca_core.scripts.openfisca_command:main',
],
},
install_requires = general_requirements,
extras_require = {
'web-api': api_requirements,
'dev': dev_requirements,
'tracker': [
'openfisca-tracker == 0.4.0',
],
},
include_package_data = True, # Will read MANIFEST.in
install_requires = general_requirements,
packages = find_packages(exclude=['tests*']),
)
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: 1 addition & 0 deletions tasks/dev.mk
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ uninstall:
## Delete builds and compiled python files.
clean: \
$(shell ls -d * | grep "build\|dist") \
$(shell find . -name "*.egg-info")
$(shell find . -name "*.pyc")
@$(call print_help,$@:)
@rm -rf $?
12 changes: 6 additions & 6 deletions tasks/lint.mk
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,19 @@ check-syntax-errors: .
@$(call print_pass,$@:)

## Run linters to check for syntax and style errors.
check-style: $(shell git ls-files "*.py")
check-style:
@$(call print_help,$@:)
@flake8 $?
@flake8 $(shell git ls-files "*.py")
@$(call print_pass,$@:)

## Run static type checkers for type errors.
check-types: openfisca_core openfisca_web_api
check-types:
@$(call print_help,$@:)
@mypy $?
@mypy src
@$(call print_pass,$@:)

## Run code formatters to correct style errors.
format-style: $(shell git ls-files "*.py")
format-style:
@$(call print_help,$@:)
@autopep8 $?
@autopep8 $(shell find . -name "*.py")
@$(call print_pass,$@:)
2 changes: 1 addition & 1 deletion tasks/publish.mk
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ install-publisher:
install-deps:
@$(call print_help,$@:)
@python setup.py egg_info
@pip install $$(grep -v "^\[" *.egg-info/requires.txt)
@pip install $$(grep -v "^\[" src/*.egg-info/requires.txt)
@$(call print_pass,$@:)

## Build & install openfisca-core for deployment and publishing.
Expand Down
2 changes: 1 addition & 1 deletion tasks/test_code.mk
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ test-code: test-core
## Run openfisca-core tests.
test-core: $(shell git ls-files "tests/*.py")
@$(call print_help,$@:)
@PYTEST_ADDOPTS="${PYTEST_ADDOPTS} --cov=openfisca_core ${pytest_args}" \
@PYTEST_ADDOPTS="${PYTEST_ADDOPTS} --cov=src ${pytest_args}" \
openfisca test $? \
${openfisca_args}
@$(call print_pass,$@:)